From patchwork Tue May 24 15:14:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [build] Fix Solaris 2/x86 GD/LD TLS code sequences with Sun ld Date: Tue, 24 May 2011 05:14:30 -0000 From: Uros Bizjak X-Patchwork-Id: 97172 Message-Id: To: Rainer Orth Cc: gcc-patches@gcc.gnu.org On Tue, May 24, 2011 at 5:09 PM, Rainer Orth wrote: >> Since handling of "p" is not conditional (that is, controlled by some >> compile flag), it is IMO better to just output correct assembly from >> the insn pattern itself.  You will also output lower-case "@plt" which > > I think I tried something along these lines, but failed with duplicate > @plt@plt for PIC code. Hm, there is no %P1 present, so I don't think this should be an issue. >> is IIRC preferred by Sun assebler. > > I've never seen such an issue. OK, it is your call... please change @plt to @PLT if desired. >> Something like attached (untested) patch. > > Unfortunately, the Solaris 10/x86 bootstrap fails in the stage1 libgomp: > > /vol/gcc/src/hg/trunk/solaris/libgomp/single.c: In function 'GOMP_single_start': > /vol/gcc/src/hg/trunk/solaris/libgomp/single.c:55:1: internal compiler error: ou > tput_operand: '%&' used without any local dynamic TLS references Yeah, I found the problem in tlsgdplt template, please find attached new version of the patch... Uros. Index: i386.md =================================================================== --- i386.md (revision 174119) +++ i386.md (working copy) @@ -12367,6 +12367,12 @@ { output_asm_insn ("lea{l}\t{%a2@tlsgd(,%1,1), %0|%0, %a2@tlsgd[%1*1]}", operands); + if (TARGET_SUN_TLS) +#ifdef HAVE_AS_IX86_TLSGDPLT + return "call\t%a2@tlsgdplt"; +#else + return "call\t%a3@plt"; +#endif return "call\t%P3"; } [(set_attr "type" "multi") @@ -12397,6 +12403,8 @@ ("lea{q}\t{%a1@tlsgd(%%rip), %%rdi|rdi, %a1@tlsgd[rip]}", operands); fputs (ASM_SHORT "0x6666\n", asm_out_file); fputs ("\trex64\n", asm_out_file); + if (TARGET_SUN_TLS) + return "call\t%a2@plt"; return "call\t%P2"; } [(set_attr "type" "multi") @@ -12424,6 +12432,12 @@ { output_asm_insn ("lea{l}\t{%&@tlsldm(%1), %0|%0, %&@tlsldm[%1]}", operands); + if (TARGET_SUN_TLS) +#ifdef HAVE_AS_IX86_TLSLDMPLT + return "call\t%&@tlsldmplt"; +#else + return "call\t%a2@plt"; +#endif return "call\t%P2"; } [(set_attr "type" "multi") @@ -12450,6 +12464,8 @@ { output_asm_insn ("lea{q}\t{%&@tlsld(%%rip), %%rdi|rdi, %&@tlsld[rip]}", operands); + if (TARGET_SUN_TLS) + return "call\t%a1@plt"; return "call\t%P1"; } [(set_attr "type" "multi")