Commit e6ca125f authored by Joel Sing's avatar Joel Sing

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
parent d0283ab6
......@@ -1015,7 +1015,10 @@ asmb(void)
phsh(ph, sh);
// .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->type = PT_TLS;
ph->flags = PF_R;
......
......@@ -1116,7 +1116,10 @@ asmb(void)
/*
* 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->type = PT_TLS;
ph->flags = PF_R;
......
......@@ -1179,7 +1179,10 @@ asmb(void)
/*
* 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->type = PT_TLS;
ph->flags = PF_R;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment