Hi Michael,

I'm not working on ARM, but on MIPS. Your problem is certainly different from 
mine. 


Hi Daniel,

I've tried out "gcc version 4.6.3 (Sourcery CodeBench Lite 2012.03-63)", and 
this version initialize gp register properly. 

Thanks,
Justin

________________________________________
From: Michael Cashwell [[email protected]]
Sent: Tuesday, February 26, 2013 11:44 AM
To: Juhyun (Justin) Oh
Cc: Daniel Schwierzeck; [email protected]
Subject: Re: [U-Boot] [u-boot-mips] gp init and -pie option

Not to hijack this thread, but I've had trouble with recent (2013.01 and 
perhaps the last 2012) mainline u-boots for Pandaboard when built using recent 
Codesourcery Lite tools. I've found that arm-2009q1 and arm-2010q1 work but 
arm-2012.03 and arm-2012.09 do not. SPL works but u-boot hangs very early.

It's on my list of things to look into.

-Michael Cashwell

On Feb 26, 2013, at 1:12 PM, "Juhyun (Justin) Oh" <[email protected]> 
wrote:

> HI Daniel,
>
> I'm using CodeSourcery 4.5.2. I've configured and have built the code for 
> "incaip" board and "dbau1000". The results are the same. (i.e. gp has been 
> set with wrong value)
>
> Could you tell me the CodeSourcery toolchain versions known to be working? 
> I'd like to try out the same version.
>
> Thanks,
> Justin
>
> ________________________________________
> From: Daniel Schwierzeck [[email protected]]
> Sent: Tuesday, February 26, 2013 1:52 AM
> To: Juhyun (Justin) Oh
> Cc: [email protected]
> Subject: Re: [U-Boot] [u-boot-mips] gp init and -pie option
>
> 2013/2/25 Juhyun (Justin) Oh <[email protected]>:
>> Hi,
>>
>> I got a problem while I was trying out v2013.01.01 on the u-boot-mips fork 
>> repo. It looks like my u-boot binary built with "-pie" linker option doesn't 
>> work due to wrong "gp" initialization.
>>
>> In the "start.S" file, the gp is supposed to be initialized with "_gp" 
>> because ra will hold the address of ".word _gp" line. The below is part of 
>> "start.S".
>>
>> ----------------------------
>> ...
>>    /* Initialize $gp */
>>    bal 1f
>>     nop
>>    .word   _gp
>> 1:
>>    lw  gp, 0(ra)
>> ...
>> ----------------------------
>>
>> Without the -pie option, linker puts the start address of the .got section. 
>> However, with -pie option, the ".word _gp" is translated to "nop". The below 
>> is disassembled code.
>>
>> ----------------------------------------------------------------------------
>> 84001490 <reset>:
>> ...
>> 840014b8:   40804800    mtc0    zero,c0_count
>> 840014bc:   40805800    mtc0    zero,c0_compare
>> 840014c0:   04110002    bal 840014cc <reset+0x3c>
>> 840014c4:   00000000    nop
>> 840014c8:   00000000    nop <---------------
>> 840014cc:   8ffc0000    lw  gp,0(ra)
>> 840014d0:   3c1d8440    lui sp,0x8440
>> 840014d4:   8f9982c0    lw  t9,-32064(gp)
>> 840014d8:   03200008    jr  t9
>> 840014dc:   00000000    nop
>> ----------------------------------------------------------------------------
>>
>> Could anyone tell me what is going on here? Am I missing anything?
>>
>> Thanks,
>> Justin
>
> which board and toolchain do you use?
>
> PIE support has been tested with various toolchains from ELDK,
> CodeSourcery and OpenWRT.
>
> --
> Best regards,
> Daniel
> _______________________________________________
> U-Boot mailing list
> [email protected]
> http://lists.denx.de/mailman/listinfo/u-boot

_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to