* [U-Boot] [u-boot-mips] gp init and -pie option
@ 2013-02-25 19:53 Juhyun Oh
2013-02-26 9:52 ` Daniel Schwierzeck
0 siblings, 1 reply; 9+ messages in thread
From: Juhyun Oh @ 2013-02-25 19:53 UTC (permalink / raw)
To: u-boot
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [u-boot-mips] gp init and -pie option
2013-02-25 19:53 [U-Boot] [u-boot-mips] gp init and -pie option Juhyun Oh
@ 2013-02-26 9:52 ` Daniel Schwierzeck
2013-02-26 18:12 ` Juhyun Oh
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Schwierzeck @ 2013-02-26 9:52 UTC (permalink / raw)
To: u-boot
2013/2/25 Juhyun (Justin) Oh <Juhyun_Oh@sigmadesigns.com>:
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [u-boot-mips] gp init and -pie option
2013-02-26 9:52 ` Daniel Schwierzeck
@ 2013-02-26 18:12 ` Juhyun Oh
2013-02-26 19:44 ` Michael Cashwell
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Juhyun Oh @ 2013-02-26 18:12 UTC (permalink / raw)
To: u-boot
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 [daniel.schwierzeck at gmail.com]
Sent: Tuesday, February 26, 2013 1:52 AM
To: Juhyun (Justin) Oh
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [u-boot-mips] gp init and -pie option
2013/2/25 Juhyun (Justin) Oh <Juhyun_Oh@sigmadesigns.com>:
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [u-boot-mips] gp init and -pie option
2013-02-26 18:12 ` Juhyun Oh
@ 2013-02-26 19:44 ` Michael Cashwell
2013-02-26 19:54 ` Juhyun Oh
2013-02-26 20:34 ` Daniel Schwierzeck
[not found] ` <CACUy@mail.gmail.com>
2 siblings, 1 reply; 9+ messages in thread
From: Michael Cashwell @ 2013-02-26 19:44 UTC (permalink / raw)
To: u-boot
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" <Juhyun_Oh@sigmadesigns.com> 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 [daniel.schwierzeck at gmail.com]
> Sent: Tuesday, February 26, 2013 1:52 AM
> To: Juhyun (Justin) Oh
> Cc: u-boot at lists.denx.de
> Subject: Re: [U-Boot] [u-boot-mips] gp init and -pie option
>
> 2013/2/25 Juhyun (Justin) Oh <Juhyun_Oh@sigmadesigns.com>:
>> 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
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [u-boot-mips] gp init and -pie option
2013-02-26 19:44 ` Michael Cashwell
@ 2013-02-26 19:54 ` Juhyun Oh
0 siblings, 0 replies; 9+ messages in thread
From: Juhyun Oh @ 2013-02-26 19:54 UTC (permalink / raw)
To: u-boot
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 [mboards at prograde.net]
Sent: Tuesday, February 26, 2013 11:44 AM
To: Juhyun (Justin) Oh
Cc: Daniel Schwierzeck; u-boot at lists.denx.de
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" <Juhyun_Oh@sigmadesigns.com> 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 [daniel.schwierzeck at gmail.com]
> Sent: Tuesday, February 26, 2013 1:52 AM
> To: Juhyun (Justin) Oh
> Cc: u-boot at lists.denx.de
> Subject: Re: [U-Boot] [u-boot-mips] gp init and -pie option
>
> 2013/2/25 Juhyun (Justin) Oh <Juhyun_Oh@sigmadesigns.com>:
>> 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
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [u-boot-mips] gp init and -pie option
2013-02-26 18:12 ` Juhyun Oh
2013-02-26 19:44 ` Michael Cashwell
@ 2013-02-26 20:34 ` Daniel Schwierzeck
2013-02-26 21:49 ` Juhyun Oh
[not found] ` <CACUy@mail.gmail.com>
2 siblings, 1 reply; 9+ messages in thread
From: Daniel Schwierzeck @ 2013-02-26 20:34 UTC (permalink / raw)
To: u-boot
Hi,
2013/2/26 Juhyun (Justin) Oh <Juhyun_Oh@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
--
Best regards,
Daniel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [u-boot-mips] gp init and -pie option
2013-02-26 20:34 ` Daniel Schwierzeck
@ 2013-02-26 21:49 ` Juhyun Oh
0 siblings, 0 replies; 9+ messages in thread
From: Juhyun Oh @ 2013-02-26 21:49 UTC (permalink / raw)
To: u-boot
Hi Daniel,
I've verified that the CodeSourcery 4.5.2 and 4.6.3 generate the correct _gp as you mentioned.
Thanks,
Justin
________________________________________
From: Daniel Schwierzeck [daniel.schwierzeck at gmail.com]
Sent: Tuesday, February 26, 2013 12:34 PM
To: Juhyun (Justin) Oh
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [u-boot-mips] gp init and -pie option
Hi,
2013/2/26 Juhyun (Justin) Oh <Juhyun_Oh@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
--
Best regards,
Daniel
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [u-boot-mips] gp init and -pie option
[not found] ` <CACUy@mail.gmail.com>
@ 2013-05-17 23:01 ` Jason Harris
2013-05-22 23:53 ` Jason Harris
0 siblings, 1 reply; 9+ messages in thread
From: Jason Harris @ 2013-05-17 23:01 UTC (permalink / raw)
To: u-boot
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [U-Boot] [u-boot-mips] gp init and -pie option
2013-05-17 23:01 ` Jason Harris
@ 2013-05-22 23:53 ` Jason Harris
0 siblings, 0 replies; 9+ messages in thread
From: Jason Harris @ 2013-05-22 23:53 UTC (permalink / raw)
To: u-boot
Jason Harris <jason.harris <at> motorolasolutions.com> writes:
>
> Looks like something is wrong with option processing on ld.
>
I take it back:
The patch from http://sourceware.org/bugzilla/show_bug.cgi?id=10858
fixes it.
Jason H.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-05-22 23:53 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-25 19:53 [U-Boot] [u-boot-mips] gp init and -pie option Juhyun Oh
2013-02-26 9:52 ` Daniel Schwierzeck
2013-02-26 18:12 ` Juhyun Oh
2013-02-26 19:44 ` Michael Cashwell
2013-02-26 19:54 ` Juhyun Oh
2013-02-26 20:34 ` Daniel Schwierzeck
2013-02-26 21:49 ` Juhyun Oh
[not found] ` <CACUy@mail.gmail.com>
2013-05-17 23:01 ` Jason Harris
2013-05-22 23:53 ` Jason Harris
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.