mirror of
https://github.com/golang/go
synced 2024-11-23 00:40:08 -07:00
cmd/ld: emit .tbss section when doing dynamic internal linking
Fixes #5200. R=iant, dave CC=golang-dev https://golang.org/cl/9383043
This commit is contained in:
parent
fad27ec5d4
commit
a848475324
@ -887,7 +887,12 @@ doelf(void)
|
|||||||
addstring(shstrtab, ".data");
|
addstring(shstrtab, ".data");
|
||||||
addstring(shstrtab, ".bss");
|
addstring(shstrtab, ".bss");
|
||||||
addstring(shstrtab, ".noptrbss");
|
addstring(shstrtab, ".noptrbss");
|
||||||
if(linkmode == LinkExternal && HEADTYPE != Hopenbsd)
|
// generate .tbss section (except for OpenBSD where it's not supported)
|
||||||
|
// for dynamic internal linker or external linking, so that various
|
||||||
|
// binutils could correctly calculate PT_TLS size.
|
||||||
|
// see http://golang.org/issue/5200.
|
||||||
|
if(HEADTYPE != Hopenbsd)
|
||||||
|
if(!debug['d'] || linkmode == LinkExternal)
|
||||||
addstring(shstrtab, ".tbss");
|
addstring(shstrtab, ".tbss");
|
||||||
if(HEADTYPE == Hnetbsd)
|
if(HEADTYPE == Hnetbsd)
|
||||||
addstring(shstrtab, ".note.netbsd.ident");
|
addstring(shstrtab, ".note.netbsd.ident");
|
||||||
@ -1412,6 +1417,16 @@ elfobj:
|
|||||||
sh->flags = 0;
|
sh->flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// generate .tbss section for dynamic internal linking (except for OpenBSD)
|
||||||
|
// external linking generates .tbss in data.c
|
||||||
|
if(linkmode == LinkInternal && !debug['d'] && HEADTYPE != Hopenbsd) {
|
||||||
|
sh = elfshname(".tbss");
|
||||||
|
sh->type = SHT_NOBITS;
|
||||||
|
sh->addralign = PtrSize;
|
||||||
|
sh->size = -tlsoffset;
|
||||||
|
sh->flags = SHF_ALLOC | SHF_TLS | SHF_WRITE;
|
||||||
|
}
|
||||||
|
|
||||||
if(!debug['s']) {
|
if(!debug['s']) {
|
||||||
sh = elfshname(".symtab");
|
sh = elfshname(".symtab");
|
||||||
sh->type = SHT_SYMTAB;
|
sh->type = SHT_SYMTAB;
|
||||||
|
Loading…
Reference in New Issue
Block a user