[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <df76qeqfg6bfanicus3tx7r62gexye5pa5cm5nipzfgeimfz36@sbvnnikb73q6>
Date: Mon, 26 Jan 2026 16:14:53 -0800
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Petr Pavlu <petr.pavlu@...e.com>
Cc: Peter Zijlstra <peterz@...radead.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] objtool: Replace custom macros in elf.c with shared ones
On Mon, Jan 26, 2026 at 04:13:48PM +0100, Petr Pavlu wrote:
> The source file tools/objtool/elf.c defines the macros ALIGN_UP(),
> ALIGN_UP_POW2() and MAX(). These macros unnecessarily duplicate
> functionality already available under tools/include/, specifically ALIGN(),
> roundup_pow_of_two() and max().
>
> More importantly, the definition of ALIGN_UP_POW2() is incorrect when the
> input is 1, as it results in a call to __builtin_clz(0), which produces an
> undefined result. This issue impacts the function elf_alloc_reloc(). When
> adding the first relocation to a section, the function allocates an
> undefined number of relocations.
>
> Replace the custom macros with the shared functionality to resolve these
> issues.
>
> Fixes: 2c05ca026218 ("objtool: Add elf_create_reloc() and elf_init_reloc()")
> Signed-off-by: Petr Pavlu <petr.pavlu@...e.com>
Thanks!
Acked-by: Josh Poimboeuf <jpoimboe@...nel.org>
--
Josh
Powered by blists - more mailing lists