Hello, On 1/6/26 1:53 PM, Sascha Hauer wrote: > Implement architecture-specific ELF relocation handlers for ARM32 and ARM64. > The implementation reuses the existing relocate_image(). > > Signed-off-by: Sascha Hauer <[email protected]> > Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Reviewed-by: Ahmad Fatoum <[email protected]> But a bit more verbose than needed: > --- a/arch/arm/lib32/reloc.c > +++ b/arch/arm/lib32/reloc.c > @@ -6,6 +6,7 @@ > #include <barebox.h> > #include <elf.h> > #include <debug_ll.h> > +#include <linux/printk.h> Unused? > +/* > + * Apply ARM32 ELF relocations > + */ > +int elf_apply_relocations(struct elf_image *elf, const void *dyn_seg) > +{ > + Elf32_Rel *rel; > + void *rel_ptr; > + u64 relsz; > + phys_addr_t base = (phys_addr_t)elf->reloc_offset; > + int ret; > + > + ret = elf_parse_dynamic_section_rel(elf, dyn_seg, &rel_ptr, &relsz); > + if (ret) > + return ret; > + > + rel = (Elf32_Rel *)rel_ptr; Nitpick: rel can be dropped and rel_ptr used instead. > + > + relocate_image(base, rel, (void *)rel + relsz, NULL, NULL); > + > + return 0; > +} > diff --git a/arch/arm/lib64/reloc.c b/arch/arm/lib64/reloc.c > index > 2288f9e2e336887c5edfbf6b080f487394754113..50bd0b88fae0a59a6a86a84c1df0743ac158e06c > 100644 > --- a/arch/arm/lib64/reloc.c > +++ b/arch/arm/lib64/reloc.c > @@ -7,8 +7,7 @@ > #include <elf.h> > #include <debug_ll.h> > #include <asm/reloc.h> > - > -#define R_AARCH64_RELATIVE 1027 > +#include <linux/printk.h> Unused? > +/* > + * Apply ARM64 ELF relocations > + */ > +int elf_apply_relocations(struct elf_image *elf, const void *dyn_seg) > +{ > + Elf64_Rela *rela; > + void *rel_ptr; > + u64 relasz; > + phys_addr_t base = (phys_addr_t)elf->reloc_offset; > + int ret; > + > + ret = elf_parse_dynamic_section_rela(elf, dyn_seg, &rel_ptr, &relasz); > + if (ret) > + return ret; > + > + rela = (Elf64_Rela *)rel_ptr; Same thing. > + > + relocate_image(base, rela, (void *)rela + relasz, NULL, NULL); > + > + return 0; > +} Cheers, Ahmad -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
