[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220508100907.61231-1-mailhol.vincent@wanadoo.fr>
Date: Sun, 8 May 2022 19:09:07 +0900
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
To: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H . Peter Anvin" <hpa@...or.com>
Cc: linux-kernel@...r.kernel.org, Arnd Bergmann <arnd@...nel.org>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>
Subject: [RESEND PATCH v1] x86/build: add -fno-builtin flag to prevent shadowing
Aside of the __builtin_foo() ones, x86 does not directly rely on any
builtin functions.
However, such builtin functions are not explicitly deactivated,
creating some collisions, concrete example being ffs() from bitops.h,
c.f.:
| ./arch/x86/include/asm/bitops.h:283:28: warning: declaration of 'ffs' shadows a built-in function [-Wshadow]
| 283 | static __always_inline int ffs(int x)
This patch adds -fno-builtin to KBUILD_CFLAGS for the x86
architectures in order to prevent shadowing of builtin functions.
Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
---
FYI, I tested this patch on a "make allyesconfig" for both x86_32 and
x86_64.
This is a resend. Only difference is that I dropped the RFC flag and
added Arnd in CC because he did a similar patch to fix ffs shadow
warnings in the past:
https://lore.kernel.org/all/20201026160006.3704027-1-arnd@kernel.org/
---
arch/x86/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index e84cdd409b64..5ff7b6571dd2 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -53,6 +53,8 @@ export REALMODE_CFLAGS
# e.g.: obj-y += foo_$(BITS).o
export BITS
+KBUILD_CFLAGS += -fno-builtin
+
#
# Prevent GCC from generating any FP code by mistake.
#
--
2.34.1
Powered by blists - more mailing lists