Commit ee692410 by Richard Sandiford Committed by Richard Sandiford

mips.h (MASK_UNUSED1): Remove.

	* 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
parent 49fa0661
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> 2003-09-02 Jason Merrill <jason@redhat.com>
* config/sol2.h (NO_IMPLICIT_EXTERN_C): Define here. * config/sol2.h (NO_IMPLICIT_EXTERN_C): Define here.
......
...@@ -1081,7 +1081,7 @@ mips_symbol_insns (enum mips_symbol_type type) ...@@ -1081,7 +1081,7 @@ mips_symbol_insns (enum mips_symbol_type type)
daddu $at,$at,$gp daddu $at,$at,$gp
and the final address is $at + %got_lo(symbol). */ and the final address is $at + %got_lo(symbol). */
return (flag_pic == 1 ? 1 : 3); return (TARGET_XGOT ? 3 : 1);
case SYMBOL_GOT_LOCAL: case SYMBOL_GOT_LOCAL:
/* For o32 and o64, the sequence is: /* For o32 and o64, the sequence is:
...@@ -1881,10 +1881,10 @@ mips_legitimize_const_move (enum machine_mode mode, rtx dest, rtx src) ...@@ -1881,10 +1881,10 @@ mips_legitimize_const_move (enum machine_mode mode, rtx dest, rtx src)
&& GET_CODE (src) == SYMBOL_REF && GET_CODE (src) == SYMBOL_REF
&& mips_classify_symbol (src) == SYMBOL_GOT_GLOBAL) && mips_classify_symbol (src) == SYMBOL_GOT_GLOBAL)
{ {
if (flag_pic == 1) if (TARGET_XGOT)
src = mips_load_got16 (src, RELOC_GOT_DISP);
else
src = mips_load_got32 (temp, src, RELOC_GOT_HI, RELOC_GOT_LO); 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)); emit_insn (gen_rtx_SET (VOIDmode, dest, src));
return; return;
} }
...@@ -3213,10 +3213,10 @@ mips_expand_call (rtx result, rtx addr, rtx args_size, rtx aux, int sibcall_p) ...@@ -3213,10 +3213,10 @@ mips_expand_call (rtx result, rtx addr, rtx args_size, rtx aux, int sibcall_p)
&& GET_CODE (addr) == SYMBOL_REF && GET_CODE (addr) == SYMBOL_REF
&& mips_classify_symbol (addr) == SYMBOL_GOT_GLOBAL) && mips_classify_symbol (addr) == SYMBOL_GOT_GLOBAL)
{ {
if (flag_pic == 1) if (TARGET_XGOT)
addr = mips_load_got16 (addr, RELOC_CALL16);
else
addr = mips_load_got32 (0, addr, RELOC_CALL_HI, RELOC_CALL_LO); 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); addr = force_reg (Pmode, addr);
} }
...@@ -4632,8 +4632,7 @@ override_options (void) ...@@ -4632,8 +4632,7 @@ override_options (void)
implemented. */ implemented. */
if (TARGET_ABICALLS) if (TARGET_ABICALLS)
{ {
if (flag_pic == 0) flag_pic = 1;
flag_pic = 1;
if (mips_section_threshold > 0) if (mips_section_threshold > 0)
warning ("-G is incompatible with PIC code which is the default"); warning ("-G is incompatible with PIC code which is the default");
} }
......
...@@ -153,7 +153,7 @@ extern const struct mips_cpu_info *mips_tune_info; ...@@ -153,7 +153,7 @@ extern const struct mips_cpu_info *mips_tune_info;
#define MASK_SOFT_FLOAT 0x00000100 /* software floating point */ #define MASK_SOFT_FLOAT 0x00000100 /* software floating point */
#define MASK_FLOAT64 0x00000200 /* fp registers are 64 bits */ #define MASK_FLOAT64 0x00000200 /* fp registers are 64 bits */
#define MASK_ABICALLS 0x00000400 /* emit .abicalls/.cprestore/.cpload */ #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_LONG_CALLS 0x00001000 /* Always call through a register */
#define MASK_64BIT 0x00002000 /* Use 64 bit GP registers and insns */ #define MASK_64BIT 0x00002000 /* Use 64 bit GP registers and insns */
#define MASK_EMBEDDED_PIC 0x00004000 /* Generate embedded PIC code */ #define MASK_EMBEDDED_PIC 0x00004000 /* Generate embedded PIC code */
...@@ -218,6 +218,7 @@ extern const struct mips_cpu_info *mips_tune_info; ...@@ -218,6 +218,7 @@ extern const struct mips_cpu_info *mips_tune_info;
/* .abicalls, etc from Pyramid V.4 */ /* .abicalls, etc from Pyramid V.4 */
#define TARGET_ABICALLS (target_flags & MASK_ABICALLS) #define TARGET_ABICALLS (target_flags & MASK_ABICALLS)
#define TARGET_XGOT (target_flags & MASK_XGOT)
/* software floating point */ /* software floating point */
#define TARGET_SOFT_FLOAT (target_flags & MASK_SOFT_FLOAT) #define TARGET_SOFT_FLOAT (target_flags & MASK_SOFT_FLOAT)
...@@ -602,6 +603,10 @@ extern const struct mips_cpu_info *mips_tune_info; ...@@ -602,6 +603,10 @@ extern const struct mips_cpu_info *mips_tune_info;
N_("Generate mips16 code") }, \ N_("Generate mips16 code") }, \
{"no-mips16", -MASK_MIPS16, \ {"no-mips16", -MASK_MIPS16, \
N_("Generate normal-mode code") }, \ 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, \ {"debug", MASK_DEBUG, \
NULL}, \ NULL}, \
{"debuga", MASK_DEBUG_A, \ {"debuga", MASK_DEBUG_A, \
...@@ -1082,7 +1087,7 @@ extern const struct mips_cpu_info *mips_tune_info; ...@@ -1082,7 +1087,7 @@ extern const struct mips_cpu_info *mips_tune_info;
%{membedded-pic} \ %{membedded-pic} \
%{mabi=32:-32}%{mabi=n32:-n32}%{mabi=64:-64}%{mabi=n64:-64} \ %{mabi=32:-32}%{mabi=n32:-n32}%{mabi=64:-64}%{mabi=n64:-64} \
%{mabi=eabi} %{mabi=o64} %{!mabi*: %(asm_abi_default_spec)} \ %{mabi=eabi} %{mabi=o64} %{!mabi*: %(asm_abi_default_spec)} \
%{mgp32} %{mgp64} %{march=*} \ %{mgp32} %{mgp64} %{march=*} %{mxgot:-xgot} \
%(target_asm_spec) \ %(target_asm_spec) \
%(subtarget_asm_spec)" %(subtarget_asm_spec)"
......
...@@ -471,7 +471,7 @@ in the following sections. ...@@ -471,7 +471,7 @@ in the following sections.
-mgas -mgp32 -mgp64 -mhard-float -mint64 -mips1 @gol -mgas -mgp32 -mgp64 -mhard-float -mint64 -mips1 @gol
-mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 @gol -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 @gol
-mlong64 -mlong32 -mlong-calls -mmemcpy @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-data -mno-uninit-const-in-rodata @gol
-mno-embedded-pic -mno-long-calls @gol -mno-embedded-pic -mno-long-calls @gol
-mno-memcpy -mno-mips-tfile -mno-rnames @gol -mno-memcpy -mno-mips-tfile -mno-rnames @gol
...@@ -8067,6 +8067,35 @@ Emit (or do not emit) the pseudo operations @samp{.abicalls}, ...@@ -8067,6 +8067,35 @@ Emit (or do not emit) the pseudo operations @samp{.abicalls},
@samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for @samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
position independent code. 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 @item -mlong-calls
@itemx -mno-long-calls @itemx -mno-long-calls
@opindex mlong-calls @opindex mlong-calls
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment