This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][GAS/ARM] Better handling of difference between a symbol and an undefined symbol.


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
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]