Hi,
On 1/6/26 2:07 PM, Ahmad Fatoum wrote:
>> +/*
>> + * 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);
By passing NULL here, we won't be able to handle R_ARM_ABS32
relocations. A compile-time check that verifies we don't have such
relocations in the first place would be apt.
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 |