[PATCH 30/78] ARM: aarch64: Add relocation support

Sascha Hauer s.hauer at pengutronix.de
Mon Mar 19 01:50:19 PDT 2018


Hi Andrey,

On Fri, Mar 16, 2018 at 02:51:19PM -0700, Andrey Smirnov wrote:
> On Fri, Mar 16, 2018 at 5:53 AM, Sascha Hauer <s.hauer at pengutronix.de> wrote:
> > This adds aarch64 support for relocating binaries linked with -pie.
> >
> > Support is integrated into the already exisiting
> > relocate_to_current_adr() function which is now used for both arm32
> > and aarch64.
> >
> > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> 
> 
> Sascha:
> 
> Two small suggestions w.r.t. this patch:
> 
>  - I'd consider changing the code of relocate_to_current_adr() such
> that AARCH64 specific codepaths are not taken on ARM32 (via IS_ENABLED
> check or something similar)

Why? Do you want to make the code more clear or do you fear that we
apply fixups for a foreign architecture?

> 
>  - I've always wanted to fix the original code to use Elf32_rel type
> instead of magic hard-coded offsets, so depending on your
> willingness/time-budget, maybe now would be a good time to do that as
> well as use Elf64_rela for AARCH64?

You mean using 

> struct elf32_rel {
>	Elf32_Addr    r_offset;
>	Elf32_Word    r_info;
> } Elf32_Rel;

and:

> struct elf64_rela {
> 	Elf64_Addr r_offset;  /* Location at which to apply the action */
> 	Elf64_Xword r_info;   /* index and type of relocation */
>	Elf64_Sxword r_addend;        /* Constant addend used to compute value */
> } Elf64_Rela;

?

Yes, I can change that. I wonder though which type is behind R_ARM_ABS32

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list