This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Tweak TARGET_GPWORD for IRIX
- From: Richard Sandiford <rsandifo at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: echristo at redhat dot com, ro at techfak dot uni-bielefeld dot de
- Date: Tue, 10 Feb 2004 08:52:08 +0000
- Subject: Tweak TARGET_GPWORD for IRIX
The MIPS port tries to use GP-relative switch tables when generating PIC.
However, this has been disabled when using the IRIX assemblers due to
problems in the way they handle .gpword:
http://gcc.gnu.org/ml/gcc-patches/2002-12/msg00818.html
and the fact that they don't handle .gpdword at all:
http://gcc.gnu.org/ml/gcc-patches/2002-10/msg00866.html
But we do try to use them if TARGET_GAS. Unfortunately, it sees that
the native linker can't cope with the sort of relocations GAS generates
for .gpdword. This causes lots of execution failures in the -mabi=64
multilib when using gas with the native linker.
There's still the possibility of using .gpword on IRIX if TARGET_GAS,
since GAS doesn't suffer from the problem mentioned in the first message
linked above. But rather than make the special cases more convoluted,
it seems safer to disable .gpword and .gpdword for n32 and n64 on IRIX.
We can always revisit this later if we ever decide to require binutils.
Eric, does this fix look OK to you? Bootstrapped & regression tested on
mips-sgi-irix6.5, both with native tools and with the combination of gas
and the native linker.
Richard
* config/mips/mips.h (TARGET_GPWORD): Return false for TARGET_NEWABI
&& TARGET_IRIX.
Index: config/mips/mips.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.h,v
retrieving revision 1.315
diff -c -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.315 mips.h
*** config/mips/mips.h 3 Feb 2004 22:38:34 -0000 1.315
--- config/mips/mips.h 10 Feb 2004 08:36:40 -0000
*************** #define TARGET_SIBCALLS \
*** 290,298 ****
(!TARGET_MIPS16 && (!TARGET_ABICALLS || TARGET_EXPLICIT_RELOCS))
/* True if .gpword or .gpdword should be used for switch tables.
! Not all SGI assemblers support this. */
! #define TARGET_GPWORD (TARGET_ABICALLS && (!TARGET_NEWABI || TARGET_GAS))
/* Generate mips16 code */
#define TARGET_MIPS16 (target_flags & MASK_MIPS16)
--- 290,311 ----
(!TARGET_MIPS16 && (!TARGET_ABICALLS || TARGET_EXPLICIT_RELOCS))
/* True if .gpword or .gpdword should be used for switch tables.
! There are some problems with using these directives with the
! native IRIX tools:
! - It has been reported that some versions of the native n32
! assembler mishandle .gpword, complaining that symbols are
! global when they are in fact local.
!
! - The native assemblers don't understand .gpdword.
!
! - Although GAS does understand .gpdword, the native linker
! mishandles the relocations GAS generates (R_MIPS_GPREL32
! followed by R_MIPS_64).
!
! We therefore disable GP-relative switch tables for n32 and n64
! on IRIX targets. */
! #define TARGET_GPWORD (TARGET_ABICALLS && !(TARGET_NEWABI && TARGET_IRIX))
/* Generate mips16 code */
#define TARGET_MIPS16 (target_flags & MASK_MIPS16)