Re: [PATCH] objtool: Provide origin hint for elf_init_reloc_text_sym() errors

From: Josh Poimboeuf
Date: Sat May 04 2024 - 18:24:11 EST


On Tue, Apr 30, 2024 at 04:51:07PM -0700, Kees Cook wrote:
> @@ -891,8 +892,8 @@ struct reloc *elf_init_reloc_text_sym(struct elf *elf, struct section *sec,
> int addend = insn_off;
>
> if (!(insn_sec->sh.sh_flags & SHF_EXECINSTR)) {
> - WARN("bad call to %s() for data symbol %s",
> - __func__, sym->name);
> + WARN("bad call to %s() for %s symbol %s",
> + __func__, origin, sym->name);
> return NULL;

Thanks for the patch.

That warning was already phrased pretty awkwardly which was probably
part of the confusion. It could be rephrased to make it a little
clearer:

Something like:

.cfi_sites: unexpected reference to non-executable symbol 'execute_location'

And ".cfi_sites" is already in 'sec->name', so you wouldn't need to add
the new 'origin' arg.

--
Josh