Skip to content

Commit 8ee4646

Browse files
Stephane Eranianacmel
authored andcommitted
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>
1 parent e9c4bcd commit 8ee4646

7 files changed

Lines changed: 44 additions & 0 deletions

File tree

‎tools/build/Makefile.feature‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ FEATURE_TESTS_BASIC := \
4646
libpython \
4747
libpython-version \
4848
libslang \
49+
libcrypto \
4950
libunwind \
5051
pthread-attr-setaffinity-np \
5152
stackprotector-all \
@@ -87,6 +88,7 @@ FEATURE_DISPLAY ?= \
8788
libperl \
8889
libpython \
8990
libslang \
91+
libcrypto \
9092
libunwind \
9193
libdw-dwarf-unwind \
9294
zlib \

‎tools/build/feature/Makefile‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ FILES= \
2323
test-libpython.bin \
2424
test-libpython-version.bin \
2525
test-libslang.bin \
26+
test-libcrypto.bin \
2627
test-libunwind.bin \
2728
test-libunwind-debug-frame.bin \
2829
test-pthread-attr-setaffinity-np.bin \
@@ -105,6 +106,9 @@ $(OUTPUT)test-libaudit.bin:
105106
$(OUTPUT)test-libslang.bin:
106107
$(BUILD) -I/usr/include/slang -lslang
107108

109+
$(OUTPUT)test-libcrypto.bin:
110+
$(BUILD) -lcrypto
111+
108112
$(OUTPUT)test-gtk2.bin:
109113
$(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
110114

‎tools/build/feature/test-all.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@
129129
# include "test-bpf.c"
130130
#undef main
131131

132+
#define main main_test_libcrypto
133+
# include "test-libcrypto.c"
134+
#undef main
135+
132136
int main(int argc, char *argv[])
133137
{
134138
main_test_libpython();
@@ -158,6 +162,7 @@ int main(int argc, char *argv[])
158162
main_test_lzma();
159163
main_test_get_cpuid();
160164
main_test_bpf();
165+
main_test_libcrypto();
161166

162167
return 0;
163168
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include <openssl/sha.h>
2+
#include <openssl/md5.h>
3+
4+
int 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+
}

‎tools/perf/Makefile.perf‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ include config/utilities.mak
5858
#
5959
# Define NO_LIBBIONIC if you do not want bionic support
6060
#
61+
# Define NO_LIBCRYPTO if you do not want libcrypto (openssl) support
62+
# used for generating build-ids for ELFs generated by jitdump.
63+
#
6164
# Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support
6265
# for dwarf backtrace post unwind.
6366
#

‎tools/perf/config/Makefile‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,17 @@ ifndef NO_LIBAUDIT
404404
endif
405405
endif
406406

407+
ifndef 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
416+
endif
417+
407418
ifdef NO_NEWT
408419
NO_SLANG=1
409420
endif

‎tools/perf/tests/make‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ make_no_libaudit := NO_LIBAUDIT=1
8080
make_no_libbionic := NO_LIBBIONIC=1
8181
make_no_auxtrace := NO_AUXTRACE=1
8282
make_no_libbpf := NO_LIBBPF=1
83+
make_no_libcrypto := NO_LIBCRYPTO=1
8384
make_tags := tags
8485
make_cscope := cscope
8586
make_help := help
@@ -103,6 +104,7 @@ make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
103104
make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
104105
make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
105106
make_minimal += NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1
107+
make_minimal += NO_LIBCRYPTO=1
106108

107109
# $(run) contains all available tests
108110
run := make_pure

0 commit comments

Comments
 (0)