This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: 'broken words' misbehavior?
>>> Hans-Peter Nilsson <hp@bitrange.com> 22.02.07 13:40 >>>
>On Thu, 22 Feb 2007, Jan Beulich wrote:
>> This piece of code
>>
>> .data
>> table:
>> .org table + 8
>> end:
>> .word end - table + 0x8000
>>
>> .text
>> start:
>> ret
>>
>> causes two jumps (a short and a long one) to be inserted right before 'start'
>> (i386 or x86-64). While I understand that this is caused by the logic dealing
>> with 'broken words', I can neither see what's wrong (or even in need of
>> special treatment) with the code above,
>
>(int16_t) (end - table + 0x8000) != (int32_t) (end - table + 0x8000)
Sure, but in the given case I want them (and know they are) unsigned.
>> nor do I understand what these
>> jumps are supposed to help with (in general, and even more in the given
>> case, where there isn't any code needing fixing up).
>
>It's a gas "feature" to help dealing with case tables (from gcc)
>that overflow. Suggested reading: write.c:2011.
A feature that causes valid code to break... And yes, I looked (should I say
stared) at this code (in dis-belief).
>> Also, I don't have an idea how to work around it in the general case (older
>> assemblers also choke on .skip or .fill instead of .org, but that seems to
>> have gone with the improvements to expression evaluation, so for
>> compatibility reasons I can't use either of those).
>
>Your target (you don't say, but presumably i386/x86_64) should
>"#define WORKING_DOT_WORD". Almost all targets do that. Does
>that target *really* (still?) need this feature?
Yes, x86 (in fact I did say that). I have no idea why it doesn't define this,
and am hardly in the position (not knowing why it's the way it is) to request
it being changed.
>If you instead decide to hack^Wfix this feature, there are
>test-cases in the cris testsuite, cris-axis-elf. The feature is
>not ready for removal, yet.
I didn't want to suggest removing the feature either, but wanted to get
an understanding what it's supposed to deal with and in turn whether the
breakage is fixable.
Jan