From: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel@vger.kernel.org, Arnd Bergmann <arnd@kernel.org>,
Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Subject: [RESEND PATCH v1] x86/build: add -fno-builtin flag to prevent shadowing
Date: Sun, 8 May 2022 19:09:07 +0900 [thread overview]
Message-ID: <20220508100907.61231-1-mailhol.vincent@wanadoo.fr> (raw)
In-Reply-To: <20220306171009.1973074-1-mailhol.vincent@wanadoo.fr>
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@wanadoo.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
next prev parent reply other threads:[~2022-05-08 10:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-06 17:10 [RFC PATCH v1] x86/build: add -fno-builtin flag to prevent shadowing Vincent Mailhol
2022-05-08 10:09 ` Vincent Mailhol [this message]
2022-05-08 10:27 ` [RESEND " Arnd Bergmann
2022-05-08 12:37 ` Vincent MAILHOL
2022-05-08 23:51 ` Nathan Chancellor
2022-05-09 15:00 ` Vincent MAILHOL
2022-05-09 19:50 ` Nick Desaulniers
2022-05-09 23:12 ` Vincent MAILHOL
2022-05-09 23:26 ` Nick Desaulniers
2022-05-10 1:10 ` Vincent MAILHOL
2022-05-10 14:33 ` Vincent MAILHOL
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=20220508100907.61231-1-mailhol.vincent@wanadoo.fr \
--to=mailhol.vincent@wanadoo.fr \
--cc=arnd@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).