From patchwork Fri May 27 15:48:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 97700 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 7C9C0B6F8C for ; Sat, 28 May 2011 01:49:21 +1000 (EST) Received: (qmail 27018 invoked by alias); 27 May 2011 15:49:19 -0000 Received: (qmail 27006 invoked by uid 22791); 27 May 2011 15:49:18 -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 15:48:36 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id BB276498; Fri, 27 May 2011 17:48:34 +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 aXNfEd8NR4MT; Fri, 27 May 2011 17:48:31 +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 8197D496; Fri, 27 May 2011 17:48:31 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id p4RFmVU0018768; Fri, 27 May 2011 17:48:31 +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 17:48:30 +0200 In-Reply-To: (Uros Bizjak's message of "Fri, 27 May 2011 14:50:14 +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: >> * HAVE_AS_IX86_{TLSGDPLT, TLSLDMPLT} are always defined as 0/1, so we >>  need if, not #ifdef. > > There is no need to always define it. Please simplify your > configure.ac check, see i.e. check for sahf mnemonic in configure.ac. Ok, done. > Please change the check in configure.ac to conditionally define > HAVE_AS_IX86_... defines. > > The patch is OK with this change. Here's what I've checked in after retesting as described before. I've also added the description of the new 'p' code to i386.md. Thanks for your help. Rainer 2011-05-27 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 @@ -53,6 +53,7 @@ ;; 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 @@ -12367,6 +12368,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 +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,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 +12465,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 @@ -3649,6 +3649,18 @@ 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(HAVE_AS_IX86_TLSGDPLT, 1, + [Define 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(HAVE_AS_IX86_TLSLDMPLT, 1, + [Define if your assembler supports @tlsldmplt.])]) + ;; ia64*-*-*)