[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ksgftd2cyrimrsk4dgey7zhdc3dvkh54wuvu5w2sv5wddw44sj@4f3f2xcxzfaj>
Date: Tue, 23 Sep 2025 15:23:28 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Alexandre Chartre <alexandre.chartre@...cle.com>
Cc: linux-kernel@...r.kernel.org, mingo@...nel.org, peterz@...radead.org
Subject: Re: [RFC PATCH v2 06/17] objtool: Improve offstr() output
On Thu, Jun 19, 2025 at 04:56:48PM +0200, Alexandre Chartre wrote:
> offset() formats a section offset into a "<symbol>+<offset>" string.
> Improve the output to just "<symbol>" when the offset is zero.
>
> Signed-off-by: Alexandre Chartre <alexandre.chartre@...cle.com>
> ---
> tools/objtool/include/objtool/warn.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/objtool/warn.h
> index 125093d568be..d89e6ae69143 100644
> --- a/tools/objtool/include/objtool/warn.h
> +++ b/tools/objtool/include/objtool/warn.h
> @@ -43,12 +43,12 @@ static inline char *offstr(struct section *sec, unsigned long offset)
>
> if (sym) {
> str = malloc(strlen(sym->name) + strlen(sec->name) + 40);
> - len = sprintf(str, "%s+0x%lx", sym->name, offset - sym->offset);
> + len = sprint_name(str, sym->name, offset - sym->offset);
> if (opts.sec_address)
> sprintf(str+len, " (%s+0x%lx)", sec->name, offset);
> } else {
> str = malloc(strlen(sec->name) + 20);
> - sprintf(str, "%s+0x%lx", sec->name, offset);
> + sprint_name(str, sec->name, offset);
Maybe this makes sense for the disassembler, but I'm not sure we want to
remove the zero for the more general warning case, as the intent is
usually to point to a specific instruction.
--
Josh
Powered by blists - more mailing lists