diff mbox

[U-Boot] ARM: fix broken build of ARM

Message ID 1296144229-22579-1-git-send-email-sbabic@denx.de
State Accepted
Commit a4594e41b907f60c85ed1cf96b65602f6b587a50
Delegated to: Albert ARIBAUD
Headers show

Commit Message

Stefano Babic Jan. 27, 2011, 4:03 p.m. UTC
Commit 8aba9dceebb14144e07d19593111ee3a999c37fc breaks
ARM boards because for ARM the -pie option is used
for partial linking together with -r option.

The patch adds the -pie option to link u-boot.bin only.

Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Jason Liu <liu.h.jason@gmail.com>
CC: lool@dooz.org
CC: Wolfgang Denk <wd@denx.de>
CC: Albert Aribaud <albert.aribaud@free.fr>

---
 arch/arm/config.mk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Alexander Holler Jan. 27, 2011, 7:42 p.m. UTC | #1
Hello,

Am 27.01.2011 17:03, schrieb Stefano Babic:
> Commit 8aba9dceebb14144e07d19593111ee3a999c37fc breaks
> ARM boards because for ARM the -pie option is used
> for partial linking together with -r option.
>
> The patch adds the -pie option to link u-boot.bin only.

Using native compilation with gcc 4.5.2 and binutils 2.21 this patch 
will result in an unusable u-boot. It halts here after DRAM: ... just 
like it was before some relocation fixes (regarding binutils).

Regards,

Alexander
Albert ARIBAUD Jan. 27, 2011, 8:20 p.m. UTC | #2
Hi Alexander,

Le 27/01/2011 20:42, Alexander Holler a écrit :
> Hello,
>
> Am 27.01.2011 17:03, schrieb Stefano Babic:
>> Commit 8aba9dceebb14144e07d19593111ee3a999c37fc breaks
>> ARM boards because for ARM the -pie option is used
>> for partial linking together with -r option.
>>
>> The patch adds the -pie option to link u-boot.bin only.
>
> Using native compilation with gcc 4.5.2 and binutils 2.21 this patch
> will result in an unusable u-boot. It halts here after DRAM: ... just
> like it was before some relocation fixes (regarding binutils).

Which board do you compile?

> Regards,
>
> Alexander

Amicalement,
Alexander Holler Jan. 27, 2011, 8:55 p.m. UTC | #3
Am 27.01.2011 21:20, schrieb Albert ARIBAUD:
> Hi Alexander,
>
> Le 27/01/2011 20:42, Alexander Holler a écrit :
>> Hello,
>>
>> Am 27.01.2011 17:03, schrieb Stefano Babic:
>>> Commit 8aba9dceebb14144e07d19593111ee3a999c37fc breaks
>>> ARM boards because for ARM the -pie option is used
>>> for partial linking together with -r option.
>>>
>>> The patch adds the -pie option to link u-boot.bin only.
>>
>> Using native compilation with gcc 4.5.2 and binutils 2.21 this patch
>> will result in an unusable u-boot. It halts here after DRAM: ... just
>> like it was before some relocation fixes (regarding binutils).
>
> Which board do you compile?

Upps, sorry, that one was on a BeagleBoard (armv7, omap3).

Regards,

Alexander
Albert ARIBAUD Jan. 27, 2011, 9:10 p.m. UTC | #4
Le 27/01/2011 21:55, Alexander Holler a écrit :
> Am 27.01.2011 21:20, schrieb Albert ARIBAUD:
>> Hi Alexander,
>>
>> Le 27/01/2011 20:42, Alexander Holler a écrit :
>>> Hello,
>>>
>>> Am 27.01.2011 17:03, schrieb Stefano Babic:
>>>> Commit 8aba9dceebb14144e07d19593111ee3a999c37fc breaks
>>>> ARM boards because for ARM the -pie option is used
>>>> for partial linking together with -r option.
>>>>
>>>> The patch adds the -pie option to link u-boot.bin only.
>>>
>>> Using native compilation with gcc 4.5.2 and binutils 2.21 this patch
>>> will result in an unusable u-boot. It halts here after DRAM: ... just
>>> like it was before some relocation fixes (regarding binutils).
>>
>> Which board do you compile?
>
> Upps, sorry, that one was on a BeagleBoard (armv7, omap3).

I've just tried the following to compare make logs of before commit 
8aba9dceebb14144e07d19593111ee3a999c37fc on the one hand and after this 
commit and with the proposed fix on the other hand:

git checkout 8aba9dceebb14144e07d19593111ee3a999c37fc^

(that's the commit just before the one which split LD_FLAGS)

make distclean ; make edminiv2_config; make > ~/old.txt 2>&1

git checkout 8aba9dceebb14144e07d19593111ee3a999c37fc

(that's the commit which split LD_FLAGS)

(replace "PLATFORM_LDFLAGS += -pie" with "LDFLAGS_u-boot += -pie" in 
arch/arm/config.mk)

make distclean ; make edminiv2_config; make > ~/new.txt 2>&1

(and finally)

kdiff3 ~/old.txt ~/new.txt

The only difference I see between the make logs is the relative location 
of the -pie option in the final ld invocation: in the 'old' case options go

	...  -Bstatic -T u-boot.lds  -pie -Ttext ...

whereas in the 'new' case, they go

	... -pie -Bstatic -T u-boot.lds  -Ttext ...

So I think the binary should be pretty much the same in the 'old' and 
'new' cases, and that should be irrespective of the tool chain.

Alexander, can you run the same test with your BeagleBoard and let me 
know of any differences?

> Regards,
>
> Alexander

Amicalement,
Wolfgang Denk Jan. 27, 2011, 9:14 p.m. UTC | #5
Dear Albert ARIBAUD,

In message <4D41DF41.4000708@free.fr> you wrote:
>
> So I think the binary should be pretty much the same in the 'old' and 
> 'new' cases, and that should be irrespective of the tool chain.
>
> Alexander, can you run the same test with your BeagleBoard and let me
> know of any differences?

Also running a diff over the System.map and u-boot.map files is
usually a good and easy test that images are identical.

Best regards,

Wolfgang Denk
Alexander Holler Jan. 27, 2011, 9:32 p.m. UTC | #6
Am 27.01.2011 22:10, schrieb Albert ARIBAUD:
> Le 27/01/2011 21:55, Alexander Holler a écrit :
>> Am 27.01.2011 21:20, schrieb Albert ARIBAUD:
>>> Hi Alexander,
>>>
>>> Le 27/01/2011 20:42, Alexander Holler a écrit :
>>>> Hello,
>>>>
>>>> Am 27.01.2011 17:03, schrieb Stefano Babic:
>>>>> Commit 8aba9dceebb14144e07d19593111ee3a999c37fc breaks
>>>>> ARM boards because for ARM the -pie option is used
>>>>> for partial linking together with -r option.
>>>>>
>>>>> The patch adds the -pie option to link u-boot.bin only.
>>>>
>>>> Using native compilation with gcc 4.5.2 and binutils 2.21 this patch
>>>> will result in an unusable u-boot. It halts here after DRAM: ... just
>>>> like it was before some relocation fixes (regarding binutils).
>>>
>>> Which board do you compile?
>>
>> Upps, sorry, that one was on a BeagleBoard (armv7, omap3).
>
> I've just tried the following to compare make logs of before commit
> 8aba9dceebb14144e07d19593111ee3a999c37fc on the one hand and after this
> commit and with the proposed fix on the other hand:

Oh, it seems I've got misunderstood, the patch from Stefano Babic breaks 
u-boot here and not the commit 8aba9dceebb14144e07d19593111ee3a999c37fc.

Regards,

Alexander
Albert ARIBAUD Jan. 27, 2011, 9:32 p.m. UTC | #7
Le 27/01/2011 22:14, Wolfgang Denk a écrit :
> Dear Albert ARIBAUD,
>
> In message<4D41DF41.4000708@free.fr>  you wrote:
>>
>> So I think the binary should be pretty much the same in the 'old' and
>> 'new' cases, and that should be irrespective of the tool chain.
>>
>> Alexander, can you run the same test with your BeagleBoard and let me
>> know of any differences?
>
> Also running a diff over the System.map and u-boot.map files is
> usually a good and easy test that images are identical.

Indeed -- my goal was to compare the build processes more than their 
products.

> Best regards,
>
> Wolfgang Denk

Amicalement,
Albert ARIBAUD Jan. 27, 2011, 9:40 p.m. UTC | #8
Le 27/01/2011 22:32, Alexander Holler a écrit :
> Am 27.01.2011 22:10, schrieb Albert ARIBAUD:
>> Le 27/01/2011 21:55, Alexander Holler a écrit :
>>> Am 27.01.2011 21:20, schrieb Albert ARIBAUD:
>>>> Hi Alexander,
>>>>
>>>> Le 27/01/2011 20:42, Alexander Holler a écrit :
>>>>> Hello,
>>>>>
>>>>> Am 27.01.2011 17:03, schrieb Stefano Babic:
>>>>>> Commit 8aba9dceebb14144e07d19593111ee3a999c37fc breaks
>>>>>> ARM boards because for ARM the -pie option is used
>>>>>> for partial linking together with -r option.
>>>>>>
>>>>>> The patch adds the -pie option to link u-boot.bin only.
>>>>>
>>>>> Using native compilation with gcc 4.5.2 and binutils 2.21 this patch
>>>>> will result in an unusable u-boot. It halts here after DRAM: ... just
>>>>> like it was before some relocation fixes (regarding binutils).
>>>>
>>>> Which board do you compile?
>>>
>>> Upps, sorry, that one was on a BeagleBoard (armv7, omap3).
>>
>> I've just tried the following to compare make logs of before commit
>> 8aba9dceebb14144e07d19593111ee3a999c37fc on the one hand and after this
>> commit and with the proposed fix on the other hand:
>
> Oh, it seems I've got misunderstood, the patch from Stefano Babic breaks
> u-boot here and not the commit 8aba9dceebb14144e07d19593111ee3a999c37fc.

I think I understood you: what I do is compile without commit 8aba9dce 
on the one hand, and with it _plus Stefano's patch_ on the other hand, 
in order to see how things compiled before we split LDFLAGS (8aba9dce^) 
with how things compile if we split LDFLAGS (8aba9dce) with -pie in the 
right place (Stefano's patch).

Can you try that?

> Regards,
>
> Alexander

Amicalement,
Alexander Holler Jan. 27, 2011, 10:19 p.m. UTC | #9
Am 27.01.2011 22:40, schrieb Albert ARIBAUD:
> Le 27/01/2011 22:32, Alexander Holler a écrit :
>> Am 27.01.2011 22:10, schrieb Albert ARIBAUD:
>>> Le 27/01/2011 21:55, Alexander Holler a écrit :
>>>> Am 27.01.2011 21:20, schrieb Albert ARIBAUD:
>>>>> Hi Alexander,
>>>>>
>>>>> Le 27/01/2011 20:42, Alexander Holler a écrit :
>>>>>> Hello,
>>>>>>
>>>>>> Am 27.01.2011 17:03, schrieb Stefano Babic:
>>>>>>> Commit 8aba9dceebb14144e07d19593111ee3a999c37fc breaks
>>>>>>> ARM boards because for ARM the -pie option is used
>>>>>>> for partial linking together with -r option.
>>>>>>>
>>>>>>> The patch adds the -pie option to link u-boot.bin only.
>>>>>>
>>>>>> Using native compilation with gcc 4.5.2 and binutils 2.21 this patch
>>>>>> will result in an unusable u-boot. It halts here after DRAM: ... just
>>>>>> like it was before some relocation fixes (regarding binutils).
>>>>>
>>>>> Which board do you compile?
>>>>
>>>> Upps, sorry, that one was on a BeagleBoard (armv7, omap3).
>>>
>>> I've just tried the following to compare make logs of before commit
>>> 8aba9dceebb14144e07d19593111ee3a999c37fc on the one hand and after this
>>> commit and with the proposed fix on the other hand:
>>
>> Oh, it seems I've got misunderstood, the patch from Stefano Babic breaks
>> u-boot here and not the commit 8aba9dceebb14144e07d19593111ee3a999c37fc.
>
> I think I understood you: what I do is compile without commit 8aba9dce
> on the one hand, and with it _plus Stefano's patch_ on the other hand,
> in order to see how things compiled before we split LDFLAGS (8aba9dce^)
> with how things compile if we split LDFLAGS (8aba9dce) with -pie in the
> right place (Stefano's patch).
>
> Can you try that?

Sorry, again. While hunting another problem I've applied Stefano's patch 
but haven't had 8aba9dceebb14144e07d19593111ee3a999c37fc (I was on the 
wrong branch here).
I've now rebased to the master (which includes the above commit) and 
applied Stefano's patch and it works.

Sorry for the noise.

Regards,

Alexander
Albert ARIBAUD Jan. 27, 2011, 10:37 p.m. UTC | #10
Le 27/01/2011 23:19, Alexander Holler a écrit :

> I've now rebased to the master (which includes the above commit) and
> applied Stefano's patch and it works.
>
> Sorry for the noise.

No problems. You can add your Tested-by: to Stefano's first post in this 
thread. :)

> Regards,
>
> Alexander

Amicalement,
Alexander Holler Jan. 27, 2011, 10:44 p.m. UTC | #11
Am 27.01.2011 17:03, schrieb Stefano Babic:
> Commit 8aba9dceebb14144e07d19593111ee3a999c37fc breaks
> ARM boards because for ARM the -pie option is used
> for partial linking together with -r option.
>
> The patch adds the -pie option to link u-boot.bin only.
>
> Signed-off-by: Stefano Babic<sbabic@denx.de>
> CC: Jason Liu<liu.h.jason@gmail.com>
> CC: lool@dooz.org
> CC: Wolfgang Denk<wd@denx.de>
> CC: Albert Aribaud<albert.aribaud@free.fr>

Tested-by: Alexander Holler <holler@ahsoftware.de>

Regards,

Alexander
Stefano Babic Jan. 27, 2011, 10:44 p.m. UTC | #12
On 01/27/2011 11:19 PM, Alexander Holler wrote:

> Sorry, again. While hunting another problem I've applied Stefano's patch
> but haven't had 8aba9dceebb14144e07d19593111ee3a999c37fc (I was on the
> wrong branch here).
> I've now rebased to the master (which includes the above commit) and
> applied Stefano's patch and it works.
> 
> Sorry for the noise.

Thanks for testing. I tested again on a ARM11 board, and I have not seen
any problems. However, I tested with an older gcc version, and I could
not exclude issues with gcc 4.5

Regards,
Stefano
Albert ARIBAUD Jan. 27, 2011, 10:54 p.m. UTC | #13
Le 27/01/2011 23:44, Alexander Holler a écrit :
> Am 27.01.2011 17:03, schrieb Stefano Babic:
>> Commit 8aba9dceebb14144e07d19593111ee3a999c37fc breaks
>> ARM boards because for ARM the -pie option is used
>> for partial linking together with -r option.
>>
>> The patch adds the -pie option to link u-boot.bin only.
>>
>> Signed-off-by: Stefano Babic<sbabic@denx.de>
>> CC: Jason Liu<liu.h.jason@gmail.com>
>> CC: lool@dooz.org
>> CC: Wolfgang Denk<wd@denx.de>
>> CC: Albert Aribaud<albert.aribaud@free.fr>
>
> Tested-by: Alexander Holler<holler@ahsoftware.de>
>
> Regards,
>
> Alexander
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

Applied to u-boot-arm as this is a fix.

Amicalement,
diff mbox

Patch

diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index 4e165bf..a6a4742 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -67,5 +67,5 @@  LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
 
 # needed for relocation
 ifndef CONFIG_NAND_SPL
-PLATFORM_LDFLAGS += -pie
+LDFLAGS_u-boot += -pie
 endif