Question on gas difference between 2.19.1 and 2.20

View: New views
5 Messages — Rating Filter:   Alert me  

Question on gas difference between 2.19.1 and 2.20

by Lluís Batlle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I have some excerpt (in u-boot 3.4.19 for the sheevaplug, an armv5te
platform) that did assemble in binutils 2.19.1, but not anymore in
2.20.

Here is the part of the code:
---------------Part of the file jump.S
...
jumpStart:

.section        ".reset_vector_sect",#alloc, #execinstr

        /* Check if we booted from DRAM. If we did someone already      */
        /* initialize the DRAM controller                               */

        adr     r4, jumpStart           /* r4 <- current position of
code   */ /* line 62 of the source file */
        mov     r5, #~0xff
        and     r4, r4, r5
-------------

Assembling with binutils 2.20 gas, I get:
jump.S:62: Error: symbol .text is in a different section

Does anybody understand this behaviour? Maybe I am doing something
wrong? I don't understand the meaning of that message in this context.

Thank you in advance,
Lluís.

Re: Question on gas difference between 2.19.1 and 2.20

by Daniel Jacobowitz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 03, 2009 at 08:24:38PM +0100, Lluís Batlle wrote:
> Hello,
>
> I have some excerpt (in u-boot 3.4.19 for the sheevaplug, an armv5te
> platform) that did assemble in binutils 2.19.1, but not anymore in
> 2.20.

What did it assembel to in 2.19.1?  Could you show me some objdump -dr
output?

--
Daniel Jacobowitz
CodeSourcery

Re: Question on gas difference between 2.19.1 and 2.20

by Phil Blundell :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2009-11-03 at 20:24 +0100, Lluís Batlle wrote:

> jumpStart:
>
> .section        ".reset_vector_sect",#alloc, #execinstr
>
>         /* Check if we booted from DRAM. If we did someone already      */
>         /* initialize the DRAM controller                               */
>
>         adr     r4, jumpStart           /* r4 <- current position of
> code   */ /* line 62 of the source file */
>         mov     r5, #~0xff

> Assembling with binutils 2.20 gas, I get:
> jump.S:62: Error: symbol .text is in a different section
>
> Does anybody understand this behaviour? Maybe I am doing something
> wrong? I don't understand the meaning of that message in this context.

I am rather surprised that binutils 2.19.1 accepted this code.  What
output did it produce?

The "adr" pseudo-op is (approximately) an assembler shorthand for "add
rN, pc, #(dest - .)", i.e. it assembles to an arithmetic operation with
an immediate operand.  Using adr across sections is possible in theory,
albeit with restrictions, but I don't think either GAS nor GNU ld
understand the relocation types that you would need to make it work.

p.



Re: Question on gas difference between 2.19.1 and 2.20

by Lluís Batlle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here I attach the result of the assembly with binutils 2.19.1.

For the "objdump -S" of the related part:
Disassembly of section .reset_vector_sect:

00000000 <romBoot-0x3c>:
#endif

        /* Check if we booted from DRAM. If we did someone already      */
        /* initialize the DRAM controller                               */

        adr     r4, jumpStart           /* r4 <- current position of code   */
   0:   e24f4008        sub     r4, pc, #8      ; 0x8
        mov     r5, #~0xff
   4:   e3e050ff        mvn     r5, #255        ; 0xff
        and     r4, r4, r5
   8:   e0044005        and     r4, r4, r5
    nop
    nop
/* End of code load */
#endif /* MV78XX0 */

Moving the label below the '.section' solved my assembly problems in 2.20.

Regards,
Lluís.

2009/11/3 Phil Blundell <pb@...>:

> On Tue, 2009-11-03 at 20:24 +0100, Lluís Batlle wrote:
>> jumpStart:
>>
>> .section        ".reset_vector_sect",#alloc, #execinstr
>>
>>         /* Check if we booted from DRAM. If we did someone already      */
>>         /* initialize the DRAM controller                               */
>>
>>         adr     r4, jumpStart           /* r4 <- current position of
>> code   */ /* line 62 of the source file */
>>         mov     r5, #~0xff
>
>> Assembling with binutils 2.20 gas, I get:
>> jump.S:62: Error: symbol .text is in a different section
>>
>> Does anybody understand this behaviour? Maybe I am doing something
>> wrong? I don't understand the meaning of that message in this context.
>
> I am rather surprised that binutils 2.19.1 accepted this code.  What
> output did it produce?
>
> The "adr" pseudo-op is (approximately) an assembler shorthand for "add
> rN, pc, #(dest - .)", i.e. it assembles to an arithmetic operation with
> an immediate operand.  Using adr across sections is possible in theory,
> albeit with restrictions, but I don't think either GAS nor GNU ld
> understand the relocation types that you would need to make it work.
>
> p.
>
>
>


jump.o (7K) Download Attachment

Re: Question on gas difference between 2.19.1 and 2.20

by Daniel Jacobowitz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 03, 2009 at 10:33:25PM +0100, Lluís Batlle wrote:
> Moving the label below the '.section' solved my assembly problems in 2.20.

Oh, I completely missed that in your code!  Yes, that's the right
thing to do.

--
Daniel Jacobowitz
CodeSourcery