linux/tools/include
Joy H.J. Lee 4f489a1540 tools/compiler: match glibc 2.42 definition of __attribute_const__
commit 8700a4761b upstream.

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.

The warning is suppressed on standard native builds because GCC treats
/usr/include as a system header path (-isystem), and macro-redefinition
warnings from system headers are silently suppressed by GCC. It fires
when glibc headers are on a regular include path (-I) instead, which
is the case in cross-compilation setups such as NixOS, where the
sysroot's glibc is passed explicitly via -I rather than -isystem.

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 regardless of whether
glibc headers are treated as system or non-system includes.

Link: https://lore.kernel.org/20260701200635.3992767-1-rkr0k0r@gmail.com
Signed-off-by: Joy H.J. Lee <rkr0k0r@gmail.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: David Laight <david.laight.linux@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-09-14 13:20:04 +02:00
..
asm tools arch: Update arch/x86/lib/mem{cpy,set}_64.S copies used in 'perf bench mem memcpy' 2021-05-10 09:01:00 -03:00
asm-generic hugetlb_encode.h: fix undefined behaviour (34 << 26) 2024-07-05 09:14:23 +02:00
linux tools/compiler: match glibc 2.42 definition of __attribute_const__ 2026-09-14 13:20:04 +02:00
nolibc tools/nolibc: make time_t robust if __kernel_old_time_t is missing in host headers 2025-10-19 16:21:31 +02:00
tools tools include: add dis-asm-compat.h to handle version differences 2023-03-17 08:49:04 +01:00
trace/events tools/lib/lockdep: Remove private kernel headers 2017-06-05 09:28:14 +02:00
uapi bpf: Fix L4 csum update on IPv6 in CHECKSUM_COMPLETE 2025-06-27 11:05:38 +01:00
vdso tools headers: Synchronize linux/bits.h with the kernel sources 2020-04-14 11:40:05 -03:00