[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<SN6PR02MB41574AD398AD3DE26DB3D23BD4C5A@SN6PR02MB4157.namprd02.prod.outlook.com>
Date: Wed, 5 Nov 2025 15:22:58 +0000
From: Michael Kelley <mhklinux@...look.com>
To: Josh Poimboeuf <jpoimboe@...nel.org>
CC: "x86@...nel.org" <x86@...nel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, Petr Mladek <pmladek@...e.com>, Miroslav
Benes <mbenes@...e.cz>, Joe Lawrence <joe.lawrence@...hat.com>,
"live-patching@...r.kernel.org" <live-patching@...r.kernel.org>, Song Liu
<song@...nel.org>, laokz <laokz@...mail.com>, Jiri Kosina <jikos@...nel.org>,
Marcos Paulo de Souza <mpdesouza@...e.com>, Weinan Liu <wnliu@...gle.com>,
Fazla Mehrab <a.mehrab@...edance.com>, Chen Zhongjin
<chenzhongjin@...wei.com>, Puranjay Mohan <puranjay@...nel.org>, Dylan Hatch
<dylanbhatch@...gle.com>, Peter Zijlstra <peterz@...radead.org>
Subject: RE: [PATCH v4 49/63] objtool/klp: Add --checksum option to generate
per-function checksums
From: Josh Poimboeuf <jpoimboe@...nel.org> Sent: Monday, October 27, 2025 3:22 PM
>
Sorry for the delay in my follow-up. I've been travelling the past 10 days.
> On Mon, Oct 27, 2025 at 01:19:10AM +0000, Michael Kelley wrote:
> > It turns out that Ubuntu 20.04 installed the 0.7.3-1 version of libxxhash. But from a
> > quick look at the README on the xxhash github site, XXH3 is first supported by the
> > 0.8.0 version, so the compile error probably makes sense. I found a PPA that offers
> > the 0.8.3 version of xxhash for Ubuntu 20.04, and that solved the problem.
> >
> > So the Makefile steps above that figure out if xxhash is present probably aren't
> > sufficient, as the version of xxhash matters. And the "--checksum not supported"
> > error message should be more specific about the required version.
> >
> > I reproduced the behavior on two different Ubuntu 20.04 systems, but
> > someone who knows this xxhash stuff better than I do should confirm
> > my conclusions. Maybe the way to fix the check for the presence of xxhash is
> > to augment the inline test program to include a reference to XXH3_state, but
> > I haven't tried to put together a patch to do that, pending any further discussion
> > or ideas.
>
> Thanks for reporting that. I suppose something like the below would work?
>
> Though, maybe the missing xxhash shouldn't fail the build at all. It's
> really only needed for people who are actually trying to run klp-build.
> I may look at improving that.
Yes, that would probably be better.
>
> diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
> index 48928c9bebef1..8b95166b31602 100644
> --- a/tools/objtool/Makefile
> +++ b/tools/objtool/Makefile
> @@ -12,7 +12,7 @@ ifeq ($(SRCARCH),loongarch)
> endif
>
> ifeq ($(ARCH_HAS_KLP),y)
> - HAVE_XXHASH = $(shell echo "int main() {}" | \
> + HAVE_XXHASH = $(shell echo -e "#include <xxhash.h>\nXXH3_state_t *state;int main() {}" | \
> $(HOSTCC) -xc - -o /dev/null -lxxhash 2> /dev/null && echo y || echo n)
> ifeq ($(HAVE_XXHASH),y)
> BUILD_KLP := y
Indeed this is what I had in mind for the enhanced check. But the above
gets a syntax error:
Makefile:15: *** unterminated call to function 'shell': missing ')'. Stop.
make[4]: *** [Makefile:73: objtool] Error 2
As a debugging experiment, adding only the -e option to the existing code
like this shouldn't affect anything,
HAVE_XXHASH = $(shell echo -e "int main() {}" | \
but it causes HAVE_XXHASH to always be 'n' even if the xxhash library
is present. So the -e option is somehow fouling things up.
Running the equivalent interactively at a 'bash' prompt works as expected.
And your proposed patch works correctly in an interactive bash. So
something weird is happening in the context of make's shell function,
and I haven't been able to figure out what it is.
Do you get the same failures? Or is this some kind of problem with
my environment? I've got GNU make version 4.2.1.
Michael
> diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
> index 1e1ea8396eb3a..aab7fa9c7e00a 100644
> --- a/tools/objtool/builtin-check.c
> +++ b/tools/objtool/builtin-check.c
> @@ -164,7 +164,7 @@ static bool opts_valid(void)
>
> #ifndef BUILD_KLP
> if (opts.checksum) {
> - ERROR("--checksum not supported; install xxhash-devel/libxxhash-dev and recompile");
> + ERROR("--checksum not supported; install xxhash-devel/libxxhash-dev (version >= 0.8) and recompile");
> return false;
> }
> #endif
Powered by blists - more mailing lists