RFA: Patch for PR gas/12715 incorrect encoding of 64-bit immediates for ARM targets
Matthew Gretton-Dann
matthew.gretton-dann@arm.com
Wed May 11 16:29:00 GMT 2011
All,
PR gas/12715 shows a bug in gas when assembling 64-bit immediates on an
ARM target when gas has been configured for a 32-bit host, and with
support multiple targets at least one of which is a 64-bit target.
The issue is here in gas/config/tc-arm.c, parse_big_immediate:
/* If we're on a 64-bit host, then a 64-bit number can be returned
using
O_constant. We have to be careful not to break compilation for
32-bit X_add_number, though. */
if ((exp.X_add_number & ~0xffffffffl) != 0)
...
On a 32-bit host with a 64-bit target exp.X_add_number is (ultimately)
of type BFD_HOST_64_BIT. In this parser has stored the whole 64-bit
immediate in exp.X_add_number - not (as in the case when on a 32-bit
host with a 32-bit target) as a bignum.
In this case the if test above always fails, as 0xffffffffl is treated
as a 32-bit integer, so the bitwise inverse is 0, and so the test can
never be true. And so the 64-bit immediate gets its top 32-bits set to
zero.
The fix is to make sure the constant is of the correct type before doing
the bitwise inverse.
I have tested this on an x86-64 host with the following configuration
options:
* --target=arm-none-eabi
* --target=arm-none-eabi --enable-targets=all
* --target=arm-none-eabi CFLAGS=-m32
* --target=arm-none-eabi --enable-targets=all CFLAGS=-m32
Is this okay for trunk and the 2.21 branch?
Thanks,
Matt
gas/ChangeLog:
2011-05-11 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
PR gas/12715
* config/tc-arm.c (parse_big_immediate): Fix parsing of 64-bit
immediates on 32-bit hosts.
gas/testsuite/ChangeLog:
2011-05-11 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
PR gas/12715
* gas/arm/neon-const.s: Add testcase for 64-bit Neon constants.
* gas/arm/neon-const.d: Likewise.
--
Matthew Gretton-Dann
Principal Engineer - PDSW Tools
ARM Ltd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1105-vmov-immediate.patch
Type: text/x-patch
Size: 1506 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20110511/af2b15b4/attachment.bin>
More information about the Binutils
mailing list