MIPS gas/ld -xgot handling is broken for at least mips*-linux
Thiemo Seufer
ica2_ts@csv.ica.uni-stuttgart.de
Wed Aug 18 16:34:00 GMT 2004
Hello All,
since the introduction of multi-got in the mips gas/ld the -xgot
option breaks in ld as soon as the GOT size grows over the
(single-GOT) 64 kB limit. ld tries to handle it as multi-GOT
instead of a large single GOT.
I see two approaches to fix this:
- Disallow the -xgot option for traditional mips. The appended patch
does so. This will leave SGI-style configurations broken. On IRIX,
this would imply using the native ld.
- Let ld handle xgot compiled code as large single GOT again. For this,
it needs either some xgot flag, or has to generally disable multi-GOT
for SGI-style configurations. The elf header provides a EF_MIPS_XGOT
flag, but this isn't set by gas yet.
I tend to do the first because I don't know if xgot ever really
worked on linux. Comments?
Thiemo
/gas/ChangeLog
2004-08-18 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
* config/tc-mips.c: Allow the -xgot option only for !TE_TMIPS.
Index: gas/config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.269
diff -u -p -r1.269 tc-mips.c
--- gas/config/tc-mips.c 20 Jul 2004 17:55:02 -0000 1.269
+++ gas/config/tc-mips.c 18 Aug 2004 15:40:57 -0000
@@ -10108,8 +10108,10 @@ struct option md_longopts[] =
{"call_shared", no_argument, NULL, OPTION_CALL_SHARED},
#define OPTION_NON_SHARED (OPTION_ELF_BASE + 1)
{"non_shared", no_argument, NULL, OPTION_NON_SHARED},
+#ifndef TE_TMIPS
#define OPTION_XGOT (OPTION_ELF_BASE + 2)
{"xgot", no_argument, NULL, OPTION_XGOT},
+#endif
#define OPTION_MABI (OPTION_ELF_BASE + 3)
{"mabi", required_argument, NULL, OPTION_MABI},
#define OPTION_32 (OPTION_ELF_BASE + 4)
@@ -10345,12 +10347,14 @@ md_parse_option (int c, char *arg)
mips_abicalls = FALSE;
break;
- /* The -xgot option tells the assembler to use 32 offsets when
+#ifndef TE_TMIPS
+ /* The -xgot option tells the assembler to use 32 bit offsets when
accessing the got in SVR4_PIC mode. It is for Irix
compatibility. */
case OPTION_XGOT:
mips_big_got = 1;
break;
+#endif /* !TE_TMIPS */
#endif /* OBJ_ELF */
case 'G':
@@ -14046,10 +14050,13 @@ MIPS options:\n\
--trap, --no-break trap exception on div by 0 and mult overflow\n\
--break, --no-trap break exception on div by 0 and mult overflow\n"));
#ifdef OBJ_ELF
+#ifndef TE_TMIPS
+ fprintf (stream, _("\
+-xgot assume a 32 bit GOT\n"));
+#endif
fprintf (stream, _("\
-KPIC, -call_shared generate SVR4 position independent code\n\
-non_shared do not generate position independent code\n\
--xgot assume a 32 bit GOT\n\
-mpdr, -mno-pdr enable/disable creation of .pdr sections\n\
-mabi=ABI create ABI conformant object file for:\n"));
More information about the Binutils
mailing list