diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2021-08-03 23:39:32 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2021-08-12 10:20:57 +0200 |
| commit | f01366e8b3ff46831feef2ceb13c5602c0ae3e99 (patch) | |
| tree | 02f47e0e84de912c6de20edf58f3ecc502a1a278 /src | |
| parent | 35403d41ce7845628d608ffd6fe16aa334f017ef (diff) | |
| download | zig-f01366e8b3ff46831feef2ceb13c5602c0ae3e99.tar.gz zig-f01366e8b3ff46831feef2ceb13c5602c0ae3e99.zip | |
macho: exclude tentative def before checking for collision
when resolving global symbols.
Diffstat (limited to 'src')
| -rw-r--r-- | src/link/MachO.zig | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/link/MachO.zig b/src/link/MachO.zig index d78f0dc942..17e17f13f0 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -2167,19 +2167,16 @@ fn resolveSymbolsInObject( .global => { const global = &self.globals.items[resolv.where_index]; - if (!(symbolIsWeakDef(sym) or symbolIsPext(sym)) and + if (symbolIsTentative(global.*)) { + _ = tentatives.fetchSwapRemove(resolv.where_index); + } else if (!(symbolIsWeakDef(sym) or symbolIsPext(sym)) and !(symbolIsWeakDef(global.*) or symbolIsPext(global.*))) { log.err("symbol '{s}' defined multiple times", .{sym_name}); log.err(" first definition in '{s}'", .{self.objects.items[resolv.file].name}); log.err(" next definition in '{s}'", .{object.name}); return error.MultipleSymbolDefinitions; - } - if (symbolIsWeakDef(sym) or symbolIsPext(sym)) continue; // Current symbol is weak, so skip it. - - if (symbolIsTentative(global.*)) { - _ = tentatives.fetchSwapRemove(resolv.where_index); - } + } else if (symbolIsWeakDef(sym) or symbolIsPext(sym)) continue; // Current symbol is weak, so skip it. // Otherwise, update the resolver and the global symbol. global.n_type = sym.n_type; |
