| ... | @@ -47,7 +47,7 @@ fn newSymbolAssumeCapacity(self: *LinkerDefined, name_off: u32, elf_file: *Elf) | ... | @@ -47,7 +47,7 @@ fn newSymbolAssumeCapacity(self: *LinkerDefined, name_off: u32, elf_file: *Elf) |
| 47 | const esym = self.symtab.addOneAssumeCapacity(); | 47 | const esym = self.symtab.addOneAssumeCapacity(); |
| 48 | esym.* = .{ | 48 | esym.* = .{ |
| 49 | .st_name = name_off, | 49 | .st_name = name_off, |
| 50 | .st_info = elf.STB_GLOBAL << 4, | 50 | .st_info = elf.STB_WEAK << 4, |
| 51 | .st_other = @intFromEnum(elf.STV.HIDDEN), | 51 | .st_other = @intFromEnum(elf.STV.HIDDEN), |
| 52 | .st_shndx = elf.SHN_ABS, | 52 | .st_shndx = elf.SHN_ABS, |
| 53 | .st_value = 0, | 53 | .st_value = 0, |
| ... | @@ -255,8 +255,10 @@ pub fn allocateSymbols(self: *LinkerDefined, elf_file: *Elf) void { | ... | @@ -255,8 +255,10 @@ pub fn allocateSymbols(self: *LinkerDefined, elf_file: *Elf) void { |
| 255 | | 255 | |
| 256 | // __dso_handle | 256 | // __dso_handle |
| 257 | if (self.dso_handle_index) |index| { | 257 | if (self.dso_handle_index) |index| { |
| 258 | const shdr = shdrs[1]; | 258 | if (self.resolveSymbol(index, elf_file).file == self.index) { |
| 259 | allocSymbol(self, index, shdr.sh_addr, 0, elf_file); | 259 | const shdr = shdrs[1]; |
| | 260 | allocSymbol(self, index, shdr.sh_addr, 0, elf_file); |
| | 261 | } |
| 260 | } | 262 | } |
| 261 | | 263 | |
| 262 | // __GNU_EH_FRAME_HDR | 264 | // __GNU_EH_FRAME_HDR |