diff options
author | Ken Raeburn <raeburn@cygnus> | 1994-02-08 21:02:35 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@cygnus> | 1994-02-08 21:02:35 +0000 |
commit | df44a8523f9bd4d8e535256728f917f76ec51451 (patch) | |
tree | daf04b1fca04f5917cfbc093a2a1473dd4f34005 /gas/write.c | |
parent | fa965415f5c79e5de8597265ac015f592c439025 (diff) | |
download | gdb-df44a8523f9bd4d8e535256728f917f76ec51451.zip gdb-df44a8523f9bd4d8e535256728f917f76ec51451.tar.gz gdb-df44a8523f9bd4d8e535256728f917f76ec51451.tar.bz2 |
* write.c (write_relocs): Print some sensible error message if
bfd_perform_relocation returns bfd_reloc_overflow.
Diffstat (limited to 'gas/write.c')
-rw-r--r-- | gas/write.c | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/gas/write.c b/gas/write.c index dc4c4e4..55d5961 100644 --- a/gas/write.c +++ b/gas/write.c @@ -683,6 +683,9 @@ write_relocs (abfd, sec, xxx) { case bfd_reloc_ok: break; + case bfd_reloc_overflow: + as_bad_where (fixp->fx_file, fixp->fx_line, "relocation overflow"); + break; default: as_fatal ("bad return from bfd_perform_relocation"); } @@ -2072,28 +2075,31 @@ fixup_segment (fixP, this_segment_type) if (!fixP->fx_bit_fixP && size > 0) { valueT mask = 0; - /* set all bits to one */ - 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; - if ((add_number & mask) != 0 - && (add_number & mask) != mask) + if (size < sizeof (mask)) { - char buf[50], buf2[50]; - sprint_value (buf, fragP->fr_address + where); - if (add_number > 1000) - sprint_value (buf2, add_number); - else - sprintf (buf2, "%ld", (long) add_number); - as_bad_where (fixP->fx_file, fixP->fx_line, - "Value of %s too large for field of %d bytes at %s", - buf2, size, buf); - } /* generic error checking */ + /* set all bits to one */ + 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; + if ((add_number & mask) != 0 + && (add_number & mask) != mask) + { + char buf[50], buf2[50]; + sprint_value (buf, fragP->fr_address + where); + if (add_number > 1000) + sprint_value (buf2, add_number); + else + sprintf (buf2, "%ld", (long) add_number); + as_bad_where (fixP->fx_file, fixP->fx_line, + "Value of %s too large for field of %d bytes at %s", + buf2, size, buf); + } /* generic error checking */ + } #ifdef WARN_SIGNED_OVERFLOW_WORD /* Warn if a .word value is too large when treated as a signed number. We already know it is not too negative. This is to |