| ... | @@ -3170,11 +3170,20 @@ fn allocateLinkerDefinedSymbols(self: *Elf) void { | ... | @@ -3170,11 +3170,20 @@ fn allocateLinkerDefinedSymbols(self: *Elf) void { |
| 3170 | } | 3170 | } |
| 3171 | | 3171 | |
| 3172 | // _GLOBAL_OFFSET_TABLE_ | 3172 | // _GLOBAL_OFFSET_TABLE_ |
| 3173 | if (self.got_plt_section_index) |shndx| { | 3173 | if (self.getTarget().cpu.arch == .x86_64) { |
| 3174 | const shdr = &self.shdrs.items[shndx]; | 3174 | if (self.got_plt_section_index) |shndx| { |
| 3175 | const symbol_ptr = self.symbol(self.got_index.?); | 3175 | const shdr = self.shdrs.items[shndx]; |
| 3176 | symbol_ptr.value = shdr.sh_addr; | 3176 | const sym = self.symbol(self.got_index.?); |
| 3177 | symbol_ptr.output_section_index = shndx; | 3177 | sym.value = shdr.sh_addr; |
| | 3178 | sym.output_section_index = shndx; |
| | 3179 | } |
| | 3180 | } else { |
| | 3181 | if (self.got_section_index) |shndx| { |
| | 3182 | const shdr = self.shdrs.items[shndx]; |
| | 3183 | const sym = self.symbol(self.got_index.?); |
| | 3184 | sym.value = shdr.sh_addr; |
| | 3185 | sym.output_section_index = shndx; |
| | 3186 | } |
| 3178 | } | 3187 | } |
| 3179 | | 3188 | |
| 3180 | // _PROCEDURE_LINKAGE_TABLE_ | 3189 | // _PROCEDURE_LINKAGE_TABLE_ |