[U-Boot] [u-boot-mips] gp init and -pie option

Jason Harris jason.harris at motorolasolutions.com
Sat May 18 01:01:52 CEST 2013








Daniel Schwierzeck <daniel.schwierzeck <at> gmail.com> writes:

> 
> Hi,
> 
> 2013/2/26 Juhyun (Justin) Oh <Juhyun_Oh <at> sigmadesigns.com>:
> > 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.
> >
> Which CodeSourcery release do you use?
> 
> I have tried following toolchains and all of them have _gp initialized
> correctly.
> 
> Sourcery CodeBench Lite 2011.09-75
>   gcc version 4.5.2 (Sourcery CodeBench Lite 2011.09-75)
>   GNU ld (Sourcery CodeBench Lite 2011.09-75) 2.21.53.20110905
> 
> Sourcery CodeBench Lite 2012.03-63:
>   gcc version 4.6.3 (Sourcery CodeBench Lite 2012.03-63)
>   GNU ld (Sourcery CodeBench Lite 2012.03-63) 2.21.53.20110905
> 
> ELDK-5.2.1:
>   gcc version 4.6.4 20120303 (prerelease) (GCC)
>   GNU ld (GNU Binutils) 2.22
> 
> ELDK-5.3:
>   gcc version 4.7.2 (GCC)
>   GNU ld (GNU Binutils) 2.22
> 


mips-u24kc-linux-gnu-ld --version
GNU ld (GNU Binutils) 2.18

--help ....

  -pie, --pic-executable      Create a position independent executable

I've observed:

with -pie:

800004c0 04110002: bgezal  r0, 0x2L (=2) -> 0x00000000800004cc
800004c4 00000000: nop
800004c8 00000000: nop
800004cc 8ffc0000: lw      r28, 0x0L (=0) (r31)

wrong: _gp = 0

with --pic-executable:

800004c0 04110002: bgezal  r0, 0x2L (=2) -> 0x00000000800004cc
800004c4 00000000: nop
800004c8 800372c0: lb      r3, 0x72c0L (=29376) (r0)
800004cc 8ffc0000: lw      r28, 0x0L (=0) (r31)

correct: _gp = 800372c0

Looks like something is wrong with option processing on ld.







More information about the U-Boot mailing list