[U-Boot] [PATCH v3 0/6] Optimize ARM relocation

Jeroen Hofstee
2013-06-16T13:33:32Z

Hello Albert,

On 06/13/2013 08:54 PM, Jeroen Hofstee wrote:
>
>>>> binaries only use one type of relocation record,
>>>> R_ARM_RELATIVE., then optimizing relocation code
>>>> accordingly.
>>>
>

fyi, I had a look at the clang build and it doesn't boot
after these patches...

When constant pointers are used without fpie, e.g. the
arguments to printf, gcc will load the address with ldr /
R_ARM_ABS32, clang sets the address with a movw /
movt pair.

ld -r will make the former relative, but the movw / movt
cannot be fixed. So I set fpie for clang, which generates
a couple of R_ARM_ABS32:

Most notably a reference to do_bootd. Since it is no
longer valid after this patch and used in command.c this
crashes the board (unless there happens to be a valid
address in it). gcc seems to always recalculate it using pc.

Another symbol is _start, but that looks easily fixable.

The last one looks similar like the do_bootd and I haven't
bothered to check the details.

Regards,
Jeroen