diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2022-10-19 13:03:07 +0200 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2022-10-22 07:59:23 +0200 |
| commit | baceaf65f258d2da422ddd0abdf2452937bd7b6d (patch) | |
| tree | c079b706c929f96ea84f0e4fcda42faa96151e7f /src/link | |
| parent | a32bc0e39c9d2b33547241fcb9868d72e52ee1df (diff) | |
| download | zig-baceaf65f258d2da422ddd0abdf2452937bd7b6d.tar.gz zig-baceaf65f258d2da422ddd0abdf2452937bd7b6d.zip | |
macho: fix incorrectly erroring out with multiple sym definition
Diffstat (limited to 'src/link')
| -rw-r--r-- | src/link/MachO.zig | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/link/MachO.zig b/src/link/MachO.zig index c7046cec9e..30bbc2b6c0 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -2702,13 +2702,17 @@ pub fn updateDeclExports( self.resolveGlobalSymbol(sym_loc) catch |err| switch (err) { error.MultipleSymbolDefinitions => { - _ = try module.failed_exports.put(module.gpa, exp, try Module.ErrorMsg.create( - gpa, - decl.srcLoc(), - \\LinkError: symbol '{s}' defined multiple times - , - .{exp_name}, - )); + // TODO: this needs rethinking + const global = self.getGlobal(exp_name).?; + if (sym_loc.sym_index != global.sym_index and global.file != null) { + _ = try module.failed_exports.put(module.gpa, exp, try Module.ErrorMsg.create( + gpa, + decl.srcLoc(), + \\LinkError: symbol '{s}' defined multiple times + , + .{exp_name}, + )); + } }, else => |e| return e, }; |
