aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorStephane Eranian <eranian@google.com>2015-11-30 04:02:21 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-02-05 07:46:45 -0500
commit8ee4646038e47d065d35703e3e343136c4cd42aa (patch)
tree37dbbebedf237db8ecb8921722bbfa459fef2197 /tools
parente9c4bcdd349eb00f6c704450a063b3dcbea25864 (diff)
perf build: Add libcrypto feature detection
Will be used to generate build-ids in the jitdump code. Signed-off-by: Stephane Eranian <eranian@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Carl Love <cel@us.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: John McCutchan <johnmccutchan@google.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Pawel Moll <pawel.moll@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sonny Rao <sonnyrao@chromium.org> Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Link: http://lkml.kernel.org/r/1448874143-7269-3-git-send-email-eranian@google.com [ tools/perf/Makefile.perf comment about NO_LIBCRYPTO and added it to tests/make ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/build/Makefile.feature2
-rw-r--r--tools/build/feature/Makefile4
-rw-r--r--tools/build/feature/test-all.c5
-rw-r--r--tools/build/feature/test-libcrypto.c17
-rw-r--r--tools/perf/Makefile.perf3
-rw-r--r--tools/perf/config/Makefile11
-rw-r--r--tools/perf/tests/make2
7 files changed, 44 insertions, 0 deletions
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index 7bff2ea831cf..6b7707270aa3 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -46,6 +46,7 @@ FEATURE_TESTS_BASIC := \
46 libpython \ 46 libpython \
47 libpython-version \ 47 libpython-version \
48 libslang \ 48 libslang \
49 libcrypto \
49 libunwind \ 50 libunwind \
50 pthread-attr-setaffinity-np \ 51 pthread-attr-setaffinity-np \
51 stackprotector-all \ 52 stackprotector-all \
@@ -87,6 +88,7 @@ FEATURE_DISPLAY ?= \
87 libperl \ 88 libperl \
88 libpython \ 89 libpython \
89 libslang \ 90 libslang \
91 libcrypto \
90 libunwind \ 92 libunwind \
91 libdw-dwarf-unwind \ 93 libdw-dwarf-unwind \
92 zlib \ 94 zlib \
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index bf8f0352264d..c5f4c417428d 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -23,6 +23,7 @@ FILES= \
23 test-libpython.bin \ 23 test-libpython.bin \
24 test-libpython-version.bin \ 24 test-libpython-version.bin \
25 test-libslang.bin \ 25 test-libslang.bin \
26 test-libcrypto.bin \
26 test-libunwind.bin \ 27 test-libunwind.bin \
27 test-libunwind-debug-frame.bin \ 28 test-libunwind-debug-frame.bin \
28 test-pthread-attr-setaffinity-np.bin \ 29 test-pthread-attr-setaffinity-np.bin \
@@ -105,6 +106,9 @@ $(OUTPUT)test-libaudit.bin:
105$(OUTPUT)test-libslang.bin: 106$(OUTPUT)test-libslang.bin:
106 $(BUILD) -I/usr/include/slang -lslang 107 $(BUILD) -I/usr/include/slang -lslang
107 108
109$(OUTPUT)test-libcrypto.bin:
110 $(BUILD) -lcrypto
111
108$(OUTPUT)test-gtk2.bin: 112$(OUTPUT)test-gtk2.bin:
109 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null) 113 $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
110 114
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index 81025cade45f..e499a36c1e4a 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -129,6 +129,10 @@
129# include "test-bpf.c" 129# include "test-bpf.c"
130#undef main 130#undef main
131 131
132#define main main_test_libcrypto
133# include "test-libcrypto.c"
134#undef main
135
132int main(int argc, char *argv[]) 136int main(int argc, char *argv[])
133{ 137{
134 main_test_libpython(); 138 main_test_libpython();
@@ -158,6 +162,7 @@ int main(int argc, char *argv[])
158 main_test_lzma(); 162 main_test_lzma();
159 main_test_get_cpuid(); 163 main_test_get_cpuid();
160 main_test_bpf(); 164 main_test_bpf();
165 main_test_libcrypto();
161 166
162 return 0; 167 return 0;
163} 168}
diff --git a/tools/build/feature/test-libcrypto.c b/tools/build/feature/test-libcrypto.c
new file mode 100644
index 000000000000..bd79dc7f28d3
--- /dev/null
+++ b/tools/build/feature/test-libcrypto.c
@@ -0,0 +1,17 @@
1#include <openssl/sha.h>
2#include <openssl/md5.h>
3
4int main(void)
5{
6 MD5_CTX context;
7 unsigned char md[MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH];
8 unsigned char dat[] = "12345";
9
10 MD5_Init(&context);
11 MD5_Update(&context, &dat[0], sizeof(dat));
12 MD5_Final(&md[0], &context);
13
14 SHA1(&dat[0], sizeof(dat), &md[0]);
15
16 return 0;
17}
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 0ef3d97d7954..d404117810a7 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -58,6 +58,9 @@ include config/utilities.mak
58# 58#
59# Define NO_LIBBIONIC if you do not want bionic support 59# Define NO_LIBBIONIC if you do not want bionic support
60# 60#
61# Define NO_LIBCRYPTO if you do not want libcrypto (openssl) support
62# used for generating build-ids for ELFs generated by jitdump.
63#
61# Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support 64# Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support
62# for dwarf backtrace post unwind. 65# for dwarf backtrace post unwind.
63# 66#
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 0045a5ddd0ca..f7aeaf303f5a 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -404,6 +404,17 @@ ifndef NO_LIBAUDIT
404 endif 404 endif
405endif 405endif
406 406
407ifndef NO_LIBCRYPTO
408 ifneq ($(feature-libcrypto), 1)
409 msg := $(warning No libcrypto.h found, disables jitted code injection, please install libssl-devel or libssl-dev);
410 NO_LIBCRYPTO := 1
411 else
412 CFLAGS += -DHAVE_LIBCRYPTO_SUPPORT
413 EXTLIBS += -lcrypto
414 $(call detected,CONFIG_CRYPTO)
415 endif
416endif
417
407ifdef NO_NEWT 418ifdef NO_NEWT
408 NO_SLANG=1 419 NO_SLANG=1
409endif 420endif
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index 12dcae7aa515..cac15d93aea6 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -80,6 +80,7 @@ make_no_libaudit := NO_LIBAUDIT=1
80make_no_libbionic := NO_LIBBIONIC=1 80make_no_libbionic := NO_LIBBIONIC=1
81make_no_auxtrace := NO_AUXTRACE=1 81make_no_auxtrace := NO_AUXTRACE=1
82make_no_libbpf := NO_LIBBPF=1 82make_no_libbpf := NO_LIBBPF=1
83make_no_libcrypto := NO_LIBCRYPTO=1
83make_tags := tags 84make_tags := tags
84make_cscope := cscope 85make_cscope := cscope
85make_help := help 86make_help := help
@@ -103,6 +104,7 @@ make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
103make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 104make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
104make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 105make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
105make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 106make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1
107make_minimal += NO_LIBCRYPTO=1
106 108
107# $(run) contains all available tests 109# $(run) contains all available tests
108run := make_pure 110run := make_pure