From patchwork Fri Jun 24 13:47:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 640201 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3rbflv1WDFz9t0X for ; Fri, 24 Jun 2016 23:47:38 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id CB12CC1698; Fri, 24 Jun 2016 13:47:35 +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 d0571YZZUG5T; Fri, 24 Jun 2016 13:47:33 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id D83CCC166A; Fri, 24 Jun 2016 13:47:32 +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 17B4E1C2BE7 for ; Fri, 24 Jun 2016 13:47:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 111C13331C for ; Fri, 24 Jun 2016 13:47:32 +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 OC0Z+yVu9kK3 for ; Fri, 24 Jun 2016 13:47:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (down.free-electrons.com [37.187.137.238]) by silver.osuosl.org (Postfix) with ESMTP id 69E912CDDE for ; Fri, 24 Jun 2016 13:47:30 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 8E356228; Fri, 24 Jun 2016 15:47:28 +0200 (CEST) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 5146F128; Fri, 24 Jun 2016 15:47:18 +0200 (CEST) From: Thomas Petazzoni To: buildroot@uclibc.org Date: Fri, 24 Jun 2016 15:47:17 +0200 Message-Id: <1466776037-12037-1-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 2.7.4 Cc: Thomas Petazzoni Subject: [Buildroot] [PATCH] efivar: fix build with old gcc versions 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: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The efivar build process starts by building one tool for the host, which is needed for the rest of the build. This tool currently fails to build with old gcc versions because the gcc.specs used by efivar specifies -std=gnu11. To address this, this patch: - passes 'gcc_flags=' to the host build, so that the custom gcc specs are not passed. They are in practice not needed for the build of the simple makeguids host utility. - passes -std=gnu99 instead of -std=c99 in the build of host makeguids, because the source code uses anonymous structs and unions, which requires std=gnu99 and not just std=c99 In addition, the build by default assumes that the target toolchain is LTO capable, and that therefore you can call gcc-ar, gcc-nm and gcc-ranlib. This fails short when the target toolchain is for example gcc 4.7. To address this, we explicitly specify AR, NM and RANLIB to be used, but pass them as make options instead of in the environment, in order to override the values specified in the package Makefile. Fixes: http://autobuild.buildroot.net/results/fe40c1d139ba8ddeef3dafd5c1818a946f014d7c/ Cc: Erico Nunes Signed-off-by: Thomas Petazzoni --- package/efivar/efivar.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package/efivar/efivar.mk b/package/efivar/efivar.mk index 3d37916..de48bc9 100644 --- a/package/efivar/efivar.mk +++ b/package/efivar/efivar.mk @@ -31,10 +31,11 @@ define EFIVAR_BUILD_CMDS # makeguids is an internal host tool and must be built separately with # $(HOST_CC), otherwise it gets cross-built. $(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) \ - CFLAGS="$(HOST_CFLAGS) -std=c99" \ - $(MAKE) -C $(@D)/src makeguids + CFLAGS="$(HOST_CFLAGS) -std=gnu99" \ + $(MAKE) -C $(@D)/src gcc_cflags= makeguids $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE1) -C $(@D) \ + AR=$(TARGET_AR) NM=$(TARGET_NM) RANLIB=$(TARGET_RANLIB) \ $(EFIVAR_MAKE_OPTS) \ all endef