lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-80y0eldgweorqnwha9rvfxjr@git.kernel.org>
Date:	Tue, 5 Jul 2016 03:18:18 -0700
From:	tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To:	linux-tip-commits@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org, namhyung@...nel.org, acme@...hat.com,
	tglx@...utronix.de, hpa@...or.com, ananth@...ux.vnet.ibm.com,
	brendan.d.gregg@...il.com, peterz@...radead.org,
	mhiramat@...nel.org, hemant@...ux.vnet.ibm.com, mingo@...nel.org
Subject: [tip:perf/core] perf build: Add feature detection for libelf's
 elf_getshdrstrndx()

Commit-ID:  2492c465ad3ae6860ebfff1c9032865017835e70
Gitweb:     http://git.kernel.org/tip/2492c465ad3ae6860ebfff1c9032865017835e70
Author:     Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Mon, 4 Jul 2016 19:35:47 -0300
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Mon, 4 Jul 2016 19:38:59 -0300

perf build: Add feature detection for libelf's elf_getshdrstrndx()

That appeared after 0.140, and will be used in the SDT code, so, to
avoid bisection break on older systems, add a feature detection and
provide a stub with a pr_debug() to keep it building.

Cc: Ananth N Mavinakayanahalli <ananth@...ux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@...il.com>
Cc: Hemant Kumar <hemant@...ux.vnet.ibm.com>
Cc: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: http://lkml.kernel.org/n/tip-80y0eldgweorqnwha9rvfxjr@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/build/Makefile.feature                                      | 1 +
 tools/build/feature/Makefile                                      | 4 ++++
 tools/build/feature/test-all.c                                    | 5 +++++
 .../{test-libelf-getphdrnum.c => test-libelf-getshdrstrndx.c}     | 2 +-
 tools/perf/config/Makefile                                        | 4 ++++
 tools/perf/util/symbol-elf.c                                      | 8 ++++++++
 6 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 57c8f98..3dd529b 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -40,6 +40,7 @@ FEATURE_TESTS_BASIC :=			\
 	libbfd				\
 	libelf				\
 	libelf-getphdrnum		\
+	libelf-getshdrstrndx		\
 	libelf-mmap			\
 	libnuma				\
 	numa_num_possible_cpus		\
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 3d88f09..6747116 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -17,6 +17,7 @@ FILES=					\
 	test-cplus-demangle.bin		\
 	test-libelf.bin			\
 	test-libelf-getphdrnum.bin	\
+	test-libelf-getshdrstrndx.bin	\
 	test-libelf-mmap.bin		\
 	test-libnuma.bin		\
 	test-numa_num_possible_cpus.bin	\
@@ -98,6 +99,9 @@ $(OUTPUT)test-libelf-mmap.bin:
 $(OUTPUT)test-libelf-getphdrnum.bin:
 	$(BUILD) -lelf
 
+$(OUTPUT)test-libelf-getshdrstrndx.bin:
+	$(BUILD) -lelf
+
 $(OUTPUT)test-libnuma.bin:
 	$(BUILD) -lnuma
 
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index a282e8c..7433cca 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -49,6 +49,10 @@
 # include "test-libelf-getphdrnum.c"
 #undef main
 
+#define main main_test_libelf_getshdrstrndx
+# include "test-libelf-getshdrstrndx.c"
+#undef main
+
 #define main main_test_libunwind
 # include "test-libunwind.c"
 #undef main
@@ -149,6 +153,7 @@ int main(int argc, char *argv[])
 	main_test_dwarf();
 	main_test_dwarf_getlocations();
 	main_test_libelf_getphdrnum();
+	main_test_libelf_getshdrstrndx();
 	main_test_libunwind();
 	main_test_libaudit();
 	main_test_libslang();
diff --git a/tools/build/feature/test-libelf-getphdrnum.c b/tools/build/feature/test-libelf-getshdrstrndx.c
similarity index 60%
copy from tools/build/feature/test-libelf-getphdrnum.c
copy to tools/build/feature/test-libelf-getshdrstrndx.c
index d710459..f0c3b47 100644
--- a/tools/build/feature/test-libelf-getphdrnum.c
+++ b/tools/build/feature/test-libelf-getshdrstrndx.c
@@ -4,5 +4,5 @@ int main(void)
 {
 	size_t dst;
 
-	return elf_getphdrnum(0, &dst);
+	return elf_getshdrstrndx(0, &dst);
 }
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index bf1a0a0..c7e269a 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -309,6 +309,10 @@ ifndef NO_LIBELF
     CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
   endif
 
+  ifeq ($(feature-libelf-getshdrstrndx), 1)
+    CFLAGS += -DHAVE_ELF_GETSHDRSTRNDX_SUPPORT
+  endif
+
   ifndef NO_DWARF
     ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
       msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 87a297d..b222552c 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -54,6 +54,14 @@ static int elf_getphdrnum(Elf *elf, size_t *dst)
 }
 #endif
 
+#ifndef HAVE_ELF_GETSHDRSTRNDX_SUPPORT
+static int elf_getshdrstrndx(Elf *elf __maybe_unused, size_t *dst __maybe_unused)
+{
+	pr_err("%s: update your libelf to > 0.140, this one lacks elf_getshdrstrndx().\n", __func__);
+	return -1;
+}
+#endif
+
 #ifndef NT_GNU_BUILD_ID
 #define NT_GNU_BUILD_ID 3
 #endif

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ