This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH][GAS/ARM] Better handling of difference between a symbol and an undefined symbol.
- From: =?big5?b?RG91ZyBLd2FuICjD9q62vHcp?= <dougkwan at google dot com>
- To: Dave Korn <dave dot korn dot cygwin at gmail dot com>
- Cc: binutils <binutils at sourceware dot org>, Richard Earnshaw <rearnsha at arm dot com>, Nick Clifton <nickc at redhat dot com>
- Date: Mon, 27 Sep 2010 16:53:37 -0700
- Subject: Re: [PATCH][GAS/ARM] Better handling of difference between a symbol and an undefined symbol.
- References: <AANLkTimk7gM-4et8UwjUPn28f0qn6L05RrS=GkEw2GE_@mail.gmail.com> <4CA132F7.8020803@gmail.com>
Absolutely, I would like to use something like:
.section .data.i,"a"
i:
.long 0
.section .data.j,"a"
j:
.long i - (. - .L1)
.L1:
The problem is that I cannot guarantee that it assembles for all
targets. Is there a good way to test that?
在 2010年9月27日下午5:12,Dave Korn <dave.korn.cygwin@gmail.com> 寫道:
> On 27/09/2010 22:37, Doug Kwan (關振德) wrote:
>
>> The problem with the above code is that .L1 in "i - (. - L1)" is a
>> forward reference. The current code in expr() evaluate this to
>> something belonging to section .data.j, That causes a subsequent
>> failure in segment check because i is defined in another section.
>
> This is a generically useful fix, so sorry if I'm being picky, but ..
>
>> gas/ChangeLog:
>> 2010-09-27 Doug Kwan
>>
>> * expr.c (expr): Handle difference between a symbol and an undefined
>> symbol specially.
>>
>> gas/testsuite/ChangeLog:
>>
>> 2010-09-27 Doug Kwan
>>
>> * gas/arm/got_prel2.d: New.
>> * gas/arm/got_prel2.s: New.
>
> ... the code changes behaviour for all targets, but the tests run only on ARM.
> Would it be possible to make a more generic test, perhaps based on the
> example you quoted at the beginning of your email that only uses .section and
> .long directives, without any target-specific opcodes in it?
>
> cheers,
> DaveK
>
>