From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752192AbcDTPj4 (ORCPT ); Wed, 20 Apr 2016 11:39:56 -0400 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.230]:44955 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751836AbcDTPjy (ORCPT ); Wed, 20 Apr 2016 11:39:54 -0400 X-Greylist: delayed 425 seconds by postgrey-1.27 at vger.kernel.org; Wed, 20 Apr 2016 11:39:54 EDT Date: Wed, 20 Apr 2016 11:32:35 -0400 From: Steven Rostedt To: Josh Poimboeuf Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, Michal Marek , Peter Zijlstra , Andy Lutomirski , Borislav Petkov , Linus Torvalds , Andi Kleen , Pedro Alves , Namhyung Kim , Bernd Petrovitsch , Chris J Arges , Andrew Morton , Jiri Slaby , Arnaldo Carvalho de Melo Subject: [PATCH] objtool: Fix Makefile to properly see if libelf is supported Message-ID: <20160420153234.GA24032@home.goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-RR-Connecting-IP: 107.14.168.142:25 X-Cloudmark-Score: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When doing a make allmodconfig, I hit the following compile error: In file included from builtin-check.c:32:0: elf.h:22:18: fatal error: gelf.h: No such file or directory compilation terminated. In file included from special.h:22:0, from special.c:26: elf.h:22:18: fatal error: gelf.h: No such file or directory compilation terminated. In file included from elf.c:30:0: elf.h:22:18: fatal error: gelf.h: No such file or directory compilation terminated. mv: cannot stat 'tools/objtool/.elf.o.tmp': No such file or directory tools/build/Makefile.build:77: recipe for target 'tools/objtool/elf.o' failed make[4]: *** [tools/objtool/elf.o] Error 1 make[4]: *** Waiting for unfinished jobs.... Digging into it, it appears that the $(shell ..) command in the Makefile does not give the proper result when it fails to find -lelf, and continues to compile objtool. Instead, use the "try-run" makefile macro to perform the test. This gives a proper result for both cases. Fixes: 442f04c34a1a4 ("objtool: Add tool to perform compile-time stack metadata validation") Signed-off-by: Steven Rostedt --- diff --git a/Makefile b/Makefile index 873411873c03..012b7dd3ed24 100644 --- a/Makefile +++ b/Makefile @@ -1008,7 +1008,8 @@ prepare0: archprepare FORCE prepare: prepare0 prepare-objtool ifdef CONFIG_STACK_VALIDATION - has_libelf := $(shell echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf - &> /dev/null && echo 1 || echo 0) + has_libelf := $(call try-run,\ + echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0) ifeq ($(has_libelf),1) objtool_target := tools/objtool FORCE else