* config/mips/mips.h (MASK_UNUSED1): Remove.
(MASK_XGOT, TARGET_XGOT): Define.
(TARGET_SWITCHES): Add an entry for -mxgot.
(ASM_SPEC): Map -mxgot to -xgot.
* config/mips/mips.c (mips_symbol_insns): Use TARGET_XGOT to decide
whether we're using a big-GOT sequences.
(mips_legitimize_const_move, mips_expand_call): Likewise.
(override_options): Revert 2003-01-09 change.
* doc/invoke.texi: Document -mxgot.
From-SVN: r71018
+2003-09-03 Richard Sandiford <rsandifo@redhat.com>
+
+ * config/mips/mips.h (MASK_UNUSED1): Remove.
+ (MASK_XGOT, TARGET_XGOT): Define.
+ (TARGET_SWITCHES): Add an entry for -mxgot.
+ (ASM_SPEC): Map -mxgot to -xgot.
+ * config/mips/mips.c (mips_symbol_insns): Use TARGET_XGOT to decide
+ whether we're using a big-GOT sequences.
+ (mips_legitimize_const_move, mips_expand_call): Likewise.
+ (override_options): Revert 2003-01-09 change.
+ * doc/invoke.texi: Document -mxgot.
+
2003-09-02 Jason Merrill <jason@redhat.com>
* config/sol2.h (NO_IMPLICIT_EXTERN_C): Define here.
daddu $at,$at,$gp
and the final address is $at + %got_lo(symbol). */
- return (flag_pic == 1 ? 1 : 3);
+ return (TARGET_XGOT ? 3 : 1);
case SYMBOL_GOT_LOCAL:
/* For o32 and o64, the sequence is:
&& GET_CODE (src) == SYMBOL_REF
&& mips_classify_symbol (src) == SYMBOL_GOT_GLOBAL)
{
- if (flag_pic == 1)
- src = mips_load_got16 (src, RELOC_GOT_DISP);
- else
+ if (TARGET_XGOT)
src = mips_load_got32 (temp, src, RELOC_GOT_HI, RELOC_GOT_LO);
+ else
+ src = mips_load_got16 (src, RELOC_GOT_DISP);
emit_insn (gen_rtx_SET (VOIDmode, dest, src));
return;
}
&& GET_CODE (addr) == SYMBOL_REF
&& mips_classify_symbol (addr) == SYMBOL_GOT_GLOBAL)
{
- if (flag_pic == 1)
- addr = mips_load_got16 (addr, RELOC_CALL16);
- else
+ if (TARGET_XGOT)
addr = mips_load_got32 (0, addr, RELOC_CALL_HI, RELOC_CALL_LO);
+ else
+ addr = mips_load_got16 (addr, RELOC_CALL16);
}
addr = force_reg (Pmode, addr);
}
implemented. */
if (TARGET_ABICALLS)
{
- if (flag_pic == 0)
- flag_pic = 1;
+ flag_pic = 1;
if (mips_section_threshold > 0)
warning ("-G is incompatible with PIC code which is the default");
}
#define MASK_SOFT_FLOAT 0x00000100 /* software floating point */
#define MASK_FLOAT64 0x00000200 /* fp registers are 64 bits */
#define MASK_ABICALLS 0x00000400 /* emit .abicalls/.cprestore/.cpload */
-#define MASK_UNUSED1 0x00000800 /* Unused Mask. */
+#define MASK_XGOT 0x00000800 /* emit big-got PIC */
#define MASK_LONG_CALLS 0x00001000 /* Always call through a register */
#define MASK_64BIT 0x00002000 /* Use 64 bit GP registers and insns */
#define MASK_EMBEDDED_PIC 0x00004000 /* Generate embedded PIC code */
/* .abicalls, etc from Pyramid V.4 */
#define TARGET_ABICALLS (target_flags & MASK_ABICALLS)
+#define TARGET_XGOT (target_flags & MASK_XGOT)
/* software floating point */
#define TARGET_SOFT_FLOAT (target_flags & MASK_SOFT_FLOAT)
N_("Generate mips16 code") }, \
{"no-mips16", -MASK_MIPS16, \
N_("Generate normal-mode code") }, \
+ {"xgot", MASK_XGOT, \
+ N_("Lift restrictions on GOT size") }, \
+ {"no-xgot", -MASK_XGOT, \
+ N_("Do not lift restrictions on GOT size") }, \
{"debug", MASK_DEBUG, \
NULL}, \
{"debuga", MASK_DEBUG_A, \
%{membedded-pic} \
%{mabi=32:-32}%{mabi=n32:-n32}%{mabi=64:-64}%{mabi=n64:-64} \
%{mabi=eabi} %{mabi=o64} %{!mabi*: %(asm_abi_default_spec)} \
-%{mgp32} %{mgp64} %{march=*} \
+%{mgp32} %{mgp64} %{march=*} %{mxgot:-xgot} \
%(target_asm_spec) \
%(subtarget_asm_spec)"
-mgas -mgp32 -mgp64 -mhard-float -mint64 -mips1 @gol
-mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 @gol
-mlong64 -mlong32 -mlong-calls -mmemcpy @gol
--mmips-as -mmips-tfile -mno-abicalls @gol
+-mmips-as -mmips-tfile -mno-abicalls -mxgot @gol
-mno-embedded-data -mno-uninit-const-in-rodata @gol
-mno-embedded-pic -mno-long-calls @gol
-mno-memcpy -mno-mips-tfile -mno-rnames @gol
@samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
position independent code.
+@item -mxgot
+@itemx -mno-xgot
+@opindex mxgot
+@opindex mno-xgot
+Lift (or do not lift) the usual restrictions on the size of the global
+offset table.
+
+GCC normally uses a single instruction to load values from the GOT.
+While this is relatively efficient, it will only work if the GOT
+is smaller than about 64k. Anything larger will cause the linker
+to report an error such as:
+
+@cindex relocation truncated to fit (MIPS)
+@smallexample
+relocation truncated to fit: R_MIPS_GOT16 foobar
+@end smallexample
+
+If this happens, you should recompile your code with @option{-mxgot}.
+It should then work with very large GOTs, although it will also be
+less efficient, since it will take three instructions to fetch the
+value of a global symbol.
+
+Note that some linkers can create multiple GOTs. If you have such a
+linker, you should only need to use @option{-mxgot} when a single object
+file accesses more than 64k's worth of GOT entries. Very few do.
+
+These options have no effect unless GCC is generating position
+independent code.
+
@item -mlong-calls
@itemx -mno-long-calls
@opindex mlong-calls