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

cmd/[568]l: do not generate PT_TLS on openbsd

The OpenBSD ld.so(1) does not currently support PT_TLS and refuses
to load ELF binaries that contain PT_TLS sections. Do not emit PT_TLS
sections - we will handle this appropriately in runtime/cgo instead.

R=golang-dev, minux.ma, iant
CC=golang-dev
https://golang.org/cl/6846064
This commit is contained in:
Joel Sing 2012-12-21 01:27:50 +11:00
parent d0283ab62a
commit e6ca125f14
3 changed files with 12 additions and 3 deletions

View File

@ -1015,7 +1015,10 @@ asmb(void)
phsh(ph, sh); phsh(ph, sh);
// .tbss (optional) and TLS phdr // .tbss (optional) and TLS phdr
if(tlsoffset != 0) { // Do not emit PT_TLS for OpenBSD since ld.so(1) does
// not currently support it. This is handled
// appropriately in runtime/cgo.
if(tlsoffset != 0 && HEADTYPE != Hopenbsd) {
ph = newElfPhdr(); ph = newElfPhdr();
ph->type = PT_TLS; ph->type = PT_TLS;
ph->flags = PF_R; ph->flags = PF_R;

View File

@ -1116,7 +1116,10 @@ asmb(void)
/* /*
* Thread-local storage segment (really just size). * Thread-local storage segment (really just size).
*/ */
if(tlsoffset != 0) { // Do not emit PT_TLS for OpenBSD since ld.so(1) does
// not currently support it. This is handled
// appropriately in runtime/cgo.
if(tlsoffset != 0 && HEADTYPE != Hopenbsd) {
ph = newElfPhdr(); ph = newElfPhdr();
ph->type = PT_TLS; ph->type = PT_TLS;
ph->flags = PF_R; ph->flags = PF_R;

View File

@ -1179,7 +1179,10 @@ asmb(void)
/* /*
* Thread-local storage segment (really just size). * Thread-local storage segment (really just size).
*/ */
if(tlsoffset != 0) { // Do not emit PT_TLS for OpenBSD since ld.so(1) does
// not currently support it. This is handled
// appropriately in runtime/cgo.
if(tlsoffset != 0 && HEADTYPE != Hopenbsd) {
ph = newElfPhdr(); ph = newElfPhdr();
ph->type = PT_TLS; ph->type = PT_TLS;
ph->flags = PF_R; ph->flags = PF_R;