From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18690 invoked by alias); 16 Jan 2002 11:16:06 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 18658 invoked by uid 71); 16 Jan 2002 11:16:02 -0000 Date: Wed, 16 Jan 2002 03:16:00 -0000 Message-ID: <20020116111602.18656.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Phil Blundell Subject: Re: target/5399: arm/thumb: pointer indirections when using -fpic Reply-To: Phil Blundell X-SW-Source: 2002-01/txt/msg00586.txt.bz2 List-Id: The following reply was made to PR target/5399; it has been noted by GNATS. From: Phil Blundell To: Adrian von Bidder Cc: gcc-gnats@gcc.gnu.org Subject: Re: target/5399: arm/thumb: pointer indirections when using -fpic Date: 16 Jan 2002 11:11:54 +0000 On Wed, 2002-01-16 at 10:22, Adrian von Bidder wrote: > The problem is - afaics - the GOTOFF (instead of GOT). In the linked binary, > .L2 contains the offset of .LC1 from start of GOT, which is start of data, too, > and not the offset of a GOT entry for .LC1. So the first load loads .L2, the > second load already loads the string pointer .LC1 and the third load then loads > the first four bytes of the string itself... Try something like this. The problem isn't so much the GOTOFF itself (although the handling of that is fairly broken) as that the indirection through .LC1 shouldn't be happening in the first place. p. Index: arm.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.h,v retrieving revision 1.98.4.3 diff -u -r1.98.4.3 arm.h --- arm.h 2001/12/07 09:49:23 1.98.4.3 +++ arm.h 2002/01/16 11:08:13 @@ -1899,7 +1899,8 @@ #define THUMB_LEGITIMATE_CONSTANT_P(X) \ ( GET_CODE (X) == CONST_INT \ || GET_CODE (X) == CONST_DOUBLE \ - || CONSTANT_ADDRESS_P (X)) + || CONSTANT_ADDRESS_P (X) \ + || flag_pic) #define LEGITIMATE_CONSTANT_P(X) \ (TARGET_ARM ? ARM_LEGITIMATE_CONSTANT_P (X) : THUMB_LEGITIMATE_CONSTANT_P (X))