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

Lukasz Majewski lukma@denx.de
Thu Sep 9 07:18:06 GMT 2021


On Wed, 8 Sep 2021 22:34:21 +0200
Lukasz Majewski <lukma@denx.de> wrote:

> Hi Adhemerval,
> 
> > 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'm just using QEMU (runqemu -d y2038-image-devel nographic) from
> meta-y2038 build.
> 
> Recent versions: 
> poky: SHA1: 1e2e9a84d6dd81d7f6dd69c0d119d0149d10ade1
> qemu_6.0.0
> binutils_2.37
> gcc_11.2
> 
> The QEMU board uses Cortex-A9 core.

I've updated the poky to be the newest -master:
master:50293eec9a7d0602b748220ab100b070b8d3432a

No change.

I will try the same setup with Cortex-A5 core - maybe there is some
kind of subtle handling of such emulation in qemu?

> 
> > 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?  
> 
> 
> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> lukma@denx.de




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20210909/1c2ec65c/attachment.sig>


More information about the Libc-alpha mailing list