Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1383510 > unrolled thread

[PATCH] objtool: Fix Makefile to properly see if libelf is supported

Started bySteven Rostedt <rostedt@goodmis.org>
First post2016-04-20 17:50 +0200
Last post2016-04-22 11:50 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] objtool: Fix Makefile to properly see if libelf is supported Steven Rostedt <rostedt@goodmis.org> - 2016-04-20 17:50 +0200
    Re: [PATCH] objtool: Fix Makefile to properly see if libelf is  supported Josh Poimboeuf <jpoimboe@redhat.com> - 2016-04-21 06:30 +0200
    [tip:core/urgent] objtool: Fix Makefile to properly see if libelf  is supported tip-bot for Steven Rostedt <tipbot@zytor.com> - 2016-04-22 11:50 +0200

#1383510 — [PATCH] objtool: Fix Makefile to properly see if libelf is supported

FromSteven Rostedt <rostedt@goodmis.org>
Date2016-04-20 17:50 +0200
Subject[PATCH] objtool: Fix Makefile to properly see if libelf is supported
Message-ID<rq2y6-1Fp-3@gated-at.bofh.it>
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 <rostedt@goodmis.org>
---

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

[toc] | [next] | [standalone]


#1383867 — Re: [PATCH] objtool: Fix Makefile to properly see if libelf is supported

FromJosh Poimboeuf <jpoimboe@redhat.com>
Date2016-04-21 06:30 +0200
SubjectRe: [PATCH] objtool: Fix Makefile to properly see if libelf is supported
Message-ID<rqepA-31f-9@gated-at.bofh.it>
In reply to#1383510
On Wed, Apr 20, 2016 at 11:32:35AM -0400, Steven Rostedt wrote:
> 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 <rostedt@goodmis.org>

Thanks!

Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>

-- 
Josh

[toc] | [prev] | [next] | [standalone]


#1384851 — [tip:core/urgent] objtool: Fix Makefile to properly see if libelf is supported

Fromtip-bot for Steven Rostedt <tipbot@zytor.com>
Date2016-04-22 11:50 +0200
Subject[tip:core/urgent] objtool: Fix Makefile to properly see if libelf is supported
Message-ID<rqFSR-8hs-63@gated-at.bofh.it>
In reply to#1383510
Commit-ID:  c2bb9e32e2315971a8535fee77335c04a739d71d
Gitweb:     http://git.kernel.org/tip/c2bb9e32e2315971a8535fee77335c04a739d71d
Author:     Steven Rostedt <rostedt@goodmis.org>
AuthorDate: Wed, 20 Apr 2016 11:32:35 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 22 Apr 2016 09:00:57 +0200

objtool: Fix Makefile to properly see if libelf is supported

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.
  ...

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.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Chris J Arges <chris.j.arges@canonical.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Pedro Alves <palves@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: live-patching@vger.kernel.org
Fixes: 442f04c34a1a4 ("objtool: Add tool to perform compile-time stack metadata validation")
Link: http://lkml.kernel.org/r/20160420153234.GA24032@home.goodmis.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 1d0aef0..70ca38e 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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web