aboutsummaryrefslogtreecommitdiff
path: root/src/link/MachO
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2023-11-10 12:52:52 +0100
committerJakub Konka <kubkon@jakubkonka.com>2023-11-10 12:52:56 +0100
commit0f2489d8fc314c67bec7d77832cb6ba773f48738 (patch)
treed70f526927583c469cce908851102714e1701ecc /src/link/MachO
parent03adafd8023691af6a1e3d784a6e7e1f77d46859 (diff)
downloadzig-0f2489d8fc314c67bec7d77832cb6ba773f48738.tar.gz
zig-0f2489d8fc314c67bec7d77832cb6ba773f48738.zip
macho: resolve special section/segment boundary symbols
Boundary symbols have a special name prefix: * section$start$segname$sectname * section$stop$segname$sectname * segment$start$segname * segment$stop$segname and will resolve to either start or end of the respective section/segment if found. If not found, we return an error stating we couldn't find the requested section/segment rather than silently failing and resolving the address to 0 which seems to be the case with Apple's ld64.
Diffstat (limited to 'src/link/MachO')
-rw-r--r--src/link/MachO/dead_strip.zig1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/link/MachO/dead_strip.zig b/src/link/MachO/dead_strip.zig
index 42cd437564..dda82385e1 100644
--- a/src/link/MachO/dead_strip.zig
+++ b/src/link/MachO/dead_strip.zig
@@ -50,6 +50,7 @@ fn collectRoots(macho_file: *MachO, roots: *AtomTable) !void {
for (macho_file.globals.items) |global| {
const sym = macho_file.getSymbol(global);
if (sym.undf()) continue;
+ if (sym.n_desc == MachO.N_BOUNDARY) continue;
if (global.getFile()) |file| {
try addRoot(macho_file, roots, file, global);