From patchwork Sun Mar 25 22:32:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 10306983 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C203760385 for ; Sun, 25 Mar 2018 22:33:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC11E28500 for ; Sun, 25 Mar 2018 22:33:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9ECA029133; Sun, 25 Mar 2018 22:33:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F17F428500 for ; Sun, 25 Mar 2018 22:33:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751055AbeCYWct (ORCPT ); Sun, 25 Mar 2018 18:32:49 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35896 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750959AbeCYWcs (ORCPT ); Sun, 25 Mar 2018 18:32:48 -0400 Received: by mail-wm0-f65.google.com with SMTP id x82so12084416wmg.1 for ; Sun, 25 Mar 2018 15:32:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kAQI/bYCRhgEEPHafeHnlS8g3wjVohylXLSVPmcywG0=; b=IdQ8rALTiP7TgQLybw9VFroy8ADfICA3fwbOJnXDz4uZ/JIYB1si+ciyWKsOLkuq3s Do1GJi5AgtJhSM6kff40IYgj2I17pFzoyIhFdZ6QciPdgTwGssEZLk6qUYzbB4pZ9wpT RJmdlU9V4xdI2gWaDNpDfI8YtahcQwLy7gNnA= 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:mime-version :content-transfer-encoding; bh=kAQI/bYCRhgEEPHafeHnlS8g3wjVohylXLSVPmcywG0=; b=U1c6pl2QWUSprs3TKMfBEY2FJAUcQ4hbcVpnffw94l7q0jQoHsWZW35JHpQkzf1BTf IBxY6pkFOOxWhZQv+mFpqIMU2RTY3jueC2n16Ojvy6x9DGDN12/JSHA+mPXiA48T5E3X E41zWgCFbeYg0WMiCjaZyf8rq/1BK77cO1IEAxIGOJamllIjgMajsYHp/4WN8DPRNkPz MhDimFHU693kviaRqaWF1YNAFAxOwEdJKUldHntUdPBLHXsHaoITFX80oqBbsJXzR3MI hluNxlzBCRvQ8PJNt14tAkqio7Cz6x1Ns9jafxdR4ZTmj+Bz7VYWSwS0mQt7uwftwD8h Wu5g== X-Gm-Message-State: AElRT7FQILq4ECIbR5uydW82KmOqAH8y9i2F2wvPDzEHFlaJSETcDQfT RGM6A+xKpkcOc02lau4VAzJkGQ== X-Google-Smtp-Source: AG47ELvEAY/gOIWnBj7vDFotrj4VNE00E5Od4J95cs17M7+JHEz1tbechCGxImjXwKg3GUWKGxlmKA== X-Received: by 10.80.142.174 with SMTP id w43mr37169659edw.140.1522017167421; Sun, 25 Mar 2018 15:32:47 -0700 (PDT) Received: from prevas-ravi.waoo.dk (dhcp-5-186-126-104.cgn.ip.fibianet.dk. [5.186.126.104]) by smtp.gmail.com with ESMTPSA id j42sm8762475eda.67.2018.03.25.15.32.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 25 Mar 2018 15:32:47 -0700 (PDT) From: Rasmus Villemoes To: Josh Poimboeuf , Peter Zijlstra Cc: linux-kbuild@vger.kernel.org, Masahiro Yamada , Michal Marek , Rasmus Villemoes , linux-kernel@vger.kernel.org Subject: [PATCH] objtool: fix build with future Make Date: Mon, 26 Mar 2018 00:32:39 +0200 Message-Id: <20180325223239.14778-1-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.15.1 MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP I tried building using a freshly built Make (4.2.1-69-g8a731d1), but the objtool build broke with orc_dump.c: In function ‘orc_dump’: orc_dump.c:106:2: error: ‘elf_getshnum’ is deprecated [-Werror=deprecated-declarations] if (elf_getshdrnum(elf, &nr_sections)) { Turns out that with that new Make, the backslash was not removed, so cpp didn't see a #include directive, grep found nothing, and -DLIBELF_USE_DEPRECATED was wrongly put in CFLAGS. Now, that new Make behaviour is documented in their NEWS file: * WARNING: Backward-incompatibility! Number signs (#) appearing inside a macro reference or function invocation no longer introduce comments and should not be escaped with backslashes: thus a call such as: foo := $(shell echo '#') is legal. Previously the number sign needed to be escaped, for example: foo := $(shell echo '\#') Now this latter will resolve to "\#". If you want to write makefiles portable to both versions, assign the number sign to a variable: C := \# foo := $(shell echo '$C') This was claimed to be fixed in 3.81, but wasn't, for some reason. To detect this change search for 'nocomment' in the .FEATURES variable. There are likely other places in the tree that will need fixing, so cc-ing Kbuild, but with this at least a x86-64 defconfig builds. Signed-off-by: Rasmus Villemoes Reviewed-by: Masahiro Yamada --- tools/objtool/Makefile | 2 +- tools/scripts/Makefile.include | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index e6acc281dd37..8ae824dbfca3 100644 --- a/tools/objtool/Makefile +++ b/tools/objtool/Makefile @@ -35,7 +35,7 @@ CFLAGS += -Wall -Werror $(WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES) LDFLAGS += -lelf $(LIBSUBCMD) # Allow old libelf to be used: -elfshdr := $(shell echo '\#include ' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) +elfshdr := $(shell echo '$(pound)include ' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr) CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED) AWK = awk diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include index dd614463d4d6..495066bafbe3 100644 --- a/tools/scripts/Makefile.include +++ b/tools/scripts/Makefile.include @@ -120,3 +120,5 @@ ifneq ($(silent),1) QUIET_UNINST = @printf ' UNINST %s\n' $1; endif endif + +pound := \#