[PATCH, ARM] Fix out-of-range immediate assembly errors on 64-bit hosts
Julian Brown
julian@codesourcery.com
Wed Sep 6 13:27:00 GMT 2006
Hi,
Nick Clifton wrote:
> Hi Julian,
>
>> I think it'd probably work, but maybe it'd be better to add a
>> bounds-checked/non-bounds-checked argument to parse_immediate() or
>> write a non-bounds-checking version of the function instead?
>
> I think that this would be the best solution. It makes the meaning of
> the arguments passed to parse_immediate more obvious.
[...]
>
>>> I am a little bit confused here. How is ((x >> 16) >> 16) different
>>> from (x >> 32) ? If not, then why express it that way ?
>>
>> If sizeof(exp.X_add_number)==4 (i.e. on 32-bit hosts), then I think
>> that writing (x >> 32) is invalid C (which isn't very nice, even if
>> that code would never be executed).
> [...] Or just have the comment in the code.
Here's a (rather belated) new version of the patch which adds
bounds-checking and non-bounds-checking forms to parse_immediate,
avoiding the previous nastiness with INT_MIN/INT_MAX.
Tested with "make check" on x86 and x86_64 with cross to arm-none-eabi.
OK? (for mainline? CSL branch?)
Cheers,
Julian
ChangeLog
gas/
* config/tc-arm.c (parse_immediate): Add BOUNDED parameter, rename
to...
(parse_immediate_maybe_bounded): This. Only bounds-check if BOUNDED
is true.
(parse_immediate_bounded): New function, with same arguments and
semantics as previous parse_immediate.
(parse_immediate_unbounded): New function. Parse an unbounded
integer (with sizeof (exp.X_add_number)).
(parse_big_immediate): Allow for 64-bit exp.X_add_number when
parsing 64-bit immediates.
(parse_address_main): Use parse_immediate_bounded not
parse_immediate.
(parse_ror): Likewise.
(parse_operands): Likewise. For Neon immediates, use
parse_immediate_unbounded. Add new local po_imm_unb_or_fail macro.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: neon-asm-64bit-host-3
URL: <https://sourceware.org/pipermail/binutils/attachments/20060906/61f04b78/attachment.ksh>
More information about the Binutils
mailing list