diff options
author | Alan Modra <amodra@gmail.com> | 1999-07-28 23:19:26 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 1999-07-28 23:19:26 +0000 |
commit | b77ad1d4c9165935726e6d9a90bc42d5e2a876ed (patch) | |
tree | 5dba675e29306bea840b26eabeced8c77f3d3a47 /gas | |
parent | 25ef477f61afa0ec1c42a2f1beee6c39588ef46e (diff) | |
download | gdb-b77ad1d4c9165935726e6d9a90bc42d5e2a876ed.zip gdb-b77ad1d4c9165935726e6d9a90bc42d5e2a876ed.tar.gz gdb-b77ad1d4c9165935726e6d9a90bc42d5e2a876ed.tar.bz2 |
Fix an overflow checking bug uncovered when a 32 bit target is compiled
with a 64 bit bfd.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/config/tc-i386.c | 4 | ||||
-rw-r--r-- | gas/write.c | 20 |
3 files changed, 13 insertions, 18 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 3b535ad..7116952 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +1999-07-29 Alan Modra <alan@spri.levels.unisa.edu.au> + + * write.c (fixup_segment): Fix generic error check overflow test. + + * config/tc-i386.c (pe): Change %d to %ld, %x to %lx, and cast + X_add_number to long. + Wed Jul 28 02:04:24 1999 "Jerry Quinn" <jquinn@nortelnetworks.com> * config/tc-hppa.c (pa_ip): Add 'J' and 'K' code diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 30c9abf..524819e 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -777,8 +777,8 @@ pe (e) expressionS *e; { fprintf (stdout, " operation %d\n", e->X_op); - fprintf (stdout, " add_number %d (%x)\n", - e->X_add_number, e->X_add_number); + fprintf (stdout, " add_number %ld (%lx)\n", + (long) e->X_add_number, (long) e->X_add_number); if (e->X_add_symbol) { fprintf (stdout, " add_symbol "); diff --git a/gas/write.c b/gas/write.c index 0c28ac7..536e76d 100644 --- a/gas/write.c +++ b/gas/write.c @@ -2733,24 +2733,12 @@ fixup_segment (fixP, this_segment_type) { if ((size_t) size < sizeof (valueT)) { - valueT mask, hibit; + valueT mask; - /* set all bits to one */ mask = 0; - mask--; - /* Technically, combining these produces an undefined result - if size is sizeof (valueT), though I think these two - half-way operations should both be defined. And the - compiler should be able to combine them if it's valid on - the host architecture. */ - mask <<= size * 4; - mask <<= size * 4; - hibit = (valueT) 1 << (size * 8 - 1); - if (((add_number & mask) != 0 - || (fixP->fx_signed - && (add_number & hibit) != 0)) - && ((add_number & mask) != mask - || (add_number & hibit) == 0)) + mask--; /* set all bits to one */ + mask <<= size * 8 - (fixP->fx_signed ? 1 : 0); + if ((add_number & mask) != 0 && (add_number & mask) != mask) { char buf[50], buf2[50]; sprint_value (buf, fragP->fr_address + where); |