| ... | @@ -1891,7 +1891,6 @@ fn resolveStubsAndGotEntries(self: *Zld) !void { | ... | @@ -1891,7 +1891,6 @@ fn resolveStubsAndGotEntries(self: *Zld) !void { |
| 1891 | const relocs = sect.relocs orelse continue; | 1891 | const relocs = sect.relocs orelse continue; |
| 1892 | for (relocs) |rel| { | 1892 | for (relocs) |rel| { |
| 1893 | switch (rel.@"type") { | 1893 | switch (rel.@"type") { |
| 1894 | .unsigned => continue, | | |
| 1895 | .got_page, .got_page_off, .got_load, .got, .pointer_to_got => { | 1894 | .got_page, .got_page_off, .got_load, .got, .pointer_to_got => { |
| 1896 | const sym = rel.target.symbol.getTopmostAlias(); | 1895 | const sym = rel.target.symbol.getTopmostAlias(); |
| 1897 | if (sym.got_index != null) continue; | 1896 | if (sym.got_index != null) continue; |
| ... | @@ -2025,12 +2024,9 @@ fn resolveRelocsAndWriteSections(self: *Zld) !void { | ... | @@ -2025,12 +2024,9 @@ fn resolveRelocsAndWriteSections(self: *Zld) !void { |
| 2025 | const got = dc_seg.sections.items[self.got_section_index.?]; | 2024 | const got = dc_seg.sections.items[self.got_section_index.?]; |
| 2026 | const final = rel.target.symbol.getTopmostAlias(); | 2025 | const final = rel.target.symbol.getTopmostAlias(); |
| 2027 | const got_index = final.got_index orelse { | 2026 | const got_index = final.got_index orelse { |
| 2028 | // TODO remove this when we can link against TAPI files. | 2027 | log.err("expected GOT index relocating symbol '{s}'", .{final.name}); |
| 2029 | log.err("undefined reference to symbol '{s}'", .{final.name}); | 2028 | log.err("this is an internal linker error", .{}); |
| 2030 | log.err(" | referenced in {s}", .{ | 2029 | return error.FailedToResolveRelocationTarget; |
| 2031 | rel.target.symbol.cast(Symbol.Unresolved).?.file.name.?, | | |
| 2032 | }); | | |
| 2033 | return error.UndefinedSymbolReference; | | |
| 2034 | }; | 2030 | }; |
| 2035 | args.target_addr = got.addr + got_index * @sizeOf(u64); | 2031 | args.target_addr = got.addr + got_index * @sizeOf(u64); |
| 2036 | }, | 2032 | }, |
| ... | @@ -2099,16 +2095,14 @@ fn relocTargetAddr(self: *Zld, object: *const Object, target: reloc.Relocation.T | ... | @@ -2099,16 +2095,14 @@ fn relocTargetAddr(self: *Zld, object: *const Object, target: reloc.Relocation.T |
| 2099 | const segment = self.load_commands.items[self.text_segment_cmd_index.?].Segment; | 2095 | const segment = self.load_commands.items[self.text_segment_cmd_index.?].Segment; |
| 2100 | const stubs = segment.sections.items[self.stubs_section_index.?]; | 2096 | const stubs = segment.sections.items[self.stubs_section_index.?]; |
| 2101 | const stubs_index = proxy.base.stubs_index orelse { | 2097 | const stubs_index = proxy.base.stubs_index orelse { |
| 2102 | // TODO remove this when we can link against TAPI files. | 2098 | log.err("expected stubs index when relocating symbol '{s}'", .{final.name}); |
| 2103 | log.err("undefined reference to symbol '{s}'", .{final.name}); | 2099 | log.err("this is an internal linker error", .{}); |
| 2104 | log.err(" | referenced in {s}", .{ | 2100 | return error.FailedToResolveRelocationTarget; |
| 2105 | sym.cast(Symbol.Unresolved).?.file.name.?, | | |
| 2106 | }); | | |
| 2107 | return error.UndefinedSymbolReference; | | |
| 2108 | }; | 2101 | }; |
| 2109 | break :blk stubs.addr + stubs_index * stubs.reserved2; | 2102 | break :blk stubs.addr + stubs_index * stubs.reserved2; |
| 2110 | } else { | 2103 | } else { |
| 2111 | log.err("failed to resolve symbol '{s}' as a relocation target", .{sym.name}); | 2104 | log.err("failed to resolve symbol '{s}' as a relocation target", .{sym.name}); |
| | 2105 | log.err("this is an internal linker error", .{}); |
| 2112 | return error.FailedToResolveRelocationTarget; | 2106 | return error.FailedToResolveRelocationTarget; |
| 2113 | } | 2107 | } |
| 2114 | }, | 2108 | }, |