Re: [RFC v4 01/18] objtool: Add abstraction for computation of symbols offsets

From: Josh Poimboeuf
Date: Thu Aug 22 2019 - 15:57:27 EST


On Fri, Aug 16, 2019 at 01:23:46PM +0100, Raphael Gault wrote:
> @@ -672,14 +672,19 @@ static int add_call_destinations(struct objtool_file *file)
> }
>
> } else if (rela->sym->type == STT_SECTION) {
> + /*
> + * the original x86_64 code adds 4 to the rela->addend
> + * which is not needed on arm64 architecture.
> + */
> + dest_off = arch_dest_rela_offset(rela->addend);

I agree with Julien that this comment isn't needed. The "arch_" prefix
already implies there are arch-specific differences.

Also, this patch should replace all the other "addend + 4" usages:

$ git grep "addend + 4" tools/objtool
tools/objtool/arch/x86/decode.c: return addend + 4;
tools/objtool/check.c: dest_off = rela->addend + 4;
tools/objtool/check.c: dest_off = rela->sym->sym.st_value + rela->addend + 4;

--
Josh