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

Albert ARIBAUD albert.u.boot at aribaud.net
Tue Jun 18 16:54:57 CEST 2013


Hi Jeroen,

On Sun, 16 Jun 2013 15:33:32 +0200, Jeroen Hofstee
<jeroen at myspectrum.nl> wrote:

> 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.

Hmm... Why do you remove -fpie from the gcc build?

> 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.

Can you give more precise info on the issue? Such as the U-Boot
codebase (even if not in shape for submitting) and clang compiler
version you are using, so that I can try the build on my side and have
a look at how/why r_arm_abs32 relocation recodes are generated and how
to avoid it?

> Regards,
> Jeroen

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list