From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754752AbcEQJBm (ORCPT ); Tue, 17 May 2016 05:01:42 -0400 Received: from terminus.zytor.com ([198.137.202.10]:35402 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754462AbcEQJBi (ORCPT ); Tue, 17 May 2016 05:01:38 -0400 Date: Tue, 17 May 2016 02:00:36 -0700 From: tip-bot for Jan Beulich Message-ID: Cc: JBeulich@suse.com, jolsa@redhat.com, jpoimboe@redhat.com, mingo@kernel.org, alexander.shishkin@linux.intel.com, peterz@infradead.org, vincent.weaver@maine.edu, tglx@linutronix.de, acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com, jbeulich@suse.com, torvalds@linux-foundation.org, eranian@google.com Reply-To: acme@redhat.com, linux-kernel@vger.kernel.org, jbeulich@suse.com, hpa@zytor.com, torvalds@linux-foundation.org, eranian@google.com, JBeulich@suse.com, jpoimboe@redhat.com, jolsa@redhat.com, mingo@kernel.org, alexander.shishkin@linux.intel.com, peterz@infradead.org, vincent.weaver@maine.edu, tglx@linutronix.de In-Reply-To: <732dae6872b7ff187d94f22bb699a12849d3fe04.1463430618.git.jpoimboe@redhat.com> References: <732dae6872b7ff187d94f22bb699a12849d3fe04.1463430618.git.jpoimboe@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:core/urgent] objtool: Allow building with older libelf Git-Commit-ID: 2e51f26245701cb28f154552836b7807159088a8 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 2e51f26245701cb28f154552836b7807159088a8 Gitweb: http://git.kernel.org/tip/2e51f26245701cb28f154552836b7807159088a8 Author: Jan Beulich AuthorDate: Mon, 16 May 2016 15:31:07 -0500 Committer: Ingo Molnar CommitDate: Tue, 17 May 2016 10:42:46 +0200 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 Signed-off-by: Josh Poimboeuf Cc: # for v4.6 Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Jan Beulich Cc: Jiri Olsa Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Link: http://lkml.kernel.org/r/732dae6872b7ff187d94f22bb699a12849d3fe04.1463430618.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar --- tools/objtool/Makefile | 4 ++++ tools/objtool/elf.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile index 6765c7e..f094f3c 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 ' | $(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 diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h index 7f3e00a..aa1ff65 100644 --- a/tools/objtool/elf.h +++ b/tools/objtool/elf.h @@ -23,6 +23,11 @@ #include #include +#ifdef LIBELF_USE_DEPRECATED +# define elf_getshdrnum elf_getshnum +# define elf_getshdrstrndx elf_getshstrndx +#endif + struct section { struct list_head list; GElf_Shdr sh;