gas: Fix left shift of negative value.
This patch fixes all occurences of left-shifting negative constants in C cod which is undefined by the C standard. gas/ChangeLog: * read.c (parse_bitfield_cons): Fix left shift of negative value. * config/tc-xstormy16.c (md_section_align): Likewise. * config/tc-xgate.c (md_section_align): Likewise. * config/tc-visium.c (md_section_align): Likewise. * config/tc-v850.c (md_section_align): Likewise. * config/tc-tic6x.c (md_section_align): Likewise. * config/tc-sh.c (SH64PCREL32_M, SH64PCREL48_M, SH64PCREL32_M) (MOVI_32_M, MOVI_48_M, MOVI_32_M, md_section_align): Likewise. * config/tc-sh64.c (shmedia_md_estimate_size_before_relax): Likewise. * config/tc-score.c (s3_section_align): Likewise. * config/tc-score7.c (s7_section_align): Likewise. * config/tc-s390.c (md_section_align): Likewise. * config/tc-rx.c (md_section_align): Likewise. * config/tc-rl78.c (md_section_align): Likewise. * config/tc-ppc.c (md_section_align): Likewise. * config/tc-or1k.c (md_section_align): Likewise. * config/tc-nds32.c (md_section_align): Likewise. * config/tc-mt.c (md_section_align): Likewise. * config/tc-msp430.c (md_section_align): Likewise. * config/tc-mn10300.c (md_section_align): Likewise. * config/tc-mn10200.c (md_section_align): Likewise. * config/tc-mips.c (md_section_align): Likewise. * config/tc-microblaze.c (parse_imm): Likewise. * config/tc-mep.c (md_section_align): Likewise. * config/tc-m68k.c (md_section_align): Likewise. * config/tc-m68hc11.c (md_section_align): Likewise. * config/tc-m32r.c (md_section_align): Likewise. * config/tc-m32c.c (md_section_align): Likewise. * config/tc-lm32.c (md_section_align): Likewise. * config/tc-iq2000.c (md_section_align): Likewise. * config/tc-ip2k.c (md_section_align): Likewise. * config/tc-ia64.c (dot_save, dot_vframe): Likewise. * config/tc-i960.c (md_number_to_field, md_section_align): Likewise. * config/tc-i386.c (md_section_align): Likewise. * config/tc-i370.c (md_section_align): Likewise. * config/tc-frv.c (md_section_align): Likewise. * config/tc-fr30.c (md_section_align): Likewise. * config/tc-epiphany.c (md_section_align): Likewise. * config/tc-d30v.c (md_section_align): Likewise. * config/tc-d10v.c (md_section_align): Likewise. * config/tc-cr16.c (l_cons): Likewise. * config/tc-bfin.c (md_section_align): Likewise. * config/tc-arm.c (md_section_align): Likewise. * config/tc-arc.c (md_section_align): Likewise. * config/bfin-parse.y (expr_1): Likewise. gas/testsuite/ChangeLog: * gas/all/test-gen.c (random_order_16s, random_order_24s) (random_order_32s): Fix left shift of negative value.
This commit is contained in:
parent
c4e0beacd7
commit
8d3842cd15
@ -1,3 +1,51 @@
|
||||
2015-11-09 Dominik Vogt <vogt@linux.vnet.ibm.com>
|
||||
|
||||
* read.c (parse_bitfield_cons): Fix left shift of negative value.
|
||||
* config/tc-xstormy16.c (md_section_align): Likewise.
|
||||
* config/tc-xgate.c (md_section_align): Likewise.
|
||||
* config/tc-visium.c (md_section_align): Likewise.
|
||||
* config/tc-v850.c (md_section_align): Likewise.
|
||||
* config/tc-tic6x.c (md_section_align): Likewise.
|
||||
* config/tc-sh.c (SH64PCREL32_M, SH64PCREL48_M, SH64PCREL32_M)
|
||||
(MOVI_32_M, MOVI_48_M, MOVI_32_M, md_section_align): Likewise.
|
||||
* config/tc-sh64.c (shmedia_md_estimate_size_before_relax): Likewise.
|
||||
* config/tc-score.c (s3_section_align): Likewise.
|
||||
* config/tc-score7.c (s7_section_align): Likewise.
|
||||
* config/tc-s390.c (md_section_align): Likewise.
|
||||
* config/tc-rx.c (md_section_align): Likewise.
|
||||
* config/tc-rl78.c (md_section_align): Likewise.
|
||||
* config/tc-ppc.c (md_section_align): Likewise.
|
||||
* config/tc-or1k.c (md_section_align): Likewise.
|
||||
* config/tc-nds32.c (md_section_align): Likewise.
|
||||
* config/tc-mt.c (md_section_align): Likewise.
|
||||
* config/tc-msp430.c (md_section_align): Likewise.
|
||||
* config/tc-mn10300.c (md_section_align): Likewise.
|
||||
* config/tc-mn10200.c (md_section_align): Likewise.
|
||||
* config/tc-mips.c (md_section_align): Likewise.
|
||||
* config/tc-microblaze.c (parse_imm): Likewise.
|
||||
* config/tc-mep.c (md_section_align): Likewise.
|
||||
* config/tc-m68k.c (md_section_align): Likewise.
|
||||
* config/tc-m68hc11.c (md_section_align): Likewise.
|
||||
* config/tc-m32r.c (md_section_align): Likewise.
|
||||
* config/tc-m32c.c (md_section_align): Likewise.
|
||||
* config/tc-lm32.c (md_section_align): Likewise.
|
||||
* config/tc-iq2000.c (md_section_align): Likewise.
|
||||
* config/tc-ip2k.c (md_section_align): Likewise.
|
||||
* config/tc-ia64.c (dot_save, dot_vframe): Likewise.
|
||||
* config/tc-i960.c (md_number_to_field, md_section_align): Likewise.
|
||||
* config/tc-i386.c (md_section_align): Likewise.
|
||||
* config/tc-i370.c (md_section_align): Likewise.
|
||||
* config/tc-frv.c (md_section_align): Likewise.
|
||||
* config/tc-fr30.c (md_section_align): Likewise.
|
||||
* config/tc-epiphany.c (md_section_align): Likewise.
|
||||
* config/tc-d30v.c (md_section_align): Likewise.
|
||||
* config/tc-d10v.c (md_section_align): Likewise.
|
||||
* config/tc-cr16.c (l_cons): Likewise.
|
||||
* config/tc-bfin.c (md_section_align): Likewise.
|
||||
* config/tc-arm.c (md_section_align): Likewise.
|
||||
* config/tc-arc.c (md_section_align): Likewise.
|
||||
* config/bfin-parse.y (expr_1): Likewise.
|
||||
|
||||
2015-11-02 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* config/rx-parse.y: Allow zero value for 5-bit displacements.
|
||||
|
@ -4505,7 +4505,7 @@ static int
|
||||
value_match (Expr_Node *exp, int sz, int sign, int mul, int issigned)
|
||||
{
|
||||
int umax = (1 << sz) - 1;
|
||||
int min = -1 << (sz - 1);
|
||||
int min = -(1 << (sz - 1));
|
||||
int max = (1 << (sz - 1)) - 1;
|
||||
|
||||
int v = (EXPR_VALUE (exp)) & 0xffffffff;
|
||||
|
@ -1067,7 +1067,7 @@ md_section_align (segT segment,
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
/* The location from which a PC relative jump should be calculated,
|
||||
|
@ -21019,7 +21019,7 @@ md_section_align (segT segment ATTRIBUTE_UNUSED,
|
||||
int align;
|
||||
|
||||
align = bfd_get_section_alignment (stdoutput, segment);
|
||||
size = ((size + (1 << align) - 1) & ((valueT) -1 << align));
|
||||
size = ((size + (1 << align) - 1) & (-((valueT) 1 << align)));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -796,7 +796,7 @@ md_section_align (segment, size)
|
||||
valueT size;
|
||||
{
|
||||
int boundary = bfd_get_section_alignment (stdoutput, segment);
|
||||
return ((size + (1 << boundary) - 1) & (-1 << boundary));
|
||||
return ((size + (1 << boundary) - 1) & -(1 << boundary));
|
||||
}
|
||||
|
||||
|
||||
|
@ -206,7 +206,7 @@ l_cons (int nbytes)
|
||||
return;
|
||||
}
|
||||
|
||||
value |= ((~(-1 << width) & exp.X_add_number)
|
||||
value |= ((~(-(1 << width)) & exp.X_add_number)
|
||||
<< ((BITS_PER_CHAR * nbytes) - bits_available));
|
||||
|
||||
if ((bits_available -= width) == 0
|
||||
|
@ -269,7 +269,7 @@ valueT
|
||||
md_section_align (asection *seg, valueT addr)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, seg);
|
||||
return ((addr + (1 << align) - 1) & (-1 << align));
|
||||
return ((addr + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -303,7 +303,7 @@ valueT
|
||||
md_section_align (asection *seg, valueT addr)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, seg);
|
||||
return ((addr + (1 << align) - 1) & (-1 << align));
|
||||
return ((addr + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -173,7 +173,7 @@ md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
|
||||
|
@ -156,7 +156,7 @@ md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
symbolS *
|
||||
|
@ -1227,7 +1227,7 @@ valueT
|
||||
md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
symbolS *
|
||||
|
@ -2375,7 +2375,7 @@ md_section_align (asection *seg, valueT addr)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, seg);
|
||||
|
||||
return (addr + (1 << align) - 1) & (-1 << align);
|
||||
return (addr + (1 << align) - 1) & -(1 << align);
|
||||
}
|
||||
|
||||
/* We don't have any form of relaxing. */
|
||||
|
@ -10317,7 +10317,7 @@ md_section_align (segT segment ATTRIBUTE_UNUSED, valueT size)
|
||||
int align;
|
||||
|
||||
align = bfd_get_section_alignment (stdoutput, segment);
|
||||
size = ((size + (1 << align) - 1) & ((valueT) -1 << align));
|
||||
size = ((size + (1 << align) - 1) & (-((valueT) 1 << align)));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1751,7 +1751,7 @@ md_number_to_field (char *instrP, /* Pointer to instruction to be fixed. */
|
||||
{
|
||||
/* Put bit field into instruction and write back in target
|
||||
* byte order. */
|
||||
val &= ~(-1 << (int) numbits); /* Clear unused sign bits. */
|
||||
val &= ~(-(1 << (int) numbits)); /* Clear unused sign bits. */
|
||||
instr |= val;
|
||||
md_number_to_chars (instrP, instr, 4);
|
||||
}
|
||||
@ -2466,7 +2466,7 @@ md_section_align (segT seg,
|
||||
int align;
|
||||
|
||||
align = bfd_get_section_alignment (stdoutput, seg);
|
||||
return (addr + (1 << align) - 1) & (-1 << align);
|
||||
return (addr + (1 << align) - 1) & -(1 << align);
|
||||
}
|
||||
|
||||
extern int coff_flags;
|
||||
|
@ -3339,7 +3339,7 @@ dot_vframe (int dummy ATTRIBUTE_UNUSED)
|
||||
if (! (unwind.prologue_mask & 2))
|
||||
add_unwind_entry (output_psp_gr (reg), NOT_A_CHAR);
|
||||
else if (reg != unwind.prologue_gr
|
||||
+ (unsigned) popcount (unwind.prologue_mask & (-2 << 1)))
|
||||
+ (unsigned) popcount (unwind.prologue_mask & -(2 << 1)))
|
||||
as_warn (_("Operand of .vframe contradicts .prologue"));
|
||||
}
|
||||
|
||||
@ -3421,7 +3421,7 @@ dot_save (int dummy ATTRIBUTE_UNUSED)
|
||||
if (! (unwind.prologue_mask & 4))
|
||||
add_unwind_entry (output_pfs_gr (reg2), NOT_A_CHAR);
|
||||
else if (reg2 != unwind.prologue_gr
|
||||
+ (unsigned) popcount (unwind.prologue_mask & (-4 << 1)))
|
||||
+ (unsigned) popcount (unwind.prologue_mask & -(4 << 1)))
|
||||
as_warn (_("Second operand of .save contradicts .prologue"));
|
||||
break;
|
||||
case REG_AR + AR_LC:
|
||||
@ -3440,7 +3440,7 @@ dot_save (int dummy ATTRIBUTE_UNUSED)
|
||||
if (! (unwind.prologue_mask & 1))
|
||||
add_unwind_entry (output_preds_gr (reg2), NOT_A_CHAR);
|
||||
else if (reg2 != unwind.prologue_gr
|
||||
+ (unsigned) popcount (unwind.prologue_mask & (-1 << 1)))
|
||||
+ (unsigned) popcount (unwind.prologue_mask & -(1 << 1)))
|
||||
as_warn (_("Second operand of .save contradicts .prologue"));
|
||||
break;
|
||||
case REG_PRIUNAT:
|
||||
|
@ -231,7 +231,7 @@ md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
|
||||
|
@ -432,7 +432,7 @@ valueT
|
||||
md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
symbolS *
|
||||
|
@ -278,7 +278,7 @@ valueT
|
||||
md_section_align (asection *seg, valueT addr)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, seg);
|
||||
return ((addr + (1 << align) - 1) & (-1 << align));
|
||||
return ((addr + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
/* This function assembles the instructions. It emits the frags/bytes to the
|
||||
|
@ -410,7 +410,7 @@ valueT
|
||||
md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
symbolS *
|
||||
|
@ -1450,7 +1450,7 @@ md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
symbolS *
|
||||
|
@ -584,7 +584,7 @@ valueT
|
||||
md_section_align (asection *seg, valueT addr)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, seg);
|
||||
return ((addr + (1 << align) - 1) & (-1 << align));
|
||||
return ((addr + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -7888,7 +7888,7 @@ md_section_align (segT segment ATTRIBUTE_UNUSED, valueT size)
|
||||
int align;
|
||||
|
||||
align = bfd_get_section_alignment (stdoutput, segment);
|
||||
size = ((size + (1 << align) - 1) & ((valueT) -1 << align));
|
||||
size = ((size + (1 << align) - 1) & (-((valueT) 1 << align)));
|
||||
#endif
|
||||
|
||||
return size;
|
||||
|
@ -1382,7 +1382,7 @@ valueT
|
||||
md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
|
||||
|
@ -739,7 +739,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max)
|
||||
{
|
||||
/* Special case: sign extend negative 32-bit values to 64-bits. */
|
||||
if ((e->X_add_number >> 31) == 1)
|
||||
e->X_add_number |= (-1 << 31);
|
||||
e->X_add_number |= -(1 << 31);
|
||||
|
||||
if (e->X_add_number < min || e->X_add_number > max)
|
||||
{
|
||||
|
@ -16500,7 +16500,7 @@ md_section_align (asection *seg, valueT addr)
|
||||
if (align > 4)
|
||||
align = 4;
|
||||
|
||||
return ((addr + (1 << align) - 1) & (-1 << align));
|
||||
return ((addr + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
/* Utility routine, called from above as well. If called while the
|
||||
|
@ -676,7 +676,7 @@ valueT
|
||||
md_section_align (asection *seg, valueT addr)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, seg);
|
||||
return ((addr + (1 << align) - 1) & (-1 << align));
|
||||
return ((addr + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -905,7 +905,7 @@ md_section_align (asection *seg, valueT addr)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, seg);
|
||||
|
||||
return ((addr + (1 << align) - 1) & (-1 << align));
|
||||
return ((addr + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3955,7 +3955,7 @@ md_section_align (asection * seg, valueT addr)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, seg);
|
||||
|
||||
return ((addr + (1 << align) - 1) & (-1 << align));
|
||||
return ((addr + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
/* If you define this macro, it should return the offset between the
|
||||
|
@ -333,7 +333,7 @@ md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
symbolS *
|
||||
|
@ -5380,7 +5380,7 @@ md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
/* GAS will call this function when a symbol table lookup fails, before it
|
||||
|
@ -166,7 +166,7 @@ valueT
|
||||
md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
symbolS *
|
||||
|
@ -6090,7 +6090,7 @@ md_section_align (asection *seg ATTRIBUTE_UNUSED, valueT addr)
|
||||
#else
|
||||
int align = bfd_get_section_alignment (stdoutput, seg);
|
||||
|
||||
return ((addr + (1 << align) - 1) & (-1 << align));
|
||||
return ((addr + (1 << align) - 1) & -(1 << align));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1469,5 +1469,5 @@ valueT
|
||||
md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
@ -1248,7 +1248,7 @@ valueT
|
||||
md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
/* NOP - 1 cycle */
|
||||
|
@ -2047,7 +2047,7 @@ md_section_align (asection *seg, valueT addr)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, seg);
|
||||
|
||||
return ((addr + (1 << align) - 1) & (-1 << align));
|
||||
return ((addr + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
/* We don't have any form of relaxing. */
|
||||
|
@ -7089,7 +7089,7 @@ static valueT
|
||||
s3_section_align (segT segment ATTRIBUTE_UNUSED, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -6634,7 +6634,7 @@ s7_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -281,15 +281,15 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
|
||||
#if BFD_HOST_64BIT_LONG
|
||||
/* The "reach" type is long, so we can only do this for a 64-bit-long
|
||||
host. */
|
||||
#define SH64PCREL32_M (((long) -1 << 30) * 2 - 4)
|
||||
#define SH64PCREL32_M ((-((long) 1 << 30)) * 2 - 4)
|
||||
#define SH64PCREL48_F ((((long) 1 << 47) - 1) - 4)
|
||||
#define SH64PCREL48_M (((long) -1 << 47) - 4)
|
||||
#define SH64PCREL48_M ((-((long) 1 << 47)) - 4)
|
||||
#define SH64PCREL48_LENGTH (3 * 4)
|
||||
#else
|
||||
/* If the host does not have 64-bit longs, just make this state identical
|
||||
in reach to the 32-bit state. Note that we have a slightly incorrect
|
||||
reach, but the correct one above will overflow a 32-bit number. */
|
||||
#define SH64PCREL32_M (((long) -1 << 30) * 2)
|
||||
#define SH64PCREL32_M ((-((long) 1 << 30)) * 2)
|
||||
#define SH64PCREL48_F SH64PCREL32_F
|
||||
#define SH64PCREL48_M SH64PCREL32_M
|
||||
#define SH64PCREL48_LENGTH (3 * 4)
|
||||
@ -313,14 +313,14 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
|
||||
#if BFD_HOST_64BIT_LONG
|
||||
/* The "reach" type is long, so we can only do this for a 64-bit-long
|
||||
host. */
|
||||
#define MOVI_32_M (((long) -1 << 30) * 2 - 4)
|
||||
#define MOVI_32_M ((-((long) 1 << 30)) * 2 - 4)
|
||||
#define MOVI_48_F ((((long) 1 << 47) - 1) - 4)
|
||||
#define MOVI_48_M (((long) -1 << 47) - 4)
|
||||
#define MOVI_48_M ((-((long) 1 << 47)) - 4)
|
||||
#else
|
||||
/* If the host does not have 64-bit longs, just make this state identical
|
||||
in reach to the 32-bit state. Note that we have a slightly incorrect
|
||||
reach, but the correct one above will overflow a 32-bit number. */
|
||||
#define MOVI_32_M (((long) -1 << 30) * 2)
|
||||
#define MOVI_32_M ((-((long) 1 << 30)) * 2)
|
||||
#define MOVI_48_F MOVI_32_F
|
||||
#define MOVI_48_M MOVI_32_M
|
||||
#endif /* BFD_HOST_64BIT_LONG */
|
||||
@ -3692,7 +3692,7 @@ md_section_align (segT seg ATTRIBUTE_UNUSED, valueT size)
|
||||
return size;
|
||||
#else /* ! OBJ_ELF */
|
||||
return ((size + (1 << bfd_get_section_alignment (stdoutput, seg)) - 1)
|
||||
& (-1 << bfd_get_section_alignment (stdoutput, seg)));
|
||||
& -(1 << bfd_get_section_alignment (stdoutput, seg)));
|
||||
#endif /* ! OBJ_ELF */
|
||||
}
|
||||
|
||||
|
@ -2020,7 +2020,7 @@ shmedia_md_estimate_size_before_relax (fragS *fragP,
|
||||
offsetT value = fragP->fr_offset
|
||||
+ (fragP->fr_symbol == NULL ? 0 : S_GET_VALUE (fragP->fr_symbol));
|
||||
|
||||
if (value >= ((offsetT) -1 << 15) && value < ((offsetT) 1 << 15))
|
||||
if (value >= (-((offsetT) 1 << 15)) && value < ((offsetT) 1 << 15))
|
||||
{
|
||||
/* Fits in 16-bit signed number. */
|
||||
int what = GET_WHAT (fragP->fr_subtype);
|
||||
|
@ -4484,7 +4484,7 @@ md_section_align (segT segment ATTRIBUTE_UNUSED,
|
||||
/* Round up section sizes to ensure that text sections consist of
|
||||
whole fetch packets. */
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
return ((size + (1 << align) - 1) & ((valueT) -1 << align));
|
||||
return ((size + (1 << align) - 1) & (-((valueT) 1 << align)));
|
||||
}
|
||||
|
||||
/* No special undefined symbol handling needed for now. */
|
||||
|
@ -1879,7 +1879,7 @@ valueT
|
||||
md_section_align (asection *seg, valueT addr)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, seg);
|
||||
return ((addr + (1 << align) - 1) & (-1 << align));
|
||||
return ((addr + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -224,7 +224,7 @@ md_section_align (asection *seg, valueT addr)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, seg);
|
||||
|
||||
return ((addr + (1 << align) - 1) & (-1 << align));
|
||||
return ((addr + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -235,7 +235,7 @@ valueT
|
||||
md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
symbolS *
|
||||
|
@ -469,7 +469,7 @@ valueT
|
||||
md_section_align (asection * seg, valueT addr)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, seg);
|
||||
return ((addr + (1 << align) - 1) & (-1 << align));
|
||||
return ((addr + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -279,7 +279,7 @@ md_section_align (segT segment, valueT size)
|
||||
{
|
||||
int align = bfd_get_section_alignment (stdoutput, segment);
|
||||
|
||||
return ((size + (1 << align) - 1) & (-1 << align));
|
||||
return ((size + (1 << align) - 1) & -(1 << align));
|
||||
}
|
||||
|
||||
symbolS *
|
||||
|
@ -4602,7 +4602,7 @@ parse_bitfield_cons (exp, nbytes)
|
||||
return;
|
||||
} /* Too complex. */
|
||||
|
||||
value |= ((~(-1 << width) & exp->X_add_number)
|
||||
value |= ((~(-(1 << width)) & exp->X_add_number)
|
||||
<< ((BITS_PER_CHAR * nbytes) - bits_available));
|
||||
|
||||
if ((bits_available -= width) == 0
|
||||
|
@ -1,3 +1,8 @@
|
||||
2015-11-09 Dominik Vogt <vogt@linux.vnet.ibm.com>
|
||||
|
||||
* gas/all/test-gen.c (random_order_16s, random_order_24s)
|
||||
(random_order_32s): Fix left shift of negative value.
|
||||
|
||||
2015-11-02 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* gas/rx/max.d: Update expected disassembly.
|
||||
|
@ -404,12 +404,12 @@ int random_order_16s[] =
|
||||
generated often enough. */
|
||||
-32768,
|
||||
32767,
|
||||
(-1 << 15) | (64 << 8) | 32,
|
||||
(-(1 << 15)) | (64 << 8) | 32,
|
||||
(64 << 8) | 32,
|
||||
0x1234,
|
||||
(-1 << 15) | 0x8765,
|
||||
(-(1 << 15)) | 0x8765,
|
||||
0x0180,
|
||||
(-1 << 15) | 0x8001
|
||||
(-(1 << 15)) | 0x8001
|
||||
};
|
||||
|
||||
/* Use `24s' to generate 24-bit signed values. Good for selecting
|
||||
@ -420,14 +420,14 @@ int random_order_24s[] =
|
||||
intermediate values selected by chance. Keep the number of
|
||||
intermediate values low, to ensure that the limit values are
|
||||
generated often enough. */
|
||||
-1 << 23,
|
||||
-(1 << 23),
|
||||
1 << 23 -1,
|
||||
(-1 << 23) | (((64 << 8) | 32) << 8) | 16,
|
||||
(-(1 << 23)) | (((64 << 8) | 32) << 8) | 16,
|
||||
(((64 << 8) | 32) << 8) | 16,
|
||||
0x123456,
|
||||
(-1 << 23) | 0x876543,
|
||||
(-(1 << 23)) | 0x876543,
|
||||
0x01ff80,
|
||||
(-1 << 23) | 0x80ff01
|
||||
(-(1 << 23)) | 0x80ff01
|
||||
};
|
||||
|
||||
/* Use `32s' to generate 32-bit signed values. Good for selecting
|
||||
@ -438,14 +438,14 @@ int random_order_32s[] =
|
||||
intermediate values selected by chance. Keep the number of
|
||||
intermediate values low, to ensure that the limit values are
|
||||
generated often enough. */
|
||||
-1 << 31,
|
||||
-(1 << 31),
|
||||
1 << 31 - 1,
|
||||
(-1 << 31) | (((((64 << 8) | 32) << 8) | 16) << 8) | 8,
|
||||
(-(1 << 31)) | (((((64 << 8) | 32) << 8) | 16) << 8) | 8,
|
||||
(((((64 << 8) | 32) << 8) | 16) << 8) | 8,
|
||||
0x12345678,
|
||||
(-1 << 31) | 0x87654321,
|
||||
(-(1 << 31)) | 0x87654321,
|
||||
0x01ffff80,
|
||||
(-1 << 31) | 0x80ffff01
|
||||
(-(1 << 31)) | 0x80ffff01
|
||||
};
|
||||
|
||||
/* This function computes the number of digits needed to represent a
|
||||
|
Loading…
Reference in New Issue
Block a user