[U-Boot] [RFC] [PATCH V2] arm: arm926ejs: use ELF relocations

Albert ARIBAUD albert.aribaud at free.fr
Tue Oct 5 10:32:17 CEST 2010


Le 05/10/2010 09:40, Heiko Schocher a écrit :
> Hello Albert,
>
> Albert Aribaud wrote:
>> HISTORY:
>>
>> V1	Initial patch
>> V2	Rebased on latest mainline master
>>
>> This patch is *not* a submission for master!
>>
>> It is a proof of concept of ELF relocations for ARM, hastily done
>> in a day's work time for people on the list to try and to comment.
>> All comments are welcome, as several suggestions have been made
>> today on the list that I did not have time to incorporate, such as
>> rewriting the elf table fixup code in C.
>>
>> The basic idea of this patch is to replace the -fPIC compile-time
>> option with the -pie link-time option. This removes the GOT but adds
>> the .rel.dyn and .dynsym tables, which together allow fixing up code
>> more completely than with -fPIC and the GOT; for instance, all pointers
>> inside structures are fixed up with -pie, whereas they are not with GOT.
>>
>> Note that references to linker-file-generated symbols were also made
>> relative to _start rather than absolute. This is not needed as such,
>> but it will be useful when optimizing the relocation tables. Actually
>> I should have separated this from the ELF relocation support per se.
>>
>> The edminiv2.h config file is there for reference only; this is the
>> one I used for tests. Latest numbers are:
>>
>> With GOT relocs:
>>
>>     text	   data	    bss	    dec	    hex	filename	.bin size
>>   141376	   4388	  16640	 162404	  27a64	./u-boot	145764
>>
>> With ELF relocs:
>>
>>     text	   data	    bss	    dec	    hex	filename	.bin size
>>   149677	   3727	  16636	 170040	  29838	./u-boot	153408
>>
>> The size difference is essentially due to .rel.dyn not being optimal.
>> As discussed, an added build step should allow reducing it by half and
>> making ELF sizes roughly similar to GOT ones.
>>
>> Tests and comments not only welcome but also heartily called for.
>
> Tested based on your patch on the magnesium board (ARM926ejs and
> boots from NOR Flash). U-Boot works, with the following patch:
>
> ! I had to set TEXT_BASE to 0xc0000000 as u-boot starts from there,
> a TEXT_BASE = 0 didn;t work for me!

Seems like an overlook from me, it should not be 0.

I'll change thant in the next version.

Thanks for testing!

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list