From patchwork Sun Aug 13 21:32:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 801045 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@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=) 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 3xVsRD2LkGz9s9Y for ; Mon, 14 Aug 2017 07:32:55 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 89E8C2CF95; Sun, 13 Aug 2017 21:32:53 +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 kYmTUrgxUY0p; Sun, 13 Aug 2017 21:32:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 8ADD02F931; Sun, 13 Aug 2017 21:32:52 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 050561C2C11 for ; Sun, 13 Aug 2017 21:32:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 003912F931 for ; Sun, 13 Aug 2017 21:32:51 +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 2Be5V3FjizeR for ; Sun, 13 Aug 2017 21:32:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by silver.osuosl.org (Postfix) with ESMTP id 57E502CF95 for ; Sun, 13 Aug 2017 21:32:49 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id DD0AF21D56; Sun, 13 Aug 2017 23:32:47 +0200 (CEST) Received: from localhost (132.230.147.77.rev.sfr.net [77.147.230.132]) by mail.free-electrons.com (Postfix) with ESMTPSA id 6F1A9209D7; Sun, 13 Aug 2017 23:32:47 +0200 (CEST) From: Thomas Petazzoni To: Buildroot List , Waldemar Brodkorb Date: Sun, 13 Aug 2017 23:32:45 +0200 Message-Id: <20170813213245.27199-1-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 2.9.4 MIME-Version: 1.0 Cc: Thomas Petazzoni Subject: [Buildroot] [PATCH] configs/qemu_sparc_ss10: add Linux kernel patch to fix build with gcc 7.x X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This commit adds a Linux kernel patch that fixes the build of the qemu_sparc_ss10 defconfig when used with gcc 7.x: arch/sparc/kernel/pcic.c: In function ‘pcibios_fixup_bus’: arch/sparc/kernel/pcic.c:647:8: error: ‘cmd’ may be used uninitialized in this function [-Werror=maybe-uninitialized] cmd |= PCI_COMMAND_IO; ^~ The patch has been submitted upstream. Signed-off-by: Thomas Petazzoni --- I don't know if we want to merge this patch in Buildroot. Indeed: - The defconfig doesn't use gcc 7.x currently, so the problem doesn't exist with the defconfig as-is. - This problem exists for essentially all SPARC configurations that have PCI support enabled. The reason why I encountered this problem is because I'm testing bleeding edge toolchains (based on gcc 7.x) with our Qemu defconfigs. --- ...l-pcic-silence-gcc-7.x-warning-in-pcibios.patch | 55 ++++++++++++++++++++++ configs/qemu_sparc_ss10_defconfig | 3 ++ 2 files changed, 58 insertions(+) create mode 100644 board/qemu/sparc-ss10/patches/linux/0001-sparc-kernel-pcic-silence-gcc-7.x-warning-in-pcibios.patch diff --git a/board/qemu/sparc-ss10/patches/linux/0001-sparc-kernel-pcic-silence-gcc-7.x-warning-in-pcibios.patch b/board/qemu/sparc-ss10/patches/linux/0001-sparc-kernel-pcic-silence-gcc-7.x-warning-in-pcibios.patch new file mode 100644 index 0000000..49424bb --- /dev/null +++ b/board/qemu/sparc-ss10/patches/linux/0001-sparc-kernel-pcic-silence-gcc-7.x-warning-in-pcibios.patch @@ -0,0 +1,55 @@ +From 4152ce511663d290bdcd689f983ca45d1cb12c0a Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni +Date: Sun, 13 Aug 2017 23:07:43 +0200 +Subject: [PATCH] sparc: kernel/pcic: silence gcc 7.x warning in + pcibios_fixup_bus() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When building the kernel for Sparc using gcc 7.x, the build fails +with: + +arch/sparc/kernel/pcic.c: In function ‘pcibios_fixup_bus’: +arch/sparc/kernel/pcic.c:647:8: error: ‘cmd’ may be used uninitialized in this function [-Werror=maybe-uninitialized] + cmd |= PCI_COMMAND_IO; + ^~ + +The simplified code looks like this: + +unsigned int cmd; +[...] +pcic_read_config(dev->bus, dev->devfn, PCI_COMMAND, 2, &cmd); +[...] +cmd |= PCI_COMMAND_IO; + +I.e, the code assumes that pcic_read_config() will always initialize +cmd. But it's not the case. Looking at pcic_read_config(), if +bus->number is != 0 or if the size is not one of 1, 2 or 4, *val will +not be initialized. + +As a simple fix, we initialize cmd to zero at the beginning of +pcibios_fixup_bus. + +Signed-off-by: Thomas Petazzoni +Submitted-upstream: https://patchwork.ozlabs.org/patch/801039/ +--- + arch/sparc/kernel/pcic.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c +index a38787b..732af9a 100644 +--- a/arch/sparc/kernel/pcic.c ++++ b/arch/sparc/kernel/pcic.c +@@ -602,7 +602,7 @@ void pcibios_fixup_bus(struct pci_bus *bus) + { + struct pci_dev *dev; + int i, has_io, has_mem; +- unsigned int cmd; ++ unsigned int cmd = 0; + struct linux_pcic *pcic; + /* struct linux_pbm_info* pbm = &pcic->pbm; */ + int node; +-- +2.9.4 + diff --git a/configs/qemu_sparc_ss10_defconfig b/configs/qemu_sparc_ss10_defconfig index 8c6b563..55152ae 100644 --- a/configs/qemu_sparc_ss10_defconfig +++ b/configs/qemu_sparc_ss10_defconfig @@ -5,6 +5,9 @@ BR2_sparc_v8=y # System BR2_SYSTEM_DHCP="eth0" +# Patches +BR2_GLOBAL_PATCH_DIR="board/qemu/sparc-ss10/patches" + # Filesystem BR2_TARGET_ROOTFS_EXT2=y # BR2_TARGET_ROOTFS_TAR is not set