[U-Boot] Most ARM CPU's have buggy clear_bss?

Alexander Holler
2010-10-29T08:50:56Z

Hello again,

I'm leaving the problem description below, what fixed it all here was to
add -fPIC to the CFLAGS to instruct the compiler to generate relocatable
code (again).

This flag was replaced in commit 92d5ecba47feb9961c3b7525e947866c5f0d2de5

with -pie in LDFLAGS, which I don't understand (does not mean I have
much experience how the compiler and linker are working in regard to
relocatable code).

Regards,

Alexander

Am 28.10.2010 11:31, schrieb Alexander Holler:
> Am 28.10.2010 11:03, schrieb Alexander Holler:
>> Hello,
>>
>> Am 27.10.2010 09:26, schrieb Darius Augulis:
>>
>> > the code for clearing bss section for most ARM cores looks like this
>> > or very similar:
>>
>> ... [some code from start.S]
>>
>> Currently I'm analyzing the same problem (on a kirkwood based hw). It
>> turns out not to be a problem of clear_bss, but a problem of the
>> relocation code. I'm having a problem using gcc 4.3.4 or gcc 4.5.1 along
>> with binutils 2.20.1 and it seems that some stuff is not relocated. It
>> looks like the BSS before relocation is used (e.g. for nand_chip in
>> drivers/mtd/nand.c), but the BSS after relocation might be cleared (in
>> start.S).
>>
>> I assume it's because of some fixups start.S doesn't know about. But I
>> don't know anything about those fixups, and have to read. So I still
>> have no solution.
>>
>> Just as a pointer.
>
> To verify the problem:
>
> Add
>
> #define DEBUG
>
> in top of arch/arm/lib/board.c
>
> and
>
> printf("nand_chip: %p\n",,&nand_chip[0]);
>
> in nand_init() in drivers/mtd/nand/nand.c
>
> and have a look at the output when u-boot comes up.
>
> Regards,
>
> Alexander
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot