[PATCH] dl: Use "adr" assembler command to get proper load address

Adhemerval Zanella adhemerval.zanella@linaro.org
Wed Sep 8 19:19:46 GMT 2021



On 08/09/2021 12:05, Lukasz Majewski wrote:
> 
> The r1 gets the 0xffffee80 (negative offset) value. It is then added to pc
> and used to calculate r2.
> 
> For working code (with this patch applied) - there are NO such large
> values (like aforementioned 0xffffee80). The arithmetic is done on 
> 
>    1690:       00000020        .word   0x00000020
>    1694:       0002be7e        .word   0x0002be7e
> 
> which seems to work.
> 
> This shouldn't be a problem as with U2 the arithmetic shall work.
> However, I've noticed (with passing LD_DEBUG=all) that the
> ld-linux-armhf.so.3 (and init) are relocated twice before execution.
> 
> Why do we need to relocate it?
> 
> Another question is why on this particular case the large (i.e.
> negative) offset matters?

I think it is highly unlikely the negative offset plays any role here.
Do you have a working example to trigger this issue?  I am currently
testing arm for different compilers (gcc 6.2, gcc 10, gcc 11) and
with different configurations (armv5, armv6, armv7, with and without
thumb) and I haven't see any issue so far.

It might binutils related, which version are you using?


More information about the Libc-alpha mailing list