aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2021-04-23 09:15:45 +0200
committerJan Beulich <jbeulich@suse.com>2021-04-23 09:15:45 +0200
commit7b025ee8c81312ea0c1a7fd44b7813f59df871ef (patch)
treefe73ddb6727cc8da6959b63802483308457df73f
parent0406545d0668c0d2900654a8ec65bdaf23d157c9 (diff)
downloadgdb-7b025ee8c81312ea0c1a7fd44b7813f59df871ef.zip
gdb-7b025ee8c81312ea0c1a7fd44b7813f59df871ef.tar.gz
gdb-7b025ee8c81312ea0c1a7fd44b7813f59df871ef.tar.bz2
x86: don't truncate values in diagnostics and alike
Truncating an expression's X_add_number to just "long" can result in confusing output (e.g. an apparently in-range number claimed to be out of range). Use the abstraction that bfd provides for this. Take the opportunity and also insert a missing "of".
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-i386.c8
2 files changed, 9 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index bada402..a820eab 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2021-04-23 Jan Beulich <jbeulich@suse.com>
+
+ * config/tc-i386.c (pe): Don't truncate expression value.
+ (i386_finalize_displacement): Likewise.
+
2021-04-21 Nick Clifton <nickc@redhat.com>
* testsuite/gas/aarch64/dwarf.d: Adjust expected output to allow
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index e49d0f5..007d774 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -3297,8 +3297,8 @@ static void
pe (expressionS *e)
{
fprintf (stdout, " operation %d\n", e->X_op);
- fprintf (stdout, " add_number %ld (%lx)\n",
- (long) e->X_add_number, (long) e->X_add_number);
+ fprintf (stdout, " add_number %" BFD_VMA_FMT "d (%" BFD_VMA_FMT "x)\n",
+ e->X_add_number, e->X_add_number);
if (e->X_add_symbol)
{
fprintf (stdout, " add_symbol ");
@@ -10922,8 +10922,8 @@ i386_finalize_displacement (segT exp_seg ATTRIBUTE_UNUSED, expressionS *exp,
i.types[this_operand].bitfield.disp32s = 0;
if (i.types[this_operand].bitfield.baseindex)
{
- as_bad (_("0x%lx out range of signed 32bit displacement"),
- (long) exp->X_add_number);
+ as_bad (_("0x%" BFD_VMA_FMT "x out of range of signed 32bit displacement"),
+ exp->X_add_number);
ret = 0;
}
}