aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2001-05-08 18:03:27 +0000
committerAndreas Schwab <schwab@linux-m68k.org>2001-05-08 18:03:27 +0000
commit8390138c6bd7b78827ebc79a56f65df402df7ecc (patch)
treea06b65722f6874692b06623479f469a8b30750c8
parent8e191bd38c2b1af169a1feef527753fb9791706a (diff)
downloadgdb-8390138c6bd7b78827ebc79a56f65df402df7ecc.zip
gdb-8390138c6bd7b78827ebc79a56f65df402df7ecc.tar.gz
gdb-8390138c6bd7b78827ebc79a56f65df402df7ecc.tar.bz2
* config/tc-m68k.c: Instead of replacing -1 by 64 in assignment to
fx_pcrel_adjust explicitly sign extend when reading it.
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-m68k.c17
2 files changed, 12 insertions, 10 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index d2c4441..a441aa8 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2001-05-08 Andreas Schwab <schwab@suse.de>
+
+ * config/tc-m68k.c: Instead of replacing -1 by 64 in assignment to
+ fx_pcrel_adjust explicitly sign extend when reading it.
+
2001-05-08 Alan Modra <amodra@one.net.au>
* config/tc-m68k.c (md_estimate_size_before_relax): Set fr_var
diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c
index a755285..8451c2f 100644
--- a/gas/config/tc-m68k.c
+++ b/gas/config/tc-m68k.c
@@ -968,8 +968,9 @@ tc_gen_reloc (section, fixp)
reloc->addend = fixp->fx_addnumber;
else
reloc->addend = (section->vma
- + (fixp->fx_pcrel_adjust == 64
- ? -1 : fixp->fx_pcrel_adjust)
+ /* Explicit sign extension in case char is
+ unsigned. */
+ + ((fixp->fx_pcrel_adjust & 0xff) ^ 0x80) - 0x80
+ fixp->fx_addnumber
+ md_pcrel_from (fixp));
#endif
@@ -2546,11 +2547,7 @@ m68k_ip (instring)
switch (s[1])
{
case 'B':
- /* The pc_fix argument winds up in fx_pcrel_adjust,
- which is a char, and may therefore be unsigned. We
- want to pass -1, but we pass 64 instead, and convert
- back in md_pcrel_from. */
- add_fix ('B', &opP->disp, 1, 64);
+ add_fix ('B', &opP->disp, 1, -1);
break;
case 'W':
add_fix ('w', &opP->disp, 1, 0);
@@ -7041,9 +7038,9 @@ md_pcrel_from (fixP)
{
int adjust;
- /* Because fx_pcrel_adjust is a char, and may be unsigned, we store
- -1 as 64. */
- adjust = fixP->fx_pcrel_adjust;
+ /* Because fx_pcrel_adjust is a char, and may be unsigned, we explicitly
+ sign extend the value here. */
+ adjust = ((fixP->fx_pcrel_adjust & 0xff) ^ 0x80) - 0x80;
if (adjust == 64)
adjust = -1;
return fixP->fx_where + fixP->fx_frag->fr_address - adjust;