From patchwork Sun Jan 16 21:53:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 79104 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 59881B6EED for ; Mon, 17 Jan 2011 08:53:32 +1100 (EST) Received: (qmail 21419 invoked by alias); 16 Jan 2011 21:53:31 -0000 Received: (qmail 21411 invoked by uid 22791); 16 Jan 2011 21:53:30 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 16 Jan 2011 21:53:21 +0000 Received: by wyb40 with SMTP id 40so4611801wyb.20 for ; Sun, 16 Jan 2011 13:53:18 -0800 (PST) Received: by 10.227.151.202 with SMTP id d10mr3221981wbw.0.1295214784157; Sun, 16 Jan 2011 13:53:04 -0800 (PST) Received: from localhost (rsandifo.gotadsl.co.uk [82.133.89.107]) by mx.google.com with ESMTPS id q18sm2821926wbe.17.2011.01.16.13.53.02 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 16 Jan 2011 13:53:03 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [committed] Fix MIPS16 non-local goto regressions Date: Sun, 16 Jan 2011 21:53:01 +0000 Message-ID: <87d3nwy0qq.fsf@firetop.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 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 Many non-local goto tests were failing on MIPS16 because we were using ADDIUPC instructions to load the address of the target label. Using ADDIUPC for nonlocal labels was always wrong, because we have no control over the range. However, it hits more often now, because in the affected tests, we put the parent and child in different sections. Tested on mips64-linux-gnu, where it fixes many failures. Applied. Richard gcc/ * config/mips/mips.c (mips_classify_symbol): Don't return SYMBOL_PC_RELATIVE for nonlocal labels. Index: gcc/config/mips/mips.c =================================================================== --- gcc/config/mips/mips.c 2011-01-16 21:38:17.000000000 +0000 +++ gcc/config/mips/mips.c 2011-01-16 21:38:20.000000000 +0000 @@ -1669,10 +1669,13 @@ mips_classify_symbol (const_rtx x, enum if (GET_CODE (x) == LABEL_REF) { - /* LABEL_REFs are used for jump tables as well as text labels. - Only return SYMBOL_PC_RELATIVE if we know the label is in - the text section. */ - if (TARGET_MIPS16_SHORT_JUMP_TABLES) + /* Only return SYMBOL_PC_RELATIVE if we are generating MIPS16 + code and if we know that the label is in the current function's + text section. LABEL_REFs are used for jump tables as well as + text labels, so we must check whether jump tables live in the + text section. */ + if (TARGET_MIPS16_SHORT_JUMP_TABLES + && !LABEL_REF_NONLOCAL_P (x)) return SYMBOL_PC_RELATIVE; if (TARGET_ABICALLS && !TARGET_ABSOLUTE_ABICALLS)