From patchwork Mon Jun 14 20:02:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 55578 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 18FC1B7D5C for ; Tue, 15 Jun 2010 06:03:05 +1000 (EST) Received: (qmail 12570 invoked by alias); 14 Jun 2010 20:03:02 -0000 Received: (qmail 12410 invoked by uid 22791); 14 Jun 2010 20:03:01 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-out.m-online.net (HELO mail-out.m-online.net) (212.18.0.9) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Jun 2010 20:02:51 +0000 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 5B11D1C15ADE for ; Mon, 14 Jun 2010 22:02:49 +0200 (CEST) Received: from igel.home (ppp-88-217-112-183.dynamic.mnet-online.de [88.217.112.183]) by mail.mnet-online.de (Postfix) with ESMTP id 3E80E1C00441 for ; Mon, 14 Jun 2010 22:02:49 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id DFEF5CA297; Mon, 14 Jun 2010 22:02:48 +0200 (CEST) From: Andreas Schwab To: gcc-patches@gcc.gnu.org Subject: [M68K] Don't clobber PIC reference to constant pool X-Yow: Awright, which one of you hid my PENIS ENVY? Date: Mon, 14 Jun 2010 22:02:48 +0200 Message-ID: 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 m68k_delegitimize_address should not do anything if the argument isn't a MEM, otherwise PIC references to the constant pool will be miscompiled. Tested on m68k-linux, committed to trunk and 4.5 branch. Andreas. 2010-06-14 Andreas Schwab * config/m68k/m68k.c (m68k_delegitimize_address): Don't do anything if the argument is not a MEM. Index: gcc/config/m68k/m68k.c =================================================================== --- gcc/config/m68k/m68k.c (revision 160760) +++ gcc/config/m68k/m68k.c (working copy) @@ -4625,16 +4625,17 @@ m68k_output_dwarf_dtprel (FILE *file, in and turn them back into a direct symbol reference. */ static rtx -m68k_delegitimize_address (rtx x) +m68k_delegitimize_address (rtx orig_x) { - rtx orig_x = delegitimize_mem_from_attrs (x); - rtx y; + rtx x, y; rtx addend = NULL_RTX; rtx result; - x = orig_x; - if (MEM_P (x)) - x = XEXP (x, 0); + orig_x = delegitimize_mem_from_attrs (orig_x); + if (! MEM_P (orig_x)) + return orig_x; + + x = XEXP (orig_x, 0); if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 1)) == CONST