mips option parsing behaviour changed accidentally?
Thiemo Seufer
ica2_ts@csv.ica.uni-stuttgart.de
Fri Oct 19 14:48:00 GMT 2001
cgd@broadcom.com wrote:
[snip]
> If it _is_ going to become an ELF-only option, though, I believe that
> it should be folded in with the rest of the options under
> OPTION_ELF_BASE... (yay, lots of renumbering! 8-)
>
> Also, the tests that use -mabi should be explicitly excluded for ECOFF
> if they're not already.
I updated the patch accordingly.
Thiemo
2001-10-20 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
/gas/ChangeLog
* config/tc-mips.c (load_register): Cast signedness mismatches.
(support_64bit_objects): Define for OBJ_ELF only.
(md_longopts): Allow OPTION_MABI for ELF compilation only. RE-allow
OPTION_GP32, OPTION_GP64, OPTION_FP32 for non-ELF compilation.
Sort options a bit more logical.
(md_parse_option): Allow OPTION_32, OPTION_N32, OPTION_N64,
OPTION_MABI only for elf targets.
(md_show_usage): Show -mabi=ABI usage.
/gas/testsuite/ChangeLog
* gas/mips/mips.exp: Change naming of some conditionals to reflect
the object format they actually mean. Don't try mips-abi32 and
mips-abi32-pic tests for ecoff.
diff -BurpNX /bigdisk/src/binutils-exclude src-orig/gas/config/tc-mips.c src/gas/config/tc-mips.c
--- src-orig/gas/config/tc-mips.c Sat Oct 13 19:41:13 2001
+++ src/gas/config/tc-mips.c Fri Oct 19 23:14:20 2001
@@ -685,7 +685,9 @@ static void mips16_immed PARAMS ((char *
static int my_getSmallParser PARAMS ((char **, unsigned int *, int *));
static int my_getSmallExpression PARAMS ((expressionS *, char *));
static void my_getExpression PARAMS ((expressionS *, char *));
+#ifdef OBJ_ELF
static int support_64bit_objects PARAMS((void));
+#endif
static symbolS *get_symbol PARAMS ((void));
static void mips_align PARAMS ((int to, int fill, symbolS *label));
static void s_align PARAMS ((int));
@@ -3348,7 +3350,7 @@ load_register (counter, reg, ep, dbl)
int shift, bit;
unsigned long hi, lo;
- if (hi32.X_add_number == 0xffffffff)
+ if (hi32.X_add_number == (offsetT) 0xffffffff)
{
if ((lo32.X_add_number & 0xffff8000) == 0xffff8000)
{
@@ -3487,7 +3489,7 @@ load_register (counter, reg, ep, dbl)
{
expressionS mid16;
- if ((freg == 0) && (lo32.X_add_number == 0xffffffff))
+ if ((freg == 0) && (lo32.X_add_number == (offsetT) 0xffffffff))
{
macro_build ((char *) NULL, counter, &lo32, "lui", "t,u", reg,
(int) BFD_RELOC_HI16);
@@ -4043,7 +4045,7 @@ macro (ip)
if (sreg == 0
|| (HAVE_32BIT_GPRS
&& imm_expr.X_op == O_constant
- && imm_expr.X_add_number == 0xffffffff))
+ && imm_expr.X_add_number == (offsetT) 0xffffffff))
goto do_false;
if (imm_expr.X_op != O_constant)
as_bad (_("Unsupported large constant"));
@@ -4186,7 +4188,7 @@ macro (ip)
if (sreg == 0
|| (HAVE_32BIT_GPRS
&& imm_expr.X_op == O_constant
- && imm_expr.X_add_number == 0xffffffff))
+ && imm_expr.X_add_number == (offsetT) 0xffffffff))
goto do_true;
if (imm_expr.X_op != O_constant)
as_bad (_("Unsupported large constant"));
@@ -9378,6 +9380,7 @@ md_number_to_chars (buf, val, n)
number_to_chars_littleendian (buf, val, n);
}
+#ifdef OBJ_ELF
static int support_64bit_objects(void)
{
const char **list, **l;
@@ -9396,6 +9399,7 @@ static int support_64bit_objects(void)
free (list);
return (*l != NULL);
}
+#endif /* OBJ_ELF */
CONST char *md_shortopts = "nO::g::G:";
@@ -9410,83 +9414,82 @@ struct option md_longopts[] =
{"mips3", no_argument, NULL, OPTION_MIPS3},
#define OPTION_MIPS4 (OPTION_MD_BASE + 4)
{"mips4", no_argument, NULL, OPTION_MIPS4},
-#define OPTION_MCPU (OPTION_MD_BASE + 5)
- {"mcpu", required_argument, NULL, OPTION_MCPU},
-#define OPTION_MEMBEDDED_PIC (OPTION_MD_BASE + 6)
+#define OPTION_MIPS5 (OPTION_MD_BASE + 5)
+ {"mips5", no_argument, NULL, OPTION_MIPS5},
+#define OPTION_MIPS32 (OPTION_MD_BASE + 6)
+ {"mips32", no_argument, NULL, OPTION_MIPS32},
+#define OPTION_MIPS64 (OPTION_MD_BASE + 7)
+ {"mips64", no_argument, NULL, OPTION_MIPS64},
+#define OPTION_MEMBEDDED_PIC (OPTION_MD_BASE + 8)
{"membedded-pic", no_argument, NULL, OPTION_MEMBEDDED_PIC},
-#define OPTION_TRAP (OPTION_MD_BASE + 7)
+#define OPTION_TRAP (OPTION_MD_BASE + 9)
{"trap", no_argument, NULL, OPTION_TRAP},
{"no-break", no_argument, NULL, OPTION_TRAP},
-#define OPTION_BREAK (OPTION_MD_BASE + 8)
+#define OPTION_BREAK (OPTION_MD_BASE + 10)
{"break", no_argument, NULL, OPTION_BREAK},
{"no-trap", no_argument, NULL, OPTION_BREAK},
-#define OPTION_EB (OPTION_MD_BASE + 9)
+#define OPTION_EB (OPTION_MD_BASE + 11)
{"EB", no_argument, NULL, OPTION_EB},
-#define OPTION_EL (OPTION_MD_BASE + 10)
+#define OPTION_EL (OPTION_MD_BASE + 12)
{"EL", no_argument, NULL, OPTION_EL},
-#define OPTION_M4650 (OPTION_MD_BASE + 11)
- {"m4650", no_argument, NULL, OPTION_M4650},
-#define OPTION_NO_M4650 (OPTION_MD_BASE + 12)
- {"no-m4650", no_argument, NULL, OPTION_NO_M4650},
-#define OPTION_M4010 (OPTION_MD_BASE + 13)
- {"m4010", no_argument, NULL, OPTION_M4010},
-#define OPTION_NO_M4010 (OPTION_MD_BASE + 14)
- {"no-m4010", no_argument, NULL, OPTION_NO_M4010},
-#define OPTION_M4100 (OPTION_MD_BASE + 15)
- {"m4100", no_argument, NULL, OPTION_M4100},
-#define OPTION_NO_M4100 (OPTION_MD_BASE + 16)
- {"no-m4100", no_argument, NULL, OPTION_NO_M4100},
-#define OPTION_MIPS16 (OPTION_MD_BASE + 17)
+#define OPTION_MIPS16 (OPTION_MD_BASE + 13)
{"mips16", no_argument, NULL, OPTION_MIPS16},
-#define OPTION_NO_MIPS16 (OPTION_MD_BASE + 18)
+#define OPTION_NO_MIPS16 (OPTION_MD_BASE + 14)
{"no-mips16", no_argument, NULL, OPTION_NO_MIPS16},
-#define OPTION_M3900 (OPTION_MD_BASE + 19)
- {"m3900", no_argument, NULL, OPTION_M3900},
-#define OPTION_NO_M3900 (OPTION_MD_BASE + 20)
- {"no-m3900", no_argument, NULL, OPTION_NO_M3900},
-#define OPTION_MABI (OPTION_MD_BASE + 21)
- {"mabi", required_argument, NULL, OPTION_MABI},
-#define OPTION_M7000_HILO_FIX (OPTION_MD_BASE + 22)
+#define OPTION_M7000_HILO_FIX (OPTION_MD_BASE + 15)
{"mfix7000", no_argument, NULL, OPTION_M7000_HILO_FIX},
-#define OPTION_NO_M7000_HILO_FIX (OPTION_MD_BASE + 23)
+#define OPTION_NO_M7000_HILO_FIX (OPTION_MD_BASE + 16)
{"no-fix-7000", no_argument, NULL, OPTION_NO_M7000_HILO_FIX},
-#define OPTION_GP32 (OPTION_MD_BASE + 24)
+#define OPTION_FP32 (OPTION_MD_BASE + 17)
+ {"mfp32", no_argument, NULL, OPTION_FP32},
+#define OPTION_GP32 (OPTION_MD_BASE + 18)
{"mgp32", no_argument, NULL, OPTION_GP32},
-#define OPTION_GP64 (OPTION_MD_BASE + 25)
- {"mgp64", no_argument, NULL, OPTION_GP64},
-#define OPTION_CONSTRUCT_FLOATS (OPTION_MD_BASE + 26)
+#define OPTION_CONSTRUCT_FLOATS (OPTION_MD_BASE + 19)
{"construct-floats", no_argument, NULL, OPTION_CONSTRUCT_FLOATS},
-#define OPTION_NO_CONSTRUCT_FLOATS (OPTION_MD_BASE + 27)
+#define OPTION_NO_CONSTRUCT_FLOATS (OPTION_MD_BASE + 20)
{"no-construct-floats", no_argument, NULL, OPTION_NO_CONSTRUCT_FLOATS},
-#define OPTION_MIPS32 (OPTION_MD_BASE + 28)
- {"mips32", no_argument, NULL, OPTION_MIPS32},
-#define OPTION_MIPS5 (OPTION_MD_BASE + 29)
- {"mips5", no_argument, NULL, OPTION_MIPS5},
-#define OPTION_MIPS64 (OPTION_MD_BASE + 30)
- {"mips64", no_argument, NULL, OPTION_MIPS64},
-#define OPTION_MARCH (OPTION_MD_BASE + 31)
+#define OPTION_MARCH (OPTION_MD_BASE + 21)
{"march", required_argument, NULL, OPTION_MARCH},
-#define OPTION_MTUNE (OPTION_MD_BASE + 32)
+#define OPTION_MTUNE (OPTION_MD_BASE + 22)
{"mtune", required_argument, NULL, OPTION_MTUNE},
-#define OPTION_FP32 (OPTION_MD_BASE + 33)
- {"mfp32", no_argument, NULL, OPTION_FP32},
+#define OPTION_MCPU (OPTION_MD_BASE + 23)
+ {"mcpu", required_argument, NULL, OPTION_MCPU},
+#define OPTION_M4650 (OPTION_MD_BASE + 24)
+ {"m4650", no_argument, NULL, OPTION_M4650},
+#define OPTION_NO_M4650 (OPTION_MD_BASE + 25)
+ {"no-m4650", no_argument, NULL, OPTION_NO_M4650},
+#define OPTION_M4010 (OPTION_MD_BASE + 26)
+ {"m4010", no_argument, NULL, OPTION_M4010},
+#define OPTION_NO_M4010 (OPTION_MD_BASE + 27)
+ {"no-m4010", no_argument, NULL, OPTION_NO_M4010},
+#define OPTION_M4100 (OPTION_MD_BASE + 28)
+ {"m4100", no_argument, NULL, OPTION_M4100},
+#define OPTION_NO_M4100 (OPTION_MD_BASE + 29)
+ {"no-m4100", no_argument, NULL, OPTION_NO_M4100},
+#define OPTION_M3900 (OPTION_MD_BASE + 30)
+ {"m3900", no_argument, NULL, OPTION_M3900},
+#define OPTION_NO_M3900 (OPTION_MD_BASE + 31)
+ {"no-m3900", no_argument, NULL, OPTION_NO_M3900},
+#define OPTION_GP64 (OPTION_MD_BASE + 32)
+ {"mgp64", no_argument, NULL, OPTION_GP64},
#ifdef OBJ_ELF
-#define OPTION_ELF_BASE (OPTION_MD_BASE + 35)
+#define OPTION_ELF_BASE (OPTION_MD_BASE + 33)
#define OPTION_CALL_SHARED (OPTION_ELF_BASE + 0)
-#define OPTION_NON_SHARED (OPTION_ELF_BASE + 1)
-#define OPTION_XGOT (OPTION_ELF_BASE + 2)
-#define OPTION_32 (OPTION_ELF_BASE + 3)
-#define OPTION_N32 (OPTION_ELF_BASE + 4)
-#define OPTION_64 (OPTION_ELF_BASE + 5)
{"KPIC", no_argument, NULL, OPTION_CALL_SHARED},
{"call_shared", no_argument, NULL, OPTION_CALL_SHARED},
+#define OPTION_NON_SHARED (OPTION_ELF_BASE + 1)
{"non_shared", no_argument, NULL, OPTION_NON_SHARED},
+#define OPTION_XGOT (OPTION_ELF_BASE + 2)
{"xgot", no_argument, NULL, OPTION_XGOT},
+#define OPTION_MABI (OPTION_ELF_BASE + 3)
+ {"mabi", required_argument, NULL, OPTION_MABI},
+#define OPTION_32 (OPTION_ELF_BASE + 4)
{"32", no_argument, NULL, OPTION_32},
+#define OPTION_N32 (OPTION_ELF_BASE + 5)
{"n32", no_argument, NULL, OPTION_N32},
+#define OPTION_64 (OPTION_ELF_BASE + 6)
{"64", no_argument, NULL, OPTION_64},
-#endif
-
+#endif /* OBJ_ELF */
{NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof (md_longopts);
@@ -9748,21 +9751,37 @@ md_parse_option (c, arg)
break;
#ifdef OBJ_ELF
- /* The -32 and -64 options tell the assembler to output the 32
- bit or the 64 bit MIPS ELF format. */
+ /* The -32, -n32 and -64 options are shortcuts for -mabi=32, -mabi=n32
+ and -mabi=64. */
case OPTION_32:
+ if (OUTPUT_FLAVOR != bfd_target_elf_flavour)
+ {
+ as_bad (_("-32 is supported only for ELF format"));
+ return 0;
+ }
mips_abi = O32_ABI;
break;
case OPTION_N32:
+ if (OUTPUT_FLAVOR != bfd_target_elf_flavour)
+ {
+ as_bad (_("-n32 is supported only for ELF format"));
+ return 0;
+ }
mips_abi = N32_ABI;
break;
case OPTION_64:
+ if (OUTPUT_FLAVOR != bfd_target_elf_flavour)
+ {
+ as_bad (_("-64 is supported only for ELF format"));
+ return 0;
+ }
mips_abi = N64_ABI;
if (! support_64bit_objects())
as_fatal (_("No compiled in support for 64 bit object file format"));
break;
+#endif /* OBJ_ELF */
case OPTION_GP32:
mips_gp32 = 1;
@@ -9782,7 +9801,13 @@ md_parse_option (c, arg)
mips_abi = NO_ABI;
break;
+#ifdef OBJ_ELF
case OPTION_MABI:
+ if (OUTPUT_FLAVOR != bfd_target_elf_flavour)
+ {
+ as_bad (_("-mabi is supported only for ELF format"));
+ return 0;
+ }
if (strcmp (arg, "32") == 0)
mips_abi = O32_ABI;
else if (strcmp (arg, "o64") == 0)
@@ -9928,6 +9953,19 @@ MIPS options:\n\
-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\
+-mabi=ABI create ABI conformant object file for:\n"));
+
+ first = 1;
+
+ show (stream, "32", &column, &first);
+ show (stream, "o64", &column, &first);
+ show (stream, "n32", &column, &first);
+ show (stream, "64", &column, &first);
+ show (stream, "eabi", &column, &first);
+
+ fputc ('\n', stream);
+
+ fprintf (stream, _("\
-32 create o32 ABI object file (default)\n\
-n32 create n32 ABI object file\n\
-64 create 64 ABI object file\n"));
diff -BurpNX /bigdisk/src/binutils-exclude src-orig/gas/testsuite/gas/mips/mips.exp src/gas/testsuite/gas/mips/mips.exp
--- src-orig/gas/testsuite/gas/mips/mips.exp Sat Aug 25 04:21:54 2001
+++ src/gas/testsuite/gas/mips/mips.exp Fri Oct 19 22:21:57 2001
@@ -17,8 +17,8 @@ proc run_list_test { name opts } {
if { [istarget mips*-*-*] } then {
set no_mips16 0
- set svr4pic [expr [istarget *-*-elf*] || [istarget *-*-irix5*] || [istarget *-*-irix6* ] || [istarget *-*-linux*] ]
- set empic [expr [istarget *-*-ecoff*] || [istarget *-*-ultrix*] || [istarget *-*-irix\[1-4\]*] ]
+ set elf [expr [istarget *-*-elf*] || [istarget *-*-irix5*] || [istarget *-*-irix6* ] || [istarget *-*-linux*] ]
+ set ecoff [expr [istarget *-*-ecoff*] || [istarget *-*-ultrix*] || [istarget *-*-irix\[1-4\]*] ]
set aout [expr [istarget *-*-bsd*] || [istarget *-*-netbsd*] || [istarget *-*-openbsd*] ]
set ilocks [istarget mipstx39*-*-*]
set gpr_ilocks [expr [istarget mipstx39*-*-*]]
@@ -47,27 +47,27 @@ if { [istarget mips*-*-*] } then {
run_dump_test "bltu"
if !$ilocks { run_dump_test "div" } else { run_dump_test "div-ilocks" }
run_dump_test "dli"
- if $svr4pic {
+ if $elf {
run_dump_test "elf-jal"
} else {
run_dump_test "jal"
}
- if $svr4pic { run_dump_test "jal-svr4pic" }
- if $svr4pic { run_dump_test "jal-xgot" }
- if $empic { run_dump_test "jal-empic" }
+ if $elf { run_dump_test "jal-svr4pic" }
+ if $elf { run_dump_test "jal-xgot" }
+ if $ecoff { run_dump_test "jal-empic" }
if !$aout { run_dump_test "la" }
- if $svr4pic { run_dump_test "la-svr4pic" }
- if $svr4pic { run_dump_test "la-xgot" }
- if $empic { run_dump_test "la-empic" }
+ if $elf { run_dump_test "la-svr4pic" }
+ if $elf { run_dump_test "la-xgot" }
+ if $ecoff { run_dump_test "la-empic" }
if !$aout { run_dump_test "lb" }
- if $svr4pic { run_dump_test "lb-svr4pic" }
- if $svr4pic {
+ if $elf { run_dump_test "lb-svr4pic" }
+ if $elf {
# Both versions specify the cpu, so we can run both regardless of
# the interlocking in the configured default cpu.
run_dump_test "lb-xgot"
run_dump_test "lb-xgot-ilocks"
}
- if $empic { run_dump_test "lb-empic" }
+ if $ecoff { run_dump_test "lb-empic" }
if !$aout {
if !$gpr_ilocks {
run_dump_test "ld"
@@ -79,23 +79,23 @@ if { [istarget mips*-*-*] } then {
}
}
}
- if $svr4pic { run_dump_test "ld-svr4pic" }
- if $svr4pic { run_dump_test "ld-xgot" }
- if $empic { run_dump_test "ld-empic" }
+ if $elf { run_dump_test "ld-svr4pic" }
+ if $elf { run_dump_test "ld-xgot" }
+ if $ecoff { run_dump_test "ld-empic" }
run_dump_test "li"
if !$aout { run_dump_test "lifloat" }
- if $svr4pic { run_dump_test "lif-svr4pic" }
- if $svr4pic { run_dump_test "lif-xgot" }
- if $empic { run_dump_test "lif-empic" }
+ if $elf { run_dump_test "lif-svr4pic" }
+ if $elf { run_dump_test "lif-xgot" }
+ if $ecoff { run_dump_test "lif-empic" }
run_dump_test "mips4"
if !$ilocks { run_dump_test "mul" } else { run_dump_test "mul-ilocks" }
run_dump_test "rol"
if !$aout { run_dump_test "sb" }
run_dump_test "trunc"
if !$aout { run_dump_test "ulh" }
- if $svr4pic { run_dump_test "ulh-svr4pic" }
- if $svr4pic { run_dump_test "ulh-xgot" }
- if $empic { run_dump_test "ulh-empic" }
+ if $elf { run_dump_test "ulh-svr4pic" }
+ if $elf { run_dump_test "ulh-xgot" }
+ if $ecoff { run_dump_test "ulh-empic" }
if !$aout {
run_dump_test "ulw"
run_dump_test "uld"
@@ -105,7 +105,7 @@ if { [istarget mips*-*-*] } then {
}
# The mips16 test can only be run on ELF, because only ELF
# supports the necessary mips16 reloc.
- if { $svr4pic && !$no_mips16 } { run_dump_test "mips16" }
+ if { $elf && !$no_mips16 } { run_dump_test "mips16" }
run_dump_test "delay"
run_dump_test "nodelay"
run_dump_test "mips4010"
@@ -129,9 +129,8 @@ if { [istarget mips*-*-*] } then {
run_dump_test "mips-gp32-fp64"
run_dump_test "mips-gp64-fp32"
run_dump_test "mips-gp64-fp64"
- run_dump_test "mips-abi32"
- if $svr4pic {
+ if $elf {
# Make sure that -mcpu=FOO and -mFOO are equivalent. Assemble a file
# containing 4650-specific instructions with -m4650 and -mcpu=4650,
# and verify that they're the same. Specifically, we're checking
@@ -147,7 +146,9 @@ if { [istarget mips*-*-*] } then {
run_dump_test "mips-gp32-fp64-pic"
run_dump_test "mips-gp64-fp32-pic"
run_dump_test "mips-gp64-fp64-pic"
- run_dump_test "mips-abi32-pic"
+
+ run_dump_test "mips-abi32"
+ run_dump_test "mips-abi32-pic"
run_dump_test "elf${el}-rel"
if [istarget mips64*-*-*] {
More information about the Binutils
mailing list