Created attachment 9296 [details] input object When running the gcc testsuite on Solaris 12 with gas and gld, the PIE tests FAIL with a gld error: FAIL: gcc.dg/torture/tls/run-le.c -O0 -pie -fpie (test for excess errors) Excess errors: /vol/gcc/bin/gld-2.26: read-only segment has dynamic relocations. The failure can be reproduced with $ gld-2.26 -pie -z text -o run-le.exe run-le.o -lc gld-2.26: warning: cannot find entry symbol _start; defaulting to 0000000000000330 gld-2.26: read-only segment has dynamic relocations. Linking the exact same object with /bin/ld works just fine: $ ld -z type=pie -z text -o run-le.exe run-le.o -lc Checking which symbols triggers setting DT_TEXTREL, I find that tls_le is the culprit: $ elfdump -s run-le.o|grep tls_le [7] 0 0x4 TLS GLOB D 0 .tdata tls_le $ elfdump -r run-le.o Relocation Section: .rela.text index type offset value addend section symbol [0] R_SPARC_TLS_LE_HIX22 0x4 0 0 .text tls_le [1] R_SPARC_TLS_LE_LOX10 0x8 0 0 .text tls_le [2] R_SPARC_TLS_LE_HIX22 0x20 0 0 .text tls_le [3] R_SPARC_TLS_LE_LOX10 0x24 0 0 .text tls_le However, the situation on Solaris/x86 is similar $ elfdump -s run-le.o|grep tls_le [11] 0 0x4 TLS GLOB D 0 .tdata tls_le $ elfdump -r run-le.o |grep tls_le [2] R_386_TLS_LE 0x15 0 .text tls_le [5] R_386_TLS_LE 0x31 0 .text tls_le and yet the warning doesn't trigger. Rainer
Dup. Try: https://sourceware.org/ml/binutils/2017-10/msg00094.html *** This bug has been marked as a duplicate of bug 22263 ***