From patchwork Thu May 26 21:27:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 97628 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 02AB6B6F85 for ; Fri, 27 May 2011 07:27:59 +1000 (EST) Received: (qmail 25845 invoked by alias); 26 May 2011 21:27:58 -0000 Received: (qmail 25832 invoked by uid 22791); 26 May 2011 21:27:57 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-pw0-f47.google.com (HELO mail-pw0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 May 2011 21:27:43 +0000 Received: by pwj9 with SMTP id 9so559055pwj.20 for ; Thu, 26 May 2011 14:27:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.64.225 with SMTP id r1mr602350pbs.250.1306445262408; Thu, 26 May 2011 14:27:42 -0700 (PDT) Received: by 10.142.108.7 with HTTP; Thu, 26 May 2011 14:27:42 -0700 (PDT) In-Reply-To: References: Date: Thu, 26 May 2011 23:27:42 +0200 Message-ID: Subject: Re: [build] Fix Solaris 2/x86 GD/LD TLS code sequences with Sun ld From: Uros Bizjak To: Rainer Orth Cc: gcc-patches@gcc.gnu.org Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Thu, May 26, 2011 at 12:47 PM, Rainer Orth wrote: >>> We could certainly duplicate (some of) the logic that %P already uses, >>> but I though it easier to just introduce a straightforward variant (%p) >>> instead.  It's not pretty, but it worked. >> >> OK then... can you propose a new patch, please, changing as little of >> generic code as possible? > > I'll try, but somewhat fear that I will arive again at what I had > initially.  Will probably have to wait for the weekend. Please find attached the patch that introduces %p to output only the raw symbol name. @plt is added "manually", since it doesn't really follow -fpic flag. Uros. Index: gcc/config/i386/i386.md =================================================================== --- gcc/config/i386/i386.md (revision 174306) +++ gcc/config/i386/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%p3@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%p2@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%p2@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%p1@plt"; return "call\t%P1"; } [(set_attr "type" "multi") Index: gcc/config/i386/i386.c =================================================================== --- gcc/config/i386/i386.c (revision 174306) +++ gcc/config/i386/i386.c (working copy) @@ -13918,6 +13918,7 @@ get_some_local_dynamic_name (void) d -- print duplicated register operand for AVX instruction. D -- print condition for SSE cmp instruction. P -- if PIC, print an @PLT suffix. + p -- print raw symbol name. X -- don't print any sort of PIC '@' suffix for a symbol. & -- print some in-use local-dynamic symbol name. H -- print a memory address offset by 8; used for sse high-parts @@ -14123,6 +14124,7 @@ ix86_print_operand (FILE *file, rtx x, i case 'x': case 'X': case 'P': + case 'p': break; case 's': @@ -14522,7 +14524,7 @@ ix86_print_operand (FILE *file, rtx x, i x = const0_rtx; } - if (code != 'P') + if (code != 'P' && code != 'p') { if (CONST_INT_P (x) || GET_CODE (x) == CONST_DOUBLE) {