From patchwork Fri May 27 12:25:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 97674 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 41F0AB6F8B for ; Fri, 27 May 2011 22:26:21 +1000 (EST) Received: (qmail 31718 invoked by alias); 27 May 2011 12:26:18 -0000 Received: (qmail 31676 invoked by uid 22791); 27 May 2011 12:26:15 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, TW_ZJ, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 27 May 2011 12:25:58 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 60A68CC6; Fri, 27 May 2011 14:25:57 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 2HisvGzAARkL; Fri, 27 May 2011 14:25:54 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 3AC98CC5; Fri, 27 May 2011 14:25:54 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id p4RCPr3U018306; Fri, 27 May 2011 14:25:53 +0200 (MEST) From: Rainer Orth To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org Subject: Re: [build] Fix Solaris 2/x86 GD/LD TLS code sequences with Sun ld References: Date: Fri, 27 May 2011 14:25:53 +0200 In-Reply-To: (Uros Bizjak's message of "Thu, 26 May 2011 23:27:42 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes 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 Uros Bizjak writes: > 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. Thanks, that almost did it: * HAVE_AS_IX86_{TLSGDPLT, TLSLDMPLT} are always defined as 0/1, so we need if, not #ifdef. * The @tlsldmplt TARGET_SUN_TLS test was inverted. The patch below has just been bootstrapped on i386-pc-solaris2.11 with both Sun as (which supports both relocs) and gas (which supports none). With Sun as, all run-{gd, ld}.c failures are gone, with GNU as, the 32-bit run-ld.c failures remain, as expected. I'll next try to get @tls{gd, ldm}plt support into gas. Ok for mainline now? Rainer 2010-12-30 Rainer Orth Uros Bizjak * configure.ac (gcc_cv_as_ix86_tlsgdplt): Check for @tlsgdplt (HAVE_AS_IX86_TLSGDPTL): Define. (gcc_cv_as_ix86_tlsldmplt): Check for @tlsldmplt. (HAVE_AS_IX86_TLSLDMPLT): Define. * configure: Regenerate. * config.in: Regenerate. * config/i386/i386.c (ix86_print_operand): Handle code 'p'. * config/i386/i386.md (*tls_global_dynamic_32_gnu): If TARGET_SUN_TLS, use @tlsgdplt or @plt. (*tls_global_dynamic_64): Use @plt if TARGET_SUN_TLS. (*tls_local_dynamic_base_32_gnu): If TARGET_SUN_TLS, use @tlsldmplt or @plt. (*tls_local_dynamic_base_64): Use @plt if TARGET_SUN_TLS. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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) { diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -12367,6 +12367,13 @@ { output_asm_insn ("lea{l}\t{%a2@tlsgd(,%1,1), %0|%0, %a2@tlsgd[%1*1]}", operands); + if (TARGET_SUN_TLS) + { + if (HAVE_AS_IX86_TLSGDPLT) + return "call\t%a2@tlsgdplt"; + else + return "call\t%p3@plt"; + } return "call\t%P3"; } [(set_attr "type" "multi") @@ -12397,6 +12404,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 +12433,13 @@ { output_asm_insn ("lea{l}\t{%&@tlsldm(%1), %0|%0, %&@tlsldm[%1]}", operands); + if (TARGET_SUN_TLS) + { + if (HAVE_AS_IX86_TLSLDMPLT) + return "call\t%&@tlsldmplt"; + else + return "call\t%p2@plt"; + } return "call\t%P2"; } [(set_attr "type" "multi") @@ -12450,6 +12466,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") diff --git a/gcc/configure.ac b/gcc/configure.ac --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3550,6 +3550,20 @@ foo: nop [AC_DEFINE(HAVE_AS_IX86_REP_LOCK_PREFIX, 1, [Define if the assembler supports 'rep , lock '.])]) + gcc_GAS_CHECK_FEATURE([R_386_TLS_GD_PLT reloc], + gcc_cv_as_ix86_tlsgdplt,,, + [call tls_gd@tlsgdplt]) + AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLSGDPLT, + [`if test $gcc_cv_as_ix86_tlsgdplt = yes; then echo 1; else echo 0; fi`], + [Define 0/1 if your assembler supports @tlsgdplt.]) + + gcc_GAS_CHECK_FEATURE([R_386_TLS_LDM_PLT reloc], + gcc_cv_as_ix86_tlsldmplt,,, + [call tls_ld@tlsldmplt]) + AC_DEFINE_UNQUOTED(HAVE_AS_IX86_TLSLDMPLT, + [`if test $gcc_cv_as_ix86_tlsldmplt = yes; then echo 1; else echo 0; fi`], + [Define 0/1 if your assembler supports @tlsldmplt.]) + ;; ia64*-*-*)