Skip to content

Optimize ARM relocation

Jeroen Hofstee u-boot 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest posting 2/20 of 6 patches 0 repliesNew
  2. v3 posting 1/20 of 6 patches 0 repliesSuperseded

Patches in v3 posting 2/2 No applies recorded yet

None of the 6 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

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

Hello Albert,

Quoted 6 lines · Jeroen Hofstee
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

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