From patchwork Thu May 31 20:37:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 923589 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ns7hzRWP"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40xfRX4DwNz9s0q for ; Fri, 1 Jun 2018 06:38:00 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 198812E72D; Thu, 31 May 2018 20:37:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xKSGRAhsVqm8; Thu, 31 May 2018 20:37:53 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 71BD92E718; Thu, 31 May 2018 20:37:53 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 72F241C2592 for ; Thu, 31 May 2018 20:37:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 7040C87A3A for ; Thu, 31 May 2018 20:37:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W2tFYvCJwD3T for ; Thu, 31 May 2018 20:37:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 4B70387A3C for ; Thu, 31 May 2018 20:37:51 +0000 (UTC) Received: by mail-wr0-f195.google.com with SMTP id d2-v6so18775550wrm.10 for ; Thu, 31 May 2018 13:37:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Z6H4NONzpFR35G1Lhu/oK9QFatmptEanA9aoFsURPm0=; b=ns7hzRWPxUhkMV9dSRuePbYJc99dDUjwh32DYUhuXvvbUehZQW5benxyCuiXKLM2kH ZJkxpECag/JcuXwc3/q0CbgABHc1e68afYweHuwXZuYFQ3l09p7X2T6gZII+cZ9SHCvx ea3jUkLErWtpn3uvfF+yuuk7epgzBkbZIli/PRRHoem+0K33REyyz0xdHeAqrHpAuk0z i3uZmE6pUdPUoHTj6Q3X28ui3rrC/0cBPt21v5ezFMR9S27EVIALEImORJVlDaR1CSVT OHo5iR6uqaj5GXgVdGWTWFEzoL3JF3aboquhwYSX9h3Vp7QhOqy0cG+3I0Qj5RIVLizM Ry9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Z6H4NONzpFR35G1Lhu/oK9QFatmptEanA9aoFsURPm0=; b=jJ2SQ0jmKOAUywCIFGecniuZYnFnkno7j0BJi9/g+UUwzPMOUWcePg4ZO9xjYKm61Q lIjsLHs9yKspxowWZNFtnaoA+7P+qoW46EowsCxrV8R3LDILr4C+V/YwLlVKTkcNcibO eAzp5/1iiw1GKlTo9xwuMOqNfG3IsjQM9ZBJalePfW4I7HQ7MWEV0p2XfMmfEB2MCEJo QdBQsiOPsMRCrFHII5qD5woATiHlUaq+g2NKobUyukZOjlcQCpE/mAdQrkd7+2Agh20I W6aG+77N2YoqzRlL6WmfpW2Q03SdHKJB0RMYQcOuHQlZIbcQt+ocD46vyzvIeQMM1hfj o5ag== X-Gm-Message-State: ALKqPwdRdTdPLkymS+CSJme80WMI4DowtJOpVi4IF9f7hYp6FtQJHQlf lNX4GJwFeBKuTHI1x4ZU7rGVSzDe X-Google-Smtp-Source: ADUXVKKT6Ibf0hjFseU5tZrN/mLI7vi98q85bfkFsefEJwOY+tK/7tDy8LL6VVEIfiiHLiDPUuCjuA== X-Received: by 2002:adf:a075:: with SMTP id l50-v6mr6987515wrl.227.1527799069423; Thu, 31 May 2018 13:37:49 -0700 (PDT) Received: from adeos.home (2a01cb00054978001a46adb371a118d7.ipv6.abo.wanadoo.fr. [2a01:cb00:549:7800:1a46:adb3:71a1:18d7]) by smtp.gmail.com with ESMTPSA id d7-v6sm19304785wrm.9.2018.05.31.13.37.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 May 2018 13:37:48 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Thu, 31 May 2018 22:37:45 +0200 Message-Id: <20180531203745.4799-1-romain.naour@gmail.com> X-Mailer: git-send-email 2.14.3 Subject: [Buildroot] [PATCH RFC] linux: disable attribute alias with gcc >= 8.1 X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Romain Naour , Thomas Petazzoni MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "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 Add a new conditional patch that disable the attribute-alias warning introduced by gcc-8 by adding -Wno-attribute-alias to KBUILD_CFLAGS. Signed-off-by: Romain Naour Cc: Thomas Petazzoni --- Fixes most of build errors reported by toolchains-builder on Gitlab. https://gitlab.com/free-electrons/toolchains-builder/pipelines/22921464 --- ...e-attribute-alias-for-gcc-8.1.patch.conditional | 33 ++++++++++++++++++++++ linux/linux.mk | 14 +++++++++ 2 files changed, 47 insertions(+) create mode 100644 linux/0002-Makefile-disable-attribute-alias-for-gcc-8.1.patch.conditional diff --git a/linux/0002-Makefile-disable-attribute-alias-for-gcc-8.1.patch.conditional b/linux/0002-Makefile-disable-attribute-alias-for-gcc-8.1.patch.conditional new file mode 100644 index 0000000000..23ce8a12b5 --- /dev/null +++ b/linux/0002-Makefile-disable-attribute-alias-for-gcc-8.1.patch.conditional @@ -0,0 +1,33 @@ +From f238848ce07b9b033847278ccafabc817634e650 Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Thu, 31 May 2018 20:56:37 +0200 +Subject: [PATCH] Makefile: disable attribute-alias for 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 + +Signed-off-by: Romain Naour +--- + Makefile | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/Makefile b/Makefile +index 56ba070..b54e19a6 100644 +--- a/Makefile ++++ b/Makefile +@@ -641,6 +641,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) + KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) + KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) + KBUILD_CFLAGS += $(call cc-disable-warning, int-in-bool-context) ++KBUILD_CFLAGS += $(call cc-disable-warning, attribute-alias) + + ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE + KBUILD_CFLAGS += $(call cc-option,-Oz,-Os) +-- +2.7.4 + diff --git a/linux/linux.mk b/linux/linux.mk index b6b91391b6..3af72f819e 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -226,6 +226,20 @@ define LINUX_TRY_PATCH_TIMECONST endef LINUX_POST_PATCH_HOOKS += LINUX_TRY_PATCH_TIMECONST +# 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) +define LINUX_TRY_PATCH_NO_ATTRIBUTE_ALIAS + @if patch -p1 --dry-run -f -s -d $(@D) <$(LINUX_PKGDIR)/0002-Makefile-disable-attribute-alias-for-gcc-8.1.patch.conditional >/dev/null ; then \ + $(APPLY_PATCHES) $(@D) $(LINUX_PKGDIR) 0002-Makefile-disable-attribute-alias-for-gcc-8.1.patch.conditional ; \ + fi +endef +LINUX_POST_PATCH_HOOKS += LINUX_TRY_PATCH_NO_ATTRIBUTE_ALIAS +endif + ifeq ($(BR2_LINUX_KERNEL_USE_DEFCONFIG),y) LINUX_KCONFIG_DEFCONFIG = $(call qstrip,$(BR2_LINUX_KERNEL_DEFCONFIG))_defconfig else ifeq ($(BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG),y)