This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: target/5399: arm/thumb: pointer indirections when using -fpic
- From: Phil Blundell <pb at nexus dot co dot uk>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 16 Jan 2002 11:16:02 -0000
- Subject: Re: target/5399: arm/thumb: pointer indirections when using -fpic
- Reply-to: Phil Blundell <pb at nexus dot co dot uk>
The following reply was made to PR target/5399; it has been noted by GNATS.
From: Phil Blundell <pb@nexus.co.uk>
To: Adrian von Bidder <avbidder@atlas.acter.ch>
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))