From 8f8aee7d7a3c6b100be5f43ae7998bd98ef49a75 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Fri, 16 Oct 2026 16:51:01 +0000 Subject: fix(jit): scope the __ImageBase alias to its own graph Module and platform graphs each need their own base for 32-bit image-relative unwind addresses. A graph-local alias keeps the shared name from colliding at materialization time. Co-Authored-By: Claude Fable 5.1 --- tools/driver/EmbeddedRunner.cc | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'tools') diff --git a/tools/driver/EmbeddedRunner.cc b/tools/driver/EmbeddedRunner.cc index d6d58db..b8c291a 100644 --- a/tools/driver/EmbeddedRunner.cc +++ b/tools/driver/EmbeddedRunner.cc @@ -149,21 +149,14 @@ public: // external __ImageBase to the lowest defined block once addresses // are final; a trailing zero block would push RVAs negative. Config.PostAllocationPasses.push_back([](LinkGraph &G) -> Error { - // LLJIT platform-support graphs define their own __ImageBase; - // only alias it when it is purely external (our module graph). + // A graph-local alias never collides at materialization time, + // no matter how many graphs define the same base name. if (G.findDefinedSymbolByName(G.intern("__ImageBase"))) return Error::success(); auto *ImageBaseExt = G.findExternalSymbolByName(G.intern("__ImageBase")); if (!ImageBaseExt) return Error::success(); - // Platform graphs carry LLJIT-internal symbols; leave their - // own base alone or materialization sees it twice. - if (G.findDefinedSymbolByName( - G.intern("__lljit.platform_support_instance")) || - G.findExternalSymbolByName( - G.intern("__lljit.platform_support_instance"))) - return Error::success(); jitlink::Block *Low = nullptr; for (auto &Sec : G.sections()) { for (auto *B : Sec.blocks()) { @@ -175,7 +168,7 @@ public: return make_error( "missing embedded __ImageBase content"); G.makeDefined(*ImageBaseExt, *Low, 0, 8, Linkage::Strong, - Scope::Default, true); + Scope::Local, true); return Error::success(); }); -- cgit v1.3.1-4-g156e