Commit e21d5757 by Daniel Jacobowitz Committed by Richard Sandiford

install.texi (--with-mips-plt): Document.

gcc/
2008-08-17  Daniel Jacobowitz  <dan@codesourcery.com>
	    Richard Sandiford  <rdsandiford@googlemail.com>

	* doc/install.texi (--with-mips-plt): Document.
	* doc/invoke.texi (-mplt, -mno-plt): Document.
	* config.gcc (mips*-*-*): Add mips-plt to supported_defaults
	and handle ${with_mips_plt}.
	* config/mips/mips.opt (mplt): New option.
	* config/mips/mips.h (TARGET_ABICALLS_PIC0): New macro.
	(TARGET_ABICALLS_PIC2): Likewise.
	(TARGET_GPWORD): Return false for TARGET_ABSOLUTE_ABICALLS.
	(OPTION_DEFAULT_SPECS): Add a mips-plt entry.
	(ASM_SPEC): Use !mabi=* instead of !mabi*.
	(MIPS_CALL): Use TARGET_ABICALLS_PIC2 instead of TARGET_ABICALLS
	to decide whether to output ".option picX" directives.
	* config/mips/linux.h (SUBTARGET_ASM_SPEC): Remove -mabi=64 handling.
	Pass -call_nonpic rather than -KPIC for -mplt.
	(BASE_DRIVER_SELF_SPECS): Remove -mplt if -mno-shared is not present
	on the command line.  Also remove it when -mabi=64 is used without
	-msym32.
	* config/mips/linux64.h (SUBTARGET_ASM_SPEC): Delete.
	* config/mips/mips.c (mips_use_pic_fn_addr_reg_p): Handle
	TARGET_ABICALLS_PIC0.
	(mips_classify_symbol): Use TARGET_ABICALLS_PIC2 instead of
	TARGET_ABICALLS.
	(mips16_build_function_stub): Only output ".option pic" directives
	and PIC stubs if TARGET_ABICALLS_PIC2.  Call through $25 instead of $1.
	(mips16_build_call_stub): Fix comment and remove redundant
	".set at"/"set .noat" directives.
	(mips_function_rodata_section): Use the default behaviour for
	TARGET_ABSOLUTE_ABICALLS.
	(mips_file_start): Emit ".option pic0" for TARGET_ABICALLS_PIC0.
	(mips_global_pointer): Handle TARGET_ABICALLS_PIC0.
	(mips_restore_gp): Do nothing if the current function doesn't use
	a global pointer.
	(mips_expand_prologue): Only save $gp if the current function uses it.
	Use a normal move for TARGET_ABICALLS_PIC0.
	(mips_override_options): Only set flag_pic if TARGET_ABICALLS_PIC2.

Co-Authored-By: Richard Sandiford <rdsandiford@googlemail.com>

From-SVN: r139170
parent 4817c43b
2008-08-17 Daniel Jacobowitz <dan@codesourcery.com>
Richard Sandiford <rdsandiford@googlemail.com>
* doc/install.texi (--with-mips-plt): Document.
* doc/invoke.texi (-mplt, -mno-plt): Document.
* config.gcc (mips*-*-*): Add mips-plt to supported_defaults
and handle ${with_mips_plt}.
* config/mips/mips.opt (mplt): New option.
* config/mips/mips.h (TARGET_ABICALLS_PIC0): New macro.
(TARGET_ABICALLS_PIC2): Likewise.
(TARGET_GPWORD): Return false for TARGET_ABSOLUTE_ABICALLS.
(OPTION_DEFAULT_SPECS): Add a mips-plt entry.
(ASM_SPEC): Use !mabi=* instead of !mabi*.
(MIPS_CALL): Use TARGET_ABICALLS_PIC2 instead of TARGET_ABICALLS
to decide whether to output ".option picX" directives.
* config/mips/linux.h (SUBTARGET_ASM_SPEC): Remove -mabi=64 handling.
Pass -call_nonpic rather than -KPIC for -mplt.
(BASE_DRIVER_SELF_SPECS): Remove -mplt if -mno-shared is not present
on the command line. Also remove it when -mabi=64 is used without
-msym32.
* config/mips/linux64.h (SUBTARGET_ASM_SPEC): Delete.
* config/mips/mips.c (mips_use_pic_fn_addr_reg_p): Handle
TARGET_ABICALLS_PIC0.
(mips_classify_symbol): Use TARGET_ABICALLS_PIC2 instead of
TARGET_ABICALLS.
(mips16_build_function_stub): Only output ".option pic" directives
and PIC stubs if TARGET_ABICALLS_PIC2. Call through $25 instead of $1.
(mips16_build_call_stub): Fix comment and remove redundant
".set at"/"set .noat" directives.
(mips_function_rodata_section): Use the default behaviour for
TARGET_ABSOLUTE_ABICALLS.
(mips_file_start): Emit ".option pic0" for TARGET_ABICALLS_PIC0.
(mips_global_pointer): Handle TARGET_ABICALLS_PIC0.
(mips_restore_gp): Do nothing if the current function doesn't use
a global pointer.
(mips_expand_prologue): Only save $gp if the current function uses it.
Use a normal move for TARGET_ABICALLS_PIC0.
(mips_override_options): Only set flag_pic if TARGET_ABICALLS_PIC2.
2008-08-17 Richard Sandiford <rdsandiford@googlemail.com> 2008-08-17 Richard Sandiford <rdsandiford@googlemail.com>
* config/mips/mips.c (mips_save_reg_p): Don't short-circuit rest * config/mips/mips.c (mips_save_reg_p): Don't short-circuit rest
......
...@@ -2779,7 +2779,7 @@ case "${target}" in ...@@ -2779,7 +2779,7 @@ case "${target}" in
;; ;;
mips*-*-*) mips*-*-*)
supported_defaults="abi arch float tune divide llsc" supported_defaults="abi arch float tune divide llsc mips-plt"
case ${with_float} in case ${with_float} in
"" | soft | hard) "" | soft | hard)
...@@ -2826,6 +2826,21 @@ case "${target}" in ...@@ -2826,6 +2826,21 @@ case "${target}" in
exit 1 exit 1
;; ;;
esac esac
case ${with_mips_plt} in
yes)
with_mips_plt=plt
;;
no)
with_mips_plt=no-plt
;;
"")
;;
*)
echo "Unknown --with-mips-plt argument: $with_mips_plt" 1>&2
exit 1
;;
esac
;; ;;
powerpc*-*-* | rs6000-*-*) powerpc*-*-* | rs6000-*-*)
...@@ -3078,10 +3093,10 @@ case ${target} in ...@@ -3078,10 +3093,10 @@ case ${target} in
esac esac
t= t=
all_defaults="abi cpu cpu_32 cpu_64 arch arch_32 arch_64 tune tune_32 tune_64 schedule float mode fpu divide llsc" all_defaults="abi cpu cpu_32 cpu_64 arch arch_32 arch_64 tune tune_32 tune_64 schedule float mode fpu divide llsc mips-plt"
for option in $all_defaults for option in $all_defaults
do do
eval "val=\$with_$option" eval "val=\$with_"`echo $option | sed s/-/_/g`
if test -n "$val"; then if test -n "$val"; then
case " $supported_defaults " in case " $supported_defaults " in
*" $option "*) *" $option "*)
......
...@@ -79,7 +79,8 @@ along with GCC; see the file COPYING3. If not see ...@@ -79,7 +79,8 @@ along with GCC; see the file COPYING3. If not see
%{static:-static}}}" %{static:-static}}}"
#undef SUBTARGET_ASM_SPEC #undef SUBTARGET_ASM_SPEC
#define SUBTARGET_ASM_SPEC "%{mabi=64: -64} %{!mno-abicalls:-KPIC}" #define SUBTARGET_ASM_SPEC \
"%{!mno-abicalls:%{mplt:-call_nonpic;:-KPIC}}"
/* The MIPS assembler has different syntax for .set. We set it to /* The MIPS assembler has different syntax for .set. We set it to
.dummy to trap any errors. */ .dummy to trap any errors. */
...@@ -135,5 +136,10 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); ...@@ -135,5 +136,10 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
#define BASE_DRIVER_SELF_SPECS \ #define BASE_DRIVER_SELF_SPECS \
NO_SHARED_SPECS \ NO_SHARED_SPECS \
MARCH_MTUNE_NATIVE_SPECS MARCH_MTUNE_NATIVE_SPECS, \
/* -mplt has no effect without -mno-shared. Simplify later \
specs handling by removing a redundant option. */ \
"%{!mno-shared:%<mplt}", \
/* -mplt likewise has no effect for -mabi=64 without -msym32. */ \
"%{mabi=64:%{!msym32:%<mplt}}"
#define DRIVER_SELF_SPECS BASE_DRIVER_SELF_SPECS #define DRIVER_SELF_SPECS BASE_DRIVER_SELF_SPECS
...@@ -26,11 +26,6 @@ BASE_DRIVER_SELF_SPECS \ ...@@ -26,11 +26,6 @@ BASE_DRIVER_SELF_SPECS \
" %{!EB:%{!EL:%(endian_spec)}}" \ " %{!EB:%{!EL:%(endian_spec)}}" \
" %{!mabi=*: -mabi=n32}" " %{!mabi=*: -mabi=n32}"
#undef SUBTARGET_ASM_SPEC
#define SUBTARGET_ASM_SPEC "\
%{!fno-PIC:%{!fno-pic:-KPIC}} \
%{fno-PIC:-non_shared} %{fno-pic:-non_shared}"
#undef LIB_SPEC #undef LIB_SPEC
#define LIB_SPEC "\ #define LIB_SPEC "\
%{pthread:-lpthread} \ %{pthread:-lpthread} \
......
...@@ -1454,13 +1454,20 @@ mips_use_pic_fn_addr_reg_p (const_rtx x) ...@@ -1454,13 +1454,20 @@ mips_use_pic_fn_addr_reg_p (const_rtx x)
if (mips16_stub_function_p (x)) if (mips16_stub_function_p (x))
return false; return false;
/* When TARGET_ABSOLUTE_ABICALLS is true, locally-defined functions if (GET_CODE (x) == SYMBOL_REF)
use absolute accesses to set up the global pointer. */ {
/* If PLTs and copy relocations are available, the static linker
will make sure that $25 is valid on entry to the target function. */
if (TARGET_ABICALLS_PIC0)
return false;
/* Locally-defined functions use absolute accesses to set up
the global pointer. */
if (TARGET_ABSOLUTE_ABICALLS if (TARGET_ABSOLUTE_ABICALLS
&& GET_CODE (x) == SYMBOL_REF
&& mips_symbol_binds_local_p (x) && mips_symbol_binds_local_p (x)
&& !SYMBOL_REF_EXTERNAL_P (x)) && !SYMBOL_REF_EXTERNAL_P (x))
return false; return false;
}
return true; return true;
} }
...@@ -1512,7 +1519,7 @@ mips_classify_symbol (const_rtx x, enum mips_symbol_context context) ...@@ -1512,7 +1519,7 @@ mips_classify_symbol (const_rtx x, enum mips_symbol_context context)
/* Don't use GOT accesses for locally-binding symbols when -mno-shared /* Don't use GOT accesses for locally-binding symbols when -mno-shared
is in effect. */ is in effect. */
if (TARGET_ABICALLS if (TARGET_ABICALLS_PIC2
&& !(TARGET_ABSOLUTE_ABICALLS && mips_symbol_binds_local_p (x))) && !(TARGET_ABSOLUTE_ABICALLS && mips_symbol_binds_local_p (x)))
{ {
/* There are three cases to consider: /* There are three cases to consider:
...@@ -5657,11 +5664,13 @@ mips16_build_function_stub (void) ...@@ -5657,11 +5664,13 @@ mips16_build_function_stub (void)
assemble_start_function (stubdecl, stubname); assemble_start_function (stubdecl, stubname);
mips_start_function_definition (stubname, false); mips_start_function_definition (stubname, false);
/* If generating abicalls code, either set up the global pointer or /* If generating pic2 code, either set up the global pointer or
switch to absolute mode. */ switch to pic0. */
if (TARGET_ABICALLS_PIC2)
{
if (TARGET_ABSOLUTE_ABICALLS) if (TARGET_ABSOLUTE_ABICALLS)
fprintf (asm_out_file, "\t.option\tpic0\n"); fprintf (asm_out_file, "\t.option\tpic0\n");
else if (TARGET_ABICALLS) else
{ {
output_asm_insn ("%(.cpload\t%^%)", NULL); output_asm_insn ("%(.cpload\t%^%)", NULL);
/* Emit an R_MIPS_NONE relocation to tell the linker what the /* Emit an R_MIPS_NONE relocation to tell the linker what the
...@@ -5671,21 +5680,20 @@ mips16_build_function_stub (void) ...@@ -5671,21 +5680,20 @@ mips16_build_function_stub (void)
output_asm_insn (".reloc\t0,R_MIPS_NONE,%0", &symbol); output_asm_insn (".reloc\t0,R_MIPS_NONE,%0", &symbol);
symbol = alias; symbol = alias;
} }
}
/* Load the address of the MIPS16 function into $at. Do this first so /* Load the address of the MIPS16 function into $25. Do this first so
that targets with coprocessor interlocks can use an MFC1 to fill the that targets with coprocessor interlocks can use an MFC1 to fill the
delay slot. */ delay slot. */
fprintf (asm_out_file, "\t.set\tnoat\n"); output_asm_insn ("la\t%^,%0", &symbol);
output_asm_insn ("la\t%@,%0", &symbol);
/* Move the arguments from floating-point registers to general registers. */ /* Move the arguments from floating-point registers to general registers. */
mips_output_args_xfer (crtl->args.info.fp_code, 'f'); mips_output_args_xfer (crtl->args.info.fp_code, 'f');
/* Jump to the MIPS16 function. */ /* Jump to the MIPS16 function. */
output_asm_insn ("jr\t%@", NULL); output_asm_insn ("jr\t%^", NULL);
fprintf (asm_out_file, "\t.set\tat\n");
if (TARGET_ABSOLUTE_ABICALLS) if (TARGET_ABICALLS_PIC2 && TARGET_ABSOLUTE_ABICALLS)
fprintf (asm_out_file, "\t.option\tpic2\n"); fprintf (asm_out_file, "\t.option\tpic2\n");
mips_end_function_definition (stubname); mips_end_function_definition (stubname);
...@@ -5906,10 +5914,9 @@ mips16_build_call_stub (rtx retval, rtx *fn_ptr, rtx args_size, int fp_code) ...@@ -5906,10 +5914,9 @@ mips16_build_call_stub (rtx retval, rtx *fn_ptr, rtx args_size, int fp_code)
if (!fp_ret_p) if (!fp_ret_p)
{ {
/* Load the address of the MIPS16 function into $at. Do this /* Load the address of the MIPS16 function into $25. Do this
first so that targets with coprocessor interlocks can use first so that targets with coprocessor interlocks can use
an MFC1 to fill the delay slot. */ an MFC1 to fill the delay slot. */
fprintf (asm_out_file, "\t.set\tnoat\n");
if (TARGET_EXPLICIT_RELOCS) if (TARGET_EXPLICIT_RELOCS)
{ {
output_asm_insn ("lui\t%^,%%hi(%0)", &fn); output_asm_insn ("lui\t%^,%%hi(%0)", &fn);
...@@ -5927,7 +5934,6 @@ mips16_build_call_stub (rtx retval, rtx *fn_ptr, rtx args_size, int fp_code) ...@@ -5927,7 +5934,6 @@ mips16_build_call_stub (rtx retval, rtx *fn_ptr, rtx args_size, int fp_code)
{ {
/* Jump to the previously-loaded address. */ /* Jump to the previously-loaded address. */
output_asm_insn ("jr\t%^", NULL); output_asm_insn ("jr\t%^", NULL);
fprintf (asm_out_file, "\t.set\tat\n");
} }
else else
{ {
...@@ -7222,15 +7228,16 @@ mips_select_rtx_section (enum machine_mode mode, rtx x, ...@@ -7222,15 +7228,16 @@ mips_select_rtx_section (enum machine_mode mode, rtx x,
/* Implement TARGET_ASM_FUNCTION_RODATA_SECTION. /* Implement TARGET_ASM_FUNCTION_RODATA_SECTION.
The complication here is that, with the combination TARGET_ABICALLS The complication here is that, with the combination TARGET_ABICALLS
&& !TARGET_GPWORD, jump tables will use absolute addresses, and should && !TARGET_ABSOLUTE_ABICALLS && !TARGET_GPWORD, jump tables will use
therefore not be included in the read-only part of a DSO. Handle such absolute addresses, and should therefore not be included in the
cases by selecting a normal data section instead of a read-only one. read-only part of a DSO. Handle such cases by selecting a normal
The logic apes that in default_function_rodata_section. */ data section instead of a read-only one. The logic apes that in
default_function_rodata_section. */
static section * static section *
mips_function_rodata_section (tree decl) mips_function_rodata_section (tree decl)
{ {
if (!TARGET_ABICALLS || TARGET_GPWORD) if (!TARGET_ABICALLS || TARGET_ABSOLUTE_ABICALLS || TARGET_GPWORD)
return default_function_rodata_section (decl); return default_function_rodata_section (decl);
if (decl && DECL_SECTION_NAME (decl)) if (decl && DECL_SECTION_NAME (decl))
...@@ -7729,7 +7736,11 @@ mips_file_start (void) ...@@ -7729,7 +7736,11 @@ mips_file_start (void)
/* If TARGET_ABICALLS, tell GAS to generate -KPIC code. */ /* If TARGET_ABICALLS, tell GAS to generate -KPIC code. */
if (TARGET_ABICALLS) if (TARGET_ABICALLS)
{
fprintf (asm_out_file, "\t.abicalls\n"); fprintf (asm_out_file, "\t.abicalls\n");
if (TARGET_ABICALLS_PIC0)
fprintf (asm_out_file, "\t.option\tpic0\n");
}
if (flag_verbose_asm) if (flag_verbose_asm)
fprintf (asm_out_file, "\n%s -G value = %d, Arch = %s, ISA = %d\n", fprintf (asm_out_file, "\n%s -G value = %d, Arch = %s, ISA = %d\n",
...@@ -8285,24 +8296,40 @@ mips_global_pointer (void) ...@@ -8285,24 +8296,40 @@ mips_global_pointer (void)
if (crtl->has_nonlocal_goto) if (crtl->has_nonlocal_goto)
return GLOBAL_POINTER_REGNUM; return GLOBAL_POINTER_REGNUM;
/* If the gp is never referenced, there's no need to initialize it. /* There's no need to initialize $gp if it isn't referenced now,
Note that reload can sometimes introduce constant pool references and if we can be sure that no new references will be added during
or after reload. */
if (!df_regs_ever_live_p (GLOBAL_POINTER_REGNUM)
&& !mips_function_has_gp_insn ())
{
/* The function doesn't use $gp at the moment. If we're generating
-call_nonpic code, no new uses will be introduced during or after
reload. */
if (TARGET_ABICALLS_PIC0)
return 0;
/* We need to handle the following implicit gp references:
- Reload can sometimes introduce constant pool references
into a function that otherwise didn't need them. For example, into a function that otherwise didn't need them. For example,
suppose we have an instruction like: suppose we have an instruction like:
(set (reg:DF R1) (float:DF (reg:SI R2))) (set (reg:DF R1) (float:DF (reg:SI R2)))
If R2 turns out to be constant such as 1, the instruction may have a If R2 turns out to be constant such as 1, the instruction may
REG_EQUAL note saying that R1 == 1.0. Reload then has the option of have a REG_EQUAL note saying that R1 == 1.0. Reload then has
using this constant if R2 doesn't get allocated to a register. the option of using this constant if R2 doesn't get allocated
to a register.
In cases like these, reload will have added the constant to the pool In cases like these, reload will have added the constant to the
but no instruction will yet refer to it. */ pool but no instruction will yet refer to it.
if (!df_regs_ever_live_p (GLOBAL_POINTER_REGNUM)
&& !crtl->uses_const_pool - MIPS16 functions that return in FPRs need to call an
&& !mips16_cfun_returns_in_fpr_p () external libgcc routine. */
&& !mips_function_has_gp_insn ()) if (!crtl->uses_const_pool
&& !mips16_cfun_returns_in_fpr_p ())
return 0; return 0;
}
/* We need a global pointer, but perhaps we can use a call-clobbered /* We need a global pointer, but perhaps we can use a call-clobbered
register instead of $gp. */ register instead of $gp. */
...@@ -8694,6 +8721,9 @@ mips_restore_gp (rtx temp) ...@@ -8694,6 +8721,9 @@ mips_restore_gp (rtx temp)
{ {
gcc_assert (TARGET_ABICALLS && TARGET_OLDABI); gcc_assert (TARGET_ABICALLS && TARGET_OLDABI);
if (cfun->machine->global_pointer == 0)
return;
if (TARGET_MIPS16) if (TARGET_MIPS16)
{ {
mips_emit_move (temp, mips_cprestore_slot (temp)); mips_emit_move (temp, mips_cprestore_slot (temp));
...@@ -9121,13 +9151,17 @@ mips_expand_prologue (void) ...@@ -9121,13 +9151,17 @@ mips_expand_prologue (void)
mips_emit_loadgp (); mips_emit_loadgp ();
/* Initialize the $gp save slot. */ /* Initialize the $gp save slot. */
if (frame->cprestore_size > 0) if (frame->cprestore_size > 0
&& cfun->machine->global_pointer != 0)
{ {
if (TARGET_MIPS16) if (TARGET_MIPS16)
mips_emit_move (mips_cprestore_slot (MIPS_PROLOGUE_TEMP (Pmode)), mips_emit_move (mips_cprestore_slot (MIPS_PROLOGUE_TEMP (Pmode)),
MIPS16_PIC_TEMP); MIPS16_PIC_TEMP);
else else if (TARGET_ABICALLS_PIC2)
emit_insn (gen_cprestore (GEN_INT (frame->args_size))); emit_insn (gen_cprestore (GEN_INT (frame->args_size)));
else
emit_move_insn (mips_cprestore_slot (MIPS_PROLOGUE_TEMP (Pmode)),
pic_offset_table_rtx);
} }
/* If we are profiling, make sure no instructions are scheduled before /* If we are profiling, make sure no instructions are scheduled before
...@@ -13196,14 +13230,16 @@ mips_override_options (void) ...@@ -13196,14 +13230,16 @@ mips_override_options (void)
target_flags &= ~MASK_ABICALLS; target_flags &= ~MASK_ABICALLS;
} }
if (TARGET_ABICALLS) if (TARGET_ABICALLS_PIC2)
/* We need to set flag_pic for executables as well as DSOs /* We need to set flag_pic for executables as well as DSOs
because we may reference symbols that are not defined in because we may reference symbols that are not defined in
the final executable. (MIPS does not use things like the final executable. (MIPS does not use things like
copy relocs, for example.) copy relocs, for example.)
Also, there is a body of code that uses __PIC__ to distinguish There is a body of code that uses __PIC__ to distinguish
between -mabicalls and -mno-abicalls code. */ between -mabicalls and -mno-abicalls code. The non-__PIC__
variant is usually appropriate for TARGET_ABICALLS_PIC0, as
long as any indirect jumps use $25. */
flag_pic = 1; flag_pic = 1;
/* -mvr4130-align is a "speed over size" optimization: it usually produces /* -mvr4130-align is a "speed over size" optimization: it usually produces
......
...@@ -148,6 +148,15 @@ enum mips_code_readable_setting { ...@@ -148,6 +148,15 @@ enum mips_code_readable_setting {
/* True if we are generating position-independent VxWorks RTP code. */ /* True if we are generating position-independent VxWorks RTP code. */
#define TARGET_RTP_PIC (TARGET_VXWORKS_RTP && flag_pic) #define TARGET_RTP_PIC (TARGET_VXWORKS_RTP && flag_pic)
/* True if the output file is marked as ".abicalls; .option pic0"
(-call_nonpic). */
#define TARGET_ABICALLS_PIC0 \
(TARGET_ABSOLUTE_ABICALLS && TARGET_PLT)
/* True if the output file is marked as ".abicalls; .option pic2" (-KPIC). */
#define TARGET_ABICALLS_PIC2 \
(TARGET_ABICALLS && !TARGET_ABICALLS_PIC0)
/* True if the call patterns should be split into a jalr followed by /* True if the call patterns should be split into a jalr followed by
an instruction to restore $gp. It is only safe to split the load an instruction to restore $gp. It is only safe to split the load
from the call when every use of $gp is explicit. */ from the call when every use of $gp is explicit. */
...@@ -200,7 +209,10 @@ enum mips_code_readable_setting { ...@@ -200,7 +209,10 @@ enum mips_code_readable_setting {
Although GAS does understand .gpdword, the SGI linker mishandles Although GAS does understand .gpdword, the SGI linker mishandles
the relocations GAS generates (R_MIPS_GPREL32 followed by R_MIPS_64). the relocations GAS generates (R_MIPS_GPREL32 followed by R_MIPS_64).
We therefore disable GP-relative switch tables for n64 on IRIX targets. */ We therefore disable GP-relative switch tables for n64 on IRIX targets. */
#define TARGET_GPWORD (TARGET_ABICALLS && !(mips_abi == ABI_64 && TARGET_IRIX)) #define TARGET_GPWORD \
(TARGET_ABICALLS \
&& !TARGET_ABSOLUTE_ABICALLS \
&& !(mips_abi == ABI_64 && TARGET_IRIX))
/* Generate mips16 code */ /* Generate mips16 code */
#define TARGET_MIPS16 ((target_flags & MASK_MIPS16) != 0) #define TARGET_MIPS16 ((target_flags & MASK_MIPS16) != 0)
...@@ -715,7 +727,8 @@ enum mips_code_readable_setting { ...@@ -715,7 +727,8 @@ enum mips_code_readable_setting {
{"abi", "%{!mabi=*:-mabi=%(VALUE)}" }, \ {"abi", "%{!mabi=*:-mabi=%(VALUE)}" }, \
{"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }, \ {"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }, \
{"divide", "%{!mdivide-traps:%{!mdivide-breaks:-mdivide-%(VALUE)}}" }, \ {"divide", "%{!mdivide-traps:%{!mdivide-breaks:-mdivide-%(VALUE)}}" }, \
{"llsc", "%{!mllsc:%{!mno-llsc:-m%(VALUE)}}" } {"llsc", "%{!mllsc:%{!mno-llsc:-m%(VALUE)}}" }, \
{"mips-plt", "%{!mplt:%{!mno-plt:-m%(VALUE)}}" }
#define GENERATE_DIVIDE_TRAPS (TARGET_DIVIDE_TRAPS \ #define GENERATE_DIVIDE_TRAPS (TARGET_DIVIDE_TRAPS \
...@@ -1074,7 +1087,7 @@ enum mips_code_readable_setting { ...@@ -1074,7 +1087,7 @@ enum mips_code_readable_setting {
%{mfix-vr4120} %{mfix-vr4130} \ %{mfix-vr4120} %{mfix-vr4130} \
%(subtarget_asm_optimizing_spec) \ %(subtarget_asm_optimizing_spec) \
%(subtarget_asm_debugging_spec) \ %(subtarget_asm_debugging_spec) \
%{mabi=*} %{!mabi*: %(asm_abi_default_spec)} \ %{mabi=*} %{!mabi=*: %(asm_abi_default_spec)} \
%{mgp32} %{mgp64} %{march=*} %{mxgot:-xgot} \ %{mgp32} %{mgp64} %{march=*} %{mxgot:-xgot} \
%{mfp32} %{mfp64} \ %{mfp32} %{mfp64} \
%{mshared} %{mno-shared} \ %{mshared} %{mno-shared} \
...@@ -2559,7 +2572,7 @@ typedef struct mips_args { ...@@ -2559,7 +2572,7 @@ typedef struct mips_args {
? "%*" INSN "\t%" #OPNO "%/" \ ? "%*" INSN "\t%" #OPNO "%/" \
: REG_P (OPERANDS[OPNO]) \ : REG_P (OPERANDS[OPNO]) \
? "%*" INSN "r\t%" #OPNO "%/" \ ? "%*" INSN "r\t%" #OPNO "%/" \
: TARGET_ABICALLS \ : TARGET_ABICALLS_PIC2 \
? (".option\tpic0\n\t" \ ? (".option\tpic0\n\t" \
"%*" INSN "\t%" #OPNO "%/\n\t" \ "%*" INSN "\t%" #OPNO "%/\n\t" \
".option\tpic2") \ ".option\tpic2") \
......
...@@ -160,6 +160,10 @@ mgpopt ...@@ -160,6 +160,10 @@ mgpopt
Target Report Var(TARGET_GPOPT) Init(1) Target Report Var(TARGET_GPOPT) Init(1)
Use GP-relative addressing to access small data Use GP-relative addressing to access small data
mplt
Target Report Var(TARGET_PLT)
When generating -mabicalls code, allow executables to use PLTs and copy relocations
mhard-float mhard-float
Target Report RejectNegative InverseMask(SOFT_FLOAT_ABI, HARD_FLOAT_ABI) Target Report RejectNegative InverseMask(SOFT_FLOAT_ABI, HARD_FLOAT_ABI)
Allow the use of hardware floating-point ABI and instructions Allow the use of hardware floating-point ABI and instructions
......
...@@ -1076,6 +1076,12 @@ not provide them. ...@@ -1076,6 +1076,12 @@ not provide them.
On MIPS targets, make @option{-mno-llsc} the default when no On MIPS targets, make @option{-mno-llsc} the default when no
@option{-mllsc} option is passed. @option{-mllsc} option is passed.
@item --with-mips-plt
On MIPS targets, make use of copy relocations and PLTs.
These features are extensions to the traditional
SVR4-based MIPS ABIs and require support from GNU binutils
and the runtime C library.
@item --enable-__cxa_atexit @item --enable-__cxa_atexit
Define if you want to use __cxa_atexit, rather than atexit, to Define if you want to use __cxa_atexit, rather than atexit, to
register C++ destructors for local statics and global objects. register C++ destructors for local statics and global objects.
......
...@@ -634,8 +634,8 @@ Objective-C and Objective-C++ Dialects}. ...@@ -634,8 +634,8 @@ Objective-C and Objective-C++ Dialects}.
-mips16 -mno-mips16 -mflip-mips16 @gol -mips16 -mno-mips16 -mflip-mips16 @gol
-minterlink-mips16 -mno-interlink-mips16 @gol -minterlink-mips16 -mno-interlink-mips16 @gol
-mabi=@var{abi} -mabicalls -mno-abicalls @gol -mabi=@var{abi} -mabicalls -mno-abicalls @gol
-mshared -mno-shared -mxgot -mno-xgot -mgp32 -mgp64 @gol -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
-mfp32 -mfp64 -mhard-float -msoft-float @gol -mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float @gol
-msingle-float -mdouble-float -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol -msingle-float -mdouble-float -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
-msmartmips -mno-smartmips @gol -msmartmips -mno-smartmips @gol
-mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
...@@ -12162,6 +12162,19 @@ executables both smaller and quicker. ...@@ -12162,6 +12162,19 @@ executables both smaller and quicker.
@option{-mshared} is the default. @option{-mshared} is the default.
@item -mplt
@itemx -mno-plt
@opindex mplt
@opindex mno-plt
Assume (do not assume) that the static and dynamic linkers
support PLTs and copy relocations. This option only affects
@samp{-mno-shared -mabicalls}. For the n64 ABI, this option
has no effect without @samp{-msym32}.
You can make @option{-mplt} the default by configuring
GCC with @option{--with-mips-plt}. The default is
@option{-mno-plt} otherwise.
@item -mxgot @item -mxgot
@itemx -mno-xgot @itemx -mno-xgot
@opindex mxgot @opindex mxgot
......
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