From patchwork Sun Oct 31 08:47:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 69701 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 39C231007D1 for ; Sun, 31 Oct 2010 19:47:51 +1100 (EST) Received: (qmail 28700 invoked by alias); 31 Oct 2010 08:47:49 -0000 Received: (qmail 28690 invoked by uid 22791); 31 Oct 2010 08:47:48 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_TJ X-Spam-Check-By: sourceware.org Received: from mail-pv0-f175.google.com (HELO mail-pv0-f175.google.com) (74.125.83.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 31 Oct 2010 08:47:43 +0000 Received: by pva4 with SMTP id 4so363973pva.20 for ; Sun, 31 Oct 2010 01:47:42 -0700 (PDT) Received: by 10.142.97.15 with SMTP id u15mr1718332wfb.389.1288514861747; Sun, 31 Oct 2010 01:47:41 -0700 (PDT) Received: from bubble.grove.modra.org ([115.187.252.19]) by mx.google.com with ESMTPS id p8sm6097525wff.4.2010.10.31.01.47.39 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 31 Oct 2010 01:47:40 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 139C3170C1EB; Sun, 31 Oct 2010 19:17:35 +1030 (CST) Date: Sun, 31 Oct 2010 19:17:35 +1030 From: Alan Modra To: gcc-patches@gcc.gnu.org, David Edelsohn Subject: [PowerPC] Fix setjmp test fails Message-ID: <20101031084734.GT31277@bubble.grove.modra.org> Mail-Followup-To: gcc-patches@gcc.gnu.org, David Edelsohn MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 gcc.dg/stackalign/setup-{1,3,4}.c exposed two bugs in my -msecure-plt support for powerpc-linux. First, rs6000_pic_labelno can only be used when rs6000_emit_load_toc_table is called from the prologue. Using it again in the body of a function results in Error: symbol `.LCF1' is already defined. Fixed easily by using a normal label, rather than the special one for -mrelocatable. Secondly, load_toc_v4_PIC_3b had its constraints reversed, allowing gcc to choose r0 as the input to an addis instruction. Bootstrapped and regression tested powerpc-linux. OK to apply everywhere? * config/rs6000/rs6000.c (rs6000_pic_labelno): Make static. (rs6000_emit_load_toc_table): Don't use rs6000_pic_labelno when TARGET_SECURE_PLT. * config/rs6000/sysv4.h (rs6000_pic_labelno): Don't declare. * config/rs6000/rs6000.md (load_toc_v4_PIC_3b): Use "b" constraint on input, "r" on output. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 166086) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -191,7 +191,7 @@ static GTY(()) int common_mode_defined; /* Label number of label created for -mrelocatable, to call to so we can get the address of the GOT section */ -int rs6000_pic_labelno; +static int rs6000_pic_labelno; #ifdef USING_ELFOS_H /* Which abi to adhere to */ @@ -18778,7 +18778,8 @@ rs6000_emit_load_toc_table (int fromprol char buf[30]; rtx lab, tmp1, tmp2, got; - ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); + lab = gen_label_rtx (); + ASM_GENERATE_INTERNAL_LABEL (buf, "L", CODE_LABEL_NUMBER (lab)); lab = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf)); if (flag_pic == 2) got = gen_rtx_SYMBOL_REF (Pmode, toc_label_name); @@ -18791,8 +18792,7 @@ rs6000_emit_load_toc_table (int fromprol tmp2 = gen_reg_rtx (Pmode); } emit_insn (gen_load_toc_v4_PIC_1 (lab)); - emit_move_insn (tmp1, - gen_rtx_REG (Pmode, LR_REGNO)); + emit_move_insn (tmp1, gen_rtx_REG (Pmode, LR_REGNO)); emit_insn (gen_load_toc_v4_PIC_3b (tmp2, tmp1, got, lab)); emit_insn (gen_load_toc_v4_PIC_3c (dest, tmp2, got, lab)); } @@ -18819,8 +18819,7 @@ rs6000_emit_load_toc_table (int fromprol symL = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (buf)); emit_insn (gen_load_toc_v4_PIC_1 (symF)); - emit_move_insn (dest, - gen_rtx_REG (Pmode, LR_REGNO)); + emit_move_insn (dest, gen_rtx_REG (Pmode, LR_REGNO)); emit_insn (gen_load_toc_v4_PIC_2 (temp0, dest, symL, symF)); } else Index: gcc/config/rs6000/sysv4.h =================================================================== --- gcc/config/rs6000/sysv4.h (revision 166086) +++ gcc/config/rs6000/sysv4.h (working copy) @@ -402,8 +402,6 @@ do { \ Some svr4 assemblers need to also have something extra said about the function's return value. We allow for that here. */ -extern int rs6000_pic_labelno; - /* Override elfos.h definition. */ #undef ASM_DECLARE_FUNCTION_NAME #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ Index: gcc/config/rs6000/rs6000.md =================================================================== --- gcc/config/rs6000/rs6000.md (revision 166086) +++ gcc/config/rs6000/rs6000.md (working copy) @@ -12187,8 +12187,8 @@ (define_insn "load_toc_v4_PIC_2" [(set_attr "type" "load")]) (define_insn "load_toc_v4_PIC_3b" - [(set (match_operand:SI 0 "gpc_reg_operand" "=b") - (plus:SI (match_operand:SI 1 "gpc_reg_operand" "r") + [(set (match_operand:SI 0 "gpc_reg_operand" "=r") + (plus:SI (match_operand:SI 1 "gpc_reg_operand" "b") (high:SI (minus:SI (match_operand:SI 2 "symbol_ref_operand" "s") (match_operand:SI 3 "symbol_ref_operand" "s")))))]