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


Groups > linux.kernel > #1400532 > unrolled thread

[PATCH] objtool: allow building with older libelf

Started by"Jan Beulich" <JBeulich@suse.com>
First post2016-05-13 08:30 +0200
Last post2016-05-13 08:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] objtool: allow building with older libelf "Jan Beulich" <JBeulich@suse.com> - 2016-05-13 08:30 +0200

#1400532 — [PATCH] objtool: allow building with older libelf

From"Jan Beulich" <JBeulich@suse.com>
Date2016-05-13 08:30 +0200
Subject[PATCH] objtool: allow building with older libelf
Message-ID<ryeLQ-66n-5@gated-at.bofh.it>
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>
---
 tools/objtool/Makefile        |    4 ++++
 tools/objtool/elf.h           |    5 +++++
 2 files changed, 9 insertions(+)

--- 4.6-rc7/tools/objtool/Makefile
+++ 4.6-rc7-objtool-older-libelf/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
--- 4.6-rc7/tools/objtool/elf.h
+++ 4.6-rc7-objtool-older-libelf/tools/objtool/elf.h
@@ -23,6 +23,11 @@
 #include <linux/list.h>
 #include <linux/hashtable.h>
 
+#ifdef LIBELF_USE_DEPRECATED
+# define elf_getshdrnum    elf_getshnum
+# define elf_getshdrstrndx elf_getshstrndx
+#endif
+
 struct section {
 	struct list_head list;
 	GElf_Shdr sh;

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web