[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <yk3ku4ud35rsrfwzvuqnrcnwogwngqlmc3otxrnoqefb47ajm7@orl5gcxuwrme>
Date: Tue, 11 Nov 2025 20:04:19 -0800
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Michael Kelley <mhklinux@...look.com>
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
On Wed, Nov 12, 2025 at 02:26:18AM +0000, Michael Kelley wrote:
> > I've been able to debug this. Two problems:
> >
> > 1) On Ubuntu (both 20.04 and 24.04), /bin/sh and /usr/bin/sh are symlinks
> > to "dash" (not "bash"). So the "shell" command in "make" invokes dash. The
> > man page for dash shows that the built-in echo command accepts only -n as
> > an option. The -e behavior of processing "\n" and similar sequences is always
> > enabled. So on my Ubuntu systems, the "-e" is ignored by echo and becomes
> > part of the C source code sent to gcc, and of course it barfs. Dropping the -e
> > makes it work for me (and the \n is handled correctly), but that might not work
> > with other shells. Using "/bin/echo" with the -e solves the problem in a more
> > compatible way across different shells.
Ah. I think we can use "printf" here.
> > 2) With make v4.2.1 on my Ubuntu 20.04 system, the "#" character in the
> > "#include" added to the echo command is problematic. "make" seems to be
> > treating it as a comment character, though I'm not 100% sure of that
> > interpretation. Regardless, the "#" causes a syntax error in the "make" shell
> > command. Adding a backslash before the "#" solves that problem. On an Ubuntu
> > 24.04 system with make v4.3, the "#" does not cause any problems. (I tried to put
> > make 4.3 on my Ubuntu 20.04 system, but ran into library compatibility problems
> > so I wasn’t able to definitively confirm that it is the make version that changes the
> > handling of the "#"). Unfortunately, adding the backslash before the # does *not*
> > work with make v4.3. The backslash becomes part of the C source code sent to
> > gcc, which barfs. I don't immediately have a suggestion on how to resolve this
> > in a way that is compatible across make versions.
>
> Using "\043" instead of the "#" is a compatible solution that works in make
> v4.2.1 and v4.3 and presumably all other versions as well.
Hm... I've seen similar portability issues with "," for which we had to
change it to "$(comma)" which magically worked for some reason that I am
forgetting.
Does "$(pound)" work? This seems to work here:
HAVE_XXHASH = $(shell printf "$(pound)include <xxhash.h>\nXXH3_state_t *state;int main() {}" | \
--
Josh
Powered by blists - more mailing lists