summaryrefslogtreecommitdiff
path: root/tools/objtool/Makefile
diff options
context:
space:
mode:
authorJan Beulich <JBeulich@suse.com>2016-05-16 23:31:07 +0300
committerIngo Molnar <mingo@kernel.org>2016-05-17 11:42:46 +0300
commit2e51f26245701cb28f154552836b7807159088a8 (patch)
tree70f586fcf046be12f4b62475ef2fb53ff8da36ce /tools/objtool/Makefile
parentbc231d9ede99518b67a77544d9084f15b898fe2e (diff)
downloadlinux-2e51f26245701cb28f154552836b7807159088a8.tar.xz
objtool: Allow building with older libelf
The switch to elf_getshdr{num,strndx} post-dates the oldest tool chain the kernel is supposed to be able to build with, so try to cope with such an environment. Signed-off-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: <stable@vger.kernel.org> # for v4.6 Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jan Beulich <JBeulich@suse.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Link: http://lkml.kernel.org/r/732dae6872b7ff187d94f22bb699a12849d3fe04.1463430618.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/objtool/Makefile')
-rw-r--r--tools/objtool/Makefile4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index 6765c7e949f3..f094f3c4ed84 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -30,6 +30,10 @@ INCLUDES := -I$(srctree)/tools/include
CFLAGS += -Wall -Werror $(EXTRA_WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES)
LDFLAGS += -lelf $(LIBSUBCMD)
+# Allow old libelf to be used:
+elfshdr := $(shell echo '\#include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr)
+CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED)
+
AWK = awk
export srctree OUTPUT CFLAGS ARCH AWK
include $(srctree)/tools/build/Makefile.include