Skip to contentSkip to conversation

Patch "objtool: Allow building with older libelf" has been added to the 4.6-stable tree

PATCH [email protected] 1 participant 1 message May 30, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

objtool: Allow building with older libelf

to the 4.6-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
objtool-allow-building-with-older-libelf.patch
and it can be found in the queue-4.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 2e51f26245701cb28f154552836b7807159088a8 Mon Sep 17 00:00:00 2001

From: Jan Beulich <[email protected]>
Date: Mon, 16 May 2016 15:31:07 -0500
Subject: objtool: Allow building with older libelf

From: Jan Beulich <[email protected]>

commit 2e51f26245701cb28f154552836b7807159088a8 upstream.

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.

---
 tools/objtool/Makefile |    4 ++++
 tools/objtool/elf.h    |    5 +++++
 2 files changed, 9 insertions(+)
tools/objtool/Makefile +4 -0
@@ -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
tools/objtool/elf.h +5 -0
@@ -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;

Patches currently in stable-queue which might be from [email protected] are

queue-4.6/objtool-allow-building-with-older-libelf.patch