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

Jeroen Hofstee jeroen at myspectrum.nl
Sun Jun 16 15:33:32 CEST 2013


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


More information about the U-Boot mailing list