Skip to content

Commit

Permalink
fix adapte Symbol Offset change InvalidOffset
Browse files Browse the repository at this point in the history
  • Loading branch information
pkujhd committed Mar 2, 2024
1 parent 76d7ffa commit 2cedbca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ld.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,14 @@ func (linker *Linker) adaptSymbolOffset() {
case symkind.SNOPTRBSS:
offset += len(linker.Data) + len(linker.Noptrdata) + len(linker.Bss)
}
sym.Offset += offset
if sym.Offset != InvalidOffset {
sym.Offset += offset
}
if offset != 0 {
for index := range sym.Reloc {
sym.Reloc[index].Offset += offset
if sym.Reloc[index].Offset != InvalidOffset {
sym.Reloc[index].Offset += offset
}
}
}
}
Expand Down

0 comments on commit 2cedbca

Please sign in to comment.