From: David Laight <david.laight.linux@gmail.com>
To: "Joy H.J. Lee" <rkr0k0r@gmail.com>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
masahiroy@kernel.org, nathan@kernel.org
Subject: Re: [PATCH] tools/compiler: match glibc 2.42 definition of __attribute_const__
Date: Tue, 30 Jun 2026 18:41:06 +0100 [thread overview]
Message-ID: <20260630184106.7bb3f22f@pumpkin> (raw)
In-Reply-To: <20260630145840.2717960-1-rkr0k0r@gmail.com>
On Tue, 30 Jun 2026 23:58:40 +0900
"Joy H.J. Lee" <rkr0k0r@gmail.com> wrote:
> glibc 2.42 added __attribute_const__ to sys/cdefs.h:
>
> # define __attribute_const__ __attribute__ ((__const__))
>
> GCC 15 warns when a macro is redefined to a different replacement list
> (-Wbuiltin-macro-redefined). Since host tool Makefiles (resolve_btfids,
> objtool) pass -Werror, this conflict becomes fatal when building with
> glibc 2.42 and GCC 15.
>
> Per C11 §6.10.3, identical replacement lists are accepted silently.
> Match the glibc definition exactly, including the space before "((", so
> the redefinition is accepted without warning.
>
> Signed-off-by: Joy H.J. Lee <rkr0k0r@gmail.com>
> ---
> tools/include/linux/compiler.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h
> index f40bd2b04..f2f54b038 100644
> --- a/tools/include/linux/compiler.h
> +++ b/tools/include/linux/compiler.h
> @@ -119,7 +119,7 @@
> #define __read_mostly
>
> #ifndef __attribute_const__
> -# define __attribute_const__
> +# define __attribute_const__ __attribute__ ((__const__))
That doesn't look right, you are completely changing the value
when it isn't already defined.
David
> #endif
>
> #ifndef __maybe_unused
next prev parent reply other threads:[~2026-06-30 17:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 14:58 [PATCH] tools/compiler: match glibc 2.42 definition of __attribute_const__ Joy H.J. Lee
2026-06-30 17:41 ` David Laight [this message]
2026-06-30 18:42 ` Nathan Chancellor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260630184106.7bb3f22f@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=rkr0k0r@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox