Re: [PATCH v5 15/22] objtool: Add action to check for absence of absolute relocations
From: Josh Poimboeuf
Date: Wed Jul 16 2025 - 16:49:06 EST
On Wed, Jul 16, 2025 at 01:32:43PM +0200, Peter Zijlstra wrote:
> On Wed, Jul 16, 2025 at 08:26:55PM +1000, Ard Biesheuvel wrote:
>
> > For robustness, we should actually check for all absolute relocations
> > here, including R_X86_64_32S, which is not abstracted into a R_ABSxx
> > type for objtool.
> >
> > So perhaps this needs an arch hook where x86_64 can implement it as
> >
> > bool arch_is_abs_reloc(reloc)
> > {
> > switch (reloc_type(reloc)) {
> > case R_X86_64_32:
> > case R_X86_64_32S:
> > case R_X86_64_64:
> > return true;
> > }
> > return false;
> > }
> >
> > and the default just compares against R_ABS32 / R_ABS64 depending on
> > the word size?
>
> Yes, an arch hook like that makes sense. Perhaps make the signature:
>
> bool arch_is_abs_reloc(struct elf *, struct reloc *);
>
> Because the word size comes from elf_addr_size().
We already have an arch_pc_relative_reloc(), please try to keep the
naming consistent.
--
Josh