| ... | @@ -237,8 +237,8 @@ pub fn setOutputSym(symbol: Symbol, elf_file: *Elf, out: *elf.Elf64_Sym) void { | ... | @@ -237,8 +237,8 @@ pub fn setOutputSym(symbol: Symbol, elf_file: *Elf, out: *elf.Elf64_Sym) void { |
| 237 | const st_shndx = blk: { | 237 | const st_shndx = blk: { |
| 238 | if (symbol.flags.has_copy_rel) break :blk elf_file.copy_rel_section_index.?; | 238 | if (symbol.flags.has_copy_rel) break :blk elf_file.copy_rel_section_index.?; |
| 239 | if (file_ptr == .shared_object or esym.st_shndx == elf.SHN_UNDEF) break :blk elf.SHN_UNDEF; | 239 | if (file_ptr == .shared_object or esym.st_shndx == elf.SHN_UNDEF) break :blk elf.SHN_UNDEF; |
| 240 | if (symbol.atom(elf_file) == null and file_ptr != .linker_defined) | 240 | if (elf_file.isRelocatable() and esym.st_shndx == elf.SHN_COMMON) break :blk elf.SHN_COMMON; |
| 241 | break :blk elf.SHN_ABS; | 241 | if (symbol.atom(elf_file) == null and file_ptr != .linker_defined) break :blk elf.SHN_ABS; |
| 242 | break :blk symbol.outputShndx() orelse elf.SHN_UNDEF; | 242 | break :blk symbol.outputShndx() orelse elf.SHN_UNDEF; |
| 243 | }; | 243 | }; |
| 244 | const st_value = blk: { | 244 | const st_value = blk: { |
| ... | @@ -247,7 +247,7 @@ pub fn setOutputSym(symbol: Symbol, elf_file: *Elf, out: *elf.Elf64_Sym) void { | ... | @@ -247,7 +247,7 @@ pub fn setOutputSym(symbol: Symbol, elf_file: *Elf, out: *elf.Elf64_Sym) void { |
| 247 | if (symbol.flags.is_canonical) break :blk symbol.address(.{}, elf_file); | 247 | if (symbol.flags.is_canonical) break :blk symbol.address(.{}, elf_file); |
| 248 | break :blk 0; | 248 | break :blk 0; |
| 249 | } | 249 | } |
| 250 | if (st_shndx == elf.SHN_ABS) break :blk symbol.value; | 250 | if (st_shndx == elf.SHN_ABS or st_shndx == elf.SHN_COMMON) break :blk symbol.value; |
| 251 | const shdr = &elf_file.shdrs.items[st_shndx]; | 251 | const shdr = &elf_file.shdrs.items[st_shndx]; |
| 252 | if (shdr.sh_flags & elf.SHF_TLS != 0 and file_ptr != .linker_defined) | 252 | if (shdr.sh_flags & elf.SHF_TLS != 0 and file_ptr != .linker_defined) |
| 253 | break :blk symbol.value - elf_file.tlsAddress(); | 253 | break :blk symbol.value - elf_file.tlsAddress(); |