From: Richard Sandiford Date: Wed, 3 Sep 2003 06:50:59 +0000 (+0000) Subject: mips.h (MASK_UNUSED1): Remove. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee69241016a9700eb663e5ccfadc3c11468711d7;p=platform%2Fupstream%2Fgcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4079acc..bbefe0b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2003-09-03 Richard Sandiford + + * 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 * config/sol2.h (NO_IMPLICIT_EXTERN_C): Define here. diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 37fd534..7453924 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -1081,7 +1081,7 @@ mips_symbol_insns (enum mips_symbol_type type) 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: @@ -1881,10 +1881,10 @@ mips_legitimize_const_move (enum machine_mode mode, rtx dest, rtx src) && 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; } @@ -3213,10 +3213,10 @@ mips_expand_call (rtx result, rtx addr, rtx args_size, rtx aux, int sibcall_p) && 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); } @@ -4632,8 +4632,7 @@ override_options (void) 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"); } diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 949fc74..716c277 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -153,7 +153,7 @@ extern const struct mips_cpu_info *mips_tune_info; #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 */ @@ -218,6 +218,7 @@ extern const struct mips_cpu_info *mips_tune_info; /* .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) @@ -602,6 +603,10 @@ extern const struct mips_cpu_info *mips_tune_info; 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, \ @@ -1082,7 +1087,7 @@ extern const struct mips_cpu_info *mips_tune_info; %{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)" diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index d68eb0e..fb4cf78 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -471,7 +471,7 @@ in the following sections. -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 @@ -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 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