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

cmd/dist: fix darwin build

The TLS block on Darwin is not the same as on ELF.

TBR=elias.naur
CC=golang-dev
https://golang.org/cl/12741044
This commit is contained in:
Russ Cox 2013-08-14 12:57:05 -04:00
parent a5f257a042
commit 308a3e6c52
3 changed files with 11 additions and 11 deletions

View File

@ -166,17 +166,16 @@ static struct {
// If the linker is not outputting a shared library, it will reduce // If the linker is not outputting a shared library, it will reduce
// the TLS accessors to the local exec model, effectively removing // the TLS accessors to the local exec model, effectively removing
// get_tls(). // get_tls().
{"amd64", "", {"amd64", "linux",
"// The offsets 0 and 8 are known to:\n"
"// ../../cmd/6l/pass.c:/D_GS\n"
"// cgo/gcc_linux_amd64.c:/^threadentry\n"
"// cgo/gcc_darwin_amd64.c:/^threadentry\n"
"//\n"
"#define get_tls(r) MOVQ runtime·tlsgm(SB), r\n" "#define get_tls(r) MOVQ runtime·tlsgm(SB), r\n"
"#define g(r) 0(r)(GS*1)\n" "#define g(r) 0(r)(GS*1)\n"
"#define m(r) 8(r)(GS*1)\n" "#define m(r) 8(r)(GS*1)\n"
}, },
{"amd64", "",
"#define get_tls(r)\n"
"#define g(r) 0(GS)\n"
"#define m(r) 8(GS)\n"
},
{"arm", "", {"arm", "",
"#define LR R14\n" "#define LR R14\n"
}, },

View File

@ -1212,7 +1212,7 @@ dodata(void)
diag("data or bss segment too large"); diag("data or bss segment too large");
} }
if(iself && linkmode == LinkExternal && s != nil && s->type == STLSBSS && HEADTYPE != Hopenbsd) { if(iself && linkmode == LinkExternal && s != nil && s->type == STLSBSS && iself && HEADTYPE != Hopenbsd) {
sect = addsection(&segdata, ".tbss", 06); sect = addsection(&segdata, ".tbss", 06);
sect->align = PtrSize; sect->align = PtrSize;
sect->vaddr = 0; sect->vaddr = 0;

View File

@ -361,11 +361,12 @@ loadlib(void)
s->type = 0; s->type = 0;
} }
} }
gmsym = lookup("runtime.tlsgm", 0); gmsym = lookup("runtime.tlsgm", 0);
gmsym->type = STLSBSS; gmsym->type = STLSBSS;
gmsym->size = 2*PtrSize; gmsym->size = 2*PtrSize;
gmsym->hide = 1; gmsym->hide = 1;
if(linkmode == LinkExternal) if(linkmode == LinkExternal && iself && HEADTYPE != Hopenbsd)
gmsym->reachable = 1; gmsym->reachable = 1;
else else
gmsym->reachable = 0; gmsym->reachable = 0;