Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] linux: disable attribute alias with gcc >= 8.1
@ 2018-06-02 14:34 Romain Naour
  2018-07-20  8:24 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Romain Naour @ 2018-06-02 14:34 UTC (permalink / raw)
  To: buildroot

gcc-8 started warning about function aliases that have a non-matching
prototype. This seems rather useful in general, but it causes tons of
warnings in the Linux kernel, where we rely on abusing those aliases
for system call entry points, in order to sanitze the arguments passed
from user space in registers.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82435

Disable the attribute-alias warning introduced by gcc-8 by adding
-Wno-attribute-alias to KCFLAGS.

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
v2: use KCFLAGS instead of KBUILD_CFLAGS (ThomasP)

Fixes most of build errors reported by toolchains-builder on Gitlab.
https://gitlab.com/free-electrons/toolchains-builder/pipelines/22921464
---
 linux/linux.mk | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/linux/linux.mk b/linux/linux.mk
index 6b5f5344ed..f6cf005196 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -121,6 +121,15 @@ LINUX_MAKE_ENV += \
 	KBUILD_BUILD_TIMESTAMP="$(shell LC_ALL=C date -d @$(SOURCE_DATE_EPOCH))"
 endif
 
+# gcc-8 started warning about function aliases that have a non-matching prototype.
+# This seems rather useful in general, but it causes tons of warnings in the Linux kernel,
+# where we rely on abusing those aliases for system call entry points, in order to sanitze
+# the arguments passed from user space in registers.
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82435
+ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_8),y)
+LINUX_MAKE_ENV += KCFLAGS=-Wno-attribute-alias
+endif
+
 # Get the real Linux version, which tells us where kernel modules are
 # going to be installed in the target filesystem.
 LINUX_VERSION_PROBED = `$(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease 2>/dev/null`
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-20  8:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-02 14:34 [Buildroot] [PATCH v2] linux: disable attribute alias with gcc >= 8.1 Romain Naour
2018-07-20  8:24 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox