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

Albert ARIBAUD albert.aribaud at free.fr
Tue Oct 5 13:18:53 CEST 2010


Le 05/10/2010 13:01, Reinhard Meyer a écrit :
> Dear Graeme Russ,
>>> .globl _rel_dyn_start_ofs
>>> _rel_dyn_start_ofs:
>>> 	.word __rel_dyn_start - _start
>>> .globl _rel_dyn_end_ofs
>>> _rel_dyn_end_ofs:
>>> 	.word __rel_dyn_end - _start
>>> .globl _dynsym_start_ofs
>>> _dynsym_start_ofs:
>>> 	.word __dynsym_start - _start
>>>
>>> get the values to "C".
>>
>> Odd, is x86 different:
>>
>> extern ulong _i386boot_rel_dyn_start;
>> extern ulong _i386boot_rel_dyn_end;
>>
>> void board_init_f (ulong stack_limit)
>> {
>> ...
>> 	Elf32_Rel *rel_dyn_start = (Elf32_Rel *)&_i386boot_rel_dyn_start;
>> 	Elf32_Rel *rel_dyn_end = (Elf32_Rel *)&_i386boot_rel_dyn_end;
>> ...
>
> It can be done that way, too! But above assembly code provides
> relative offsets already, in "C" it would turn a bit uglier ;)
> (TODO later)

For the _rel_dyn_* and _dyn_sym* literals, offsets are mandatory, 
because their actual value would be always 0 at link time, and only 
become correct after relocation, which creates a catch-22, since you 
need these values for relocation.

Defining their value as relative to _start instead does not change their 
relocation type, but it makes their link-time value already correct, and 
thus makes relocation possible.

(/me thinks an update to doc/README.arm-relocation is in order)

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list