[prev in list] [next in list] [prev in thread] [next in thread] 

List:       binutils
Subject:    Re: [PATCH][ARM] Fix handling of GOT_PREL in gas.
From:       <dougkwan () google ! com>
Date:       2010-09-27 21:44:21
Message-ID: AANLkTim8gFFS_=oEJzEFz5CNmr-3EHrdnsdCxy90TA3- () mail ! gmail ! com
[Download RAW message or body]

gas handles your test case without no problems because i and . are in
the same section.  This fails on powerpc as well.

        .section        .text.i,"x"
i:
        .long   0

        .section        .text.j,"x"
j:
        .long   i + (. - (.LPIC0 + 4))
        .long   0
.LPIC0:

$ ../obj/gas/as-new fwdexp.s
fwdexp.s: Assembler messages:
fwdexp.s:7: Error: operation combines symbols in different segments

=A6b 2010=A6~9=A4=EB16=A4=E9=A4W=A4=C83:12=A1AAlan Modra <amodra@gmail.com>=
 =BCg=B9D=A1G
> On Thu, Sep 16, 2010 at 10:24:57AM +0100, Richard Earnshaw wrote:
>> On Thu, 2010-09-16 at 01:44 -0700, Doug Kwan (=C3=F6=AE=B6=BCw) wrote:
>> > Hi
>> >
>> >    This patch fixes a problem in which gas fails to assemble data
>> > expression in the form:
>> >
>> >     symbol(GOT_PREL) + (. - (.LPIC0 + 4))
>> >
>> > where .LPIC0 is a local label defined in the same function after the
>> > data expression.  Currently, LPIC0 is undefined when the data
>> > expression is processed and that causes an error in the function
>> > expr() because the two operands of the addition have different
>> > segments.
> [snip]
>>
>> This really sounds to me like something that should be handled in a more
>> generic way than a special-case hack in the back-end.
>
> Other targets don't have a problem assembling expressions like this.
>
> $ cat /src/tmp/fwdexp.s
>  .text
>  .long i + (. - (.LPIC0+4))
>  .long 0
> .LPIC0:
> $ gas/as-new /src/tmp/fwdexp.s
> $ binutils/objdump -dr a.out
>
> a.out:     file format elf32-powerpc
>
>
> Disassembly of section .text:
>
> 00000000 <.text>:
>   0:   ff ff ff f4     .long 0xfffffff4
>                        0: R_PPC_ADDR32 i+0xfffffff4
>   4:   00 00 00 00     .long 0x0
>
> --
> Alan Modra
> Australia Development Lab, IBM
>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic