diff options
author | Jan Beulich <jbeulich@suse.com> | 2022-03-21 15:13:35 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2022-03-21 15:13:35 +0100 |
commit | 46fb6d5aa27d7129f472729a4f7ab8aa103aa674 (patch) | |
tree | 4a08cc0a23186e11ecc4132979ea558f2fc36f8b | |
parent | 4b19214f7920a4dbb7acf42a4da667600d23bd6a (diff) | |
download | gdb-46fb6d5aa27d7129f472729a4f7ab8aa103aa674.zip gdb-46fb6d5aa27d7129f472729a4f7ab8aa103aa674.tar.gz gdb-46fb6d5aa27d7129f472729a4f7ab8aa103aa674.tar.bz2 |
x86: don't suppress overflow diagnostics in x32 mode
Unlike in 64-bit mode, where values wrap at the 64-bit boundary anyway,
there's no wrapping at the 32-bit boundary here, and hence overflow
detection shouldn't be suppressed just because rela relocations are
going to be used.
The extra check against NO_RELOC is actually a result of an ilp32 test
otherwise failing. But thinking about it, reporting overflows for
not-really-relocations (typically because of earlier errors) makes
little sense in general. Perhaps this should even be extended to non-
64-bit modes.
-rw-r--r-- | gas/config/tc-i386.c | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/ilp32/reloc64.l | 13 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/ilp32/reloc64.s | 15 |
3 files changed, 30 insertions, 1 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 83975c3..afb8b70 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -12769,7 +12769,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) #endif else if (use_rela_relocations) { - fixP->fx_no_overflow = 1; + if (!disallow_64bit_reloc || fixP->fx_r_type == NO_RELOC) + fixP->fx_no_overflow = 1; /* Remember value for tc_gen_reloc. */ fixP->fx_addnumber = value; value = 0; diff --git a/gas/testsuite/gas/i386/ilp32/reloc64.l b/gas/testsuite/gas/i386/ilp32/reloc64.l index 7a1808e..9643e67 100644 --- a/gas/testsuite/gas/i386/ilp32/reloc64.l +++ b/gas/testsuite/gas/i386/ilp32/reloc64.l @@ -52,3 +52,16 @@ .*:176: Error: .* .*:177: Error: .* .*:189: Error: .* +.*:192: Error: .* too large for field of 4 bytes at .* +.*:193: Error: .* too large for field of 4 bytes at .* +.*:194: Error: .* too large for field of 4 bytes at .* +.*:195: Error: .* too large for field of 4 bytes at .* +.*:196: Error: .* too large for field of 2 bytes at .* +.*:196: Error: .* too large for field of 1 byte at .* +.*:197: Error: .* too large for field of 2 bytes at .* +.*:197: Error: .* too large for field of 1 byte at .* +.*:200: Error: .* too large for field of 4 bytes at .* +.*:201: Error: .* too large for field of 2 bytes at .* +.*:202: Error: .* too large for field of 2 bytes at .* +.*:203: Error: .* too large for field of 1 byte at .* +.*:204: Error: .* too large for field of 1 byte at .* diff --git a/gas/testsuite/gas/i386/ilp32/reloc64.s b/gas/testsuite/gas/i386/ilp32/reloc64.s index 3ab25ef..9f5990a 100644 --- a/gas/testsuite/gas/i386/ilp32/reloc64.s +++ b/gas/testsuite/gas/i386/ilp32/reloc64.s @@ -187,3 +187,18 @@ bad .byte xtrn@tpoff .long xtrn@got - 4 .long xtrn@got + 4 bad .long xtrn@plt - . + + .text +bad add $x+0x123456789, %rax +bad add $x+0x123456789, %eax +bad add x+0x123456789, %eax +bad add x+0x123456789(%eax), %eax +bad enter $x+0x123456789, $x+0x123456789 +bad enter $x+0x12345, $x+0x123 + + .data +bad .long x+0x123456789 +bad .word x+0x123456789 +bad .word x+0x12345 +bad .byte x+0x123456789 +bad .byte x+0x123 |