]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/[568]l: do not generate PT_TLS on openbsd
authorJoel Sing <jsing@google.com>
Thu, 20 Dec 2012 14:27:50 +0000 (01:27 +1100)
committerJoel Sing <jsing@google.com>
Thu, 20 Dec 2012 14:27:50 +0000 (01:27 +1100)
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

src/cmd/5l/asm.c
src/cmd/6l/asm.c
src/cmd/8l/asm.c

index a937650480c2f6233e4705a751c915a91d597df7..f62c927e24464f717662e2026f5ee86013794f48 100644 (file)
@@ -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;
index 89ea86109f53634ccdabe5d19f512cd073d886a0..b0ff15423a5856bb456dae1ad18092dc96a675dd 100644 (file)
@@ -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;
index 3d3248f937dcd4f87784fc20b23dd9e675c0e396..e83e4a87922f7703d7e1f947e0ce8c1bf4c18180 100644 (file)
@@ -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;