diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2013-06-23 20:08:23 +0000 |
---|---|---|
committer | Richard Sandiford <rdsandiford@googlemail.com> | 2013-06-23 20:08:23 +0000 |
commit | 42429eacb42f0cc6dfe7fbd6d74a59e652945794 (patch) | |
tree | ef4905253809dfc1021442e57c5f8b49f837b51a /gas | |
parent | 88924e5fa2eb37b464c88f9527ad9bfc63672e9d (diff) | |
download | gdb-42429eacb42f0cc6dfe7fbd6d74a59e652945794.zip gdb-42429eacb42f0cc6dfe7fbd6d74a59e652945794.tar.gz gdb-42429eacb42f0cc6dfe7fbd6d74a59e652945794.tar.bz2 |
bfd/
* Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Move MIPS ELF
files to...
(BFD64_BACKENDS, BFD64_BACKENDS_CFILES): ...here.
* Makefile.in: Regenerate.
* config.bfd: Enclose all MIPS ELF targets in #ifdef BFD64.
Set want64 to true for them at the end.
* targets.c (_bfd_target_vector): Protect MIPS ELF targets with
#ifdef BFD64.
gas/
* config/tc-mips.c: Assert that offsetT and valueT are at least
8 bytes in size.
(GPR_SMIN, GPR_SMAX): New macros.
(macro, mips_ip): Remove code for 4-byte valueT and offsetT.
ld/
* Makefile.am (ALL_EMULATION_SOURCES): Move MIPS ELF emulations to...
(ALL_64_EMULATION_SOURCES): ...here.
* Makefile.in: Regenerate.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/config/tc-mips.c | 79 |
2 files changed, 19 insertions, 67 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index f843414..26b13ed 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2013-06-23 Richard Sandiford <rdsandiford@googlemail.com> + + * config/tc-mips.c: Assert that offsetT and valueT are at least + 8 bytes in size. + (GPR_SMIN, GPR_SMAX): New macros. + (macro, mips_ip): Remove code for 4-byte valueT and offsetT. + 2013-06-22 Richard Sandiford <rdsandiford@googlemail.com> * config/tc-mips.c: Remove OBJ_ELF, OBJ_MAYBE_ELF and IS_ELF diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index f2d46c4..e259071 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -34,6 +34,10 @@ #include "dwarf2dbg.h" #include "dw2gencfi.h" +/* Check assumptions made in this file. */ +typedef char static_assert1[sizeof (offsetT) < 8 ? -1 : 1]; +typedef char static_assert2[sizeof (valueT) < 8 ? -1 : 1]; + #ifdef DEBUG #define DBG(x) printf x #else @@ -524,6 +528,10 @@ static int mips_32bitmode = 0; #define HAVE_CODE_COMPRESSION \ ((mips_opts.mips16 | mips_opts.micromips) != 0) +/* The minimum and maximum signed values that can be stored in a GPR. */ +#define GPR_SMAX ((offsetT) (((valueT) 1 << (HAVE_64BIT_GPRS ? 63 : 31)) - 1)) +#define GPR_SMIN (-GPR_SMAX - 1) + /* MIPS PIC level. */ enum mips_pic_level mips_pic; @@ -6742,7 +6750,6 @@ macro (struct mips_cl_insn *ip) int lp = 0; int ab = 0; int off; - offsetT maxnum; bfd_reloc_code_real_type r; int hold_mips_optimize; @@ -6945,17 +6952,7 @@ macro (struct mips_cl_insn *ip) likely = 1; case M_BGT_I: /* Check for > max integer. */ - maxnum = 0x7fffffff; - if (HAVE_64BIT_GPRS && sizeof (maxnum) > 4) - { - maxnum <<= 16; - maxnum |= 0xffff; - maxnum <<= 16; - maxnum |= 0xffff; - } - if (imm_expr.X_op == O_constant - && imm_expr.X_add_number >= maxnum - && (HAVE_32BIT_GPRS || sizeof (maxnum) > 4)) + if (imm_expr.X_op == O_constant && imm_expr.X_add_number >= GPR_SMAX) { do_false: /* Result is always false. */ @@ -6985,18 +6982,7 @@ macro (struct mips_cl_insn *ip) &offset_expr, sreg); break; } - maxnum = 0x7fffffff; - if (HAVE_64BIT_GPRS && sizeof (maxnum) > 4) - { - maxnum <<= 16; - maxnum |= 0xffff; - maxnum <<= 16; - maxnum |= 0xffff; - } - maxnum = - maxnum - 1; - if (imm_expr.X_op == O_constant - && imm_expr.X_add_number <= maxnum - && (HAVE_32BIT_GPRS || sizeof (maxnum) > 4)) + if (imm_expr.X_op == O_constant && imm_expr.X_add_number <= GPR_SMIN) { do_true: /* result is always true */ @@ -7109,17 +7095,7 @@ macro (struct mips_cl_insn *ip) case M_BLEL_I: likely = 1; case M_BLE_I: - maxnum = 0x7fffffff; - if (HAVE_64BIT_GPRS && sizeof (maxnum) > 4) - { - maxnum <<= 16; - maxnum |= 0xffff; - maxnum <<= 16; - maxnum |= 0xffff; - } - if (imm_expr.X_op == O_constant - && imm_expr.X_add_number >= maxnum - && (HAVE_32BIT_GPRS || sizeof (maxnum) > 4)) + if (imm_expr.X_op == O_constant && imm_expr.X_add_number >= GPR_SMAX) goto do_true; if (imm_expr.X_op != O_constant) as_bad (_("Unsupported large constant")); @@ -12854,7 +12830,7 @@ mips_ip (char *str, struct mips_cl_insn *ip) if (offset_expr.X_add_number == 0) offset_expr.X_op = O_absent; } - else if (sizeof (imm_expr.X_add_number) > 4) + else { imm_expr.X_op = O_constant; if (!target_big_endian) @@ -12862,25 +12838,6 @@ mips_ip (char *str, struct mips_cl_insn *ip) else imm_expr.X_add_number = bfd_getb64 (temp); } - else - { - imm_expr.X_op = O_big; - imm_expr.X_add_number = 4; - if (!target_big_endian) - { - generic_bignum[0] = bfd_getl16 (temp); - generic_bignum[1] = bfd_getl16 (temp + 2); - generic_bignum[2] = bfd_getl16 (temp + 4); - generic_bignum[3] = bfd_getl16 (temp + 6); - } - else - { - generic_bignum[0] = bfd_getb16 (temp + 6); - generic_bignum[1] = bfd_getb16 (temp + 4); - generic_bignum[2] = bfd_getb16 (temp + 2); - generic_bignum[3] = bfd_getb16 (temp); - } - } } else { @@ -12947,18 +12904,6 @@ mips_ip (char *str, struct mips_cl_insn *ip) more = (insn + 1 < past && strcmp (insn->name, insn[1].name) == 0); - /* If the expression was written as an unsigned number, - only treat it as signed if there are no more - alternatives. */ - if (more - && *args == 'j' - && sizeof (imm_expr.X_add_number) <= 4 - && imm_expr.X_op == O_constant - && imm_expr.X_add_number < 0 - && imm_expr.X_unsigned - && HAVE_64BIT_GPRS) - break; - /* For compatibility with older assemblers, we accept 0x8000-0xffff as signed 16-bit numbers when only signed numbers are allowed. */ |