[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221102234134.4rwc3uugj7hmz7cb@treble>
Date: Wed, 2 Nov 2022 16:41:34 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, djwong@...nel.org,
yujie.liu@...el.com, tglx@...utronix.de, joao.moreira@...el.com,
samitolvanen@...gle.com
Subject: Re: [PATCH 4/5] objtool: Add option to generate prefix symbols
On Fri, Oct 28, 2022 at 09:40:26PM +0200, Peter Zijlstra wrote:
> When code is compiled with:
>
> -fpatchable-function-entry=${PADDING_BYTES},${PADDING_BYTES}
>
> functions will have PADDING_BYTES of NOP in front of them. Unwinders
> and other things that symbolize code locations will typically
> attribute these bytes to the preceding function.
>
> Given that these bytes nominally belong to the following symbol this
> mis-attribution is confusing.
>
> Inspired by the fact that CFI_CLANG emits __cfi_##name symbols to
> claim these bytes, allow objtool to emit __pfx_##name symbols to do
> the same.
>
> Therefore add the objtool --prefix=N argument, to conditionally place
> a __pfx_##name symbol at N bytes ahead of symbol 'name' when: all
> these preceding bytes are NOP and name-N is an instruction boundary.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
> tools/objtool/builtin-check.c | 1 +
> tools/objtool/check.c | 27 +++++++++++++++++++++++++++
> tools/objtool/elf.c | 30 ++++++++++++++++++++++++++++++
> tools/objtool/include/objtool/builtin.h | 1 +
> tools/objtool/include/objtool/elf.h | 2 ++
> 5 files changed, 61 insertions(+)
>
> --- a/tools/objtool/builtin-check.c
> +++ b/tools/objtool/builtin-check.c
> @@ -75,6 +75,7 @@ const struct option check_options[] = {
> OPT_BOOLEAN('r', "retpoline", &opts.retpoline, "validate and annotate retpoline usage"),
> OPT_BOOLEAN(0, "rethunk", &opts.rethunk, "validate and annotate rethunk usage"),
> OPT_BOOLEAN(0, "unret", &opts.unret, "validate entry unret placement"),
> + OPT_INTEGER(0, "prefix", &opts.prefix, "generate prefix symbols"),
"generate prefix symbols for function padding with size 'n' bytes" ?
--
Josh
Powered by blists - more mailing lists