1
0
mirror of https://github.com/golang/go synced 2024-11-25 07:07:57 -07:00

cmd/link: make bss section offset at end of its segment

Fixes #47168
This commit is contained in:
Tao Qingyun 2021-07-13 22:42:27 +08:00
parent ed01ceaf48
commit f013fb96ac

View File

@ -1107,8 +1107,10 @@ func elfshbits(linkmode LinkMode, sect *sym.Section) *ElfShdr {
}
sh.Addralign = uint64(sect.Align)
sh.Size = sect.Length
if sect.Name != ".tbss" {
if sh.Type != uint32(elf.SHT_NOBITS) {
sh.Off = sect.Seg.Fileoff + sect.Vaddr - sect.Seg.Vaddr
} else {
sh.Off = sect.Seg.Fileoff + sect.Seg.Filelen
}
return sh