lkml.org 
[lkml]   [2022]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH] tools/objtool: tolerate STT_NOTYPE symbols at end of section
Date


Le 20/12/2022 à 11:13, Nicholas Piggin a écrit :
> Hand-written asm often contains non-function symbols in executable
> sections. _end symbols for finding the size of instruction blocks
> for runtime processing is one such usage.
>
> optprobe_template_end is one example that causes the warning:
>
> objtool: optprobe_template_end(): can't find starting instruction
>
> This is because the symbol happens to be at the end of the file (and
> therefore end of a section in the object file).
>
> So ignore end-of-section STT_NOTYPE symbols instead of bailing out
> because an instruction can't be found. While we're here, add a more
> descriptive warning for STT_FUNC symbols found at the end of a
> section.

There's a patch to solve this already as far as I understand. They seem
different.

See
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20221208072813.25799-1-sv@linux.ibm.com/

>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> tools/objtool/check.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index 4350be739f4f..4b7c8b33069e 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -427,6 +427,15 @@ static int decode_instructions(struct objtool_file *file)
> if (func->type != STT_NOTYPE && func->type != STT_FUNC)
> continue;
>
> + if (func->offset == sec->sh.sh_size) {
> + /* Heuristic: likely an "end" symbol */
> + if (func->type == STT_NOTYPE)
> + continue;
> + WARN("%s(): STT_FUNC at end of section",
> + func->name);
> + return -1;
> + }
> +
> if (func->return_thunk || func->alias != func)
> continue;
>
\
 
 \ /
  Last update: 2023-03-26 23:15    [W:0.051 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site