Skip to contentSkip to conversation

linux: disable attribute alias with gcc >= 8.1

PATCH New Romain Naour 2 participants 2 messages Jun 2, 2018 – Jul 20, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 linux: disable attribute alias with gcc >= 8.1

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.

Cc Thomas Petazzoni <[email protected]>

---
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(+)
linux/linux.mk +9 -0
index 6b5f5344ed..f6cf005196 100644
@@ -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`
Signature · 1 line
2.14.3
#1 lore raw

PATCH v2 1/1 linux: disable attribute alias with gcc >= 8.1

Hello,

Quoted 8 lines · Romain Naour

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

Quoted 7 lines

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

Cc Thomas Petazzoni <[email protected]>

---
v2: use KCFLAGS instead of KBUILD_CFLAGS (ThomasP)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com