Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf unwind: Do not put libunwind-{x86,aarch64} in FEATURE_TESTS_BASIC

As it is not normally available on x86_64 not being tested on test-all.c
but being in FEATURE_TESTS_BASIC ends up implying that those features
are present, which leads to trying to link with those libraries and a
build failure now that test-all.c is finally again building
successfully:

/usr/bin/ld: cannot find -lunwind-x86
/usr/bin/ld: cannot find -lunwind-aarch64
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:199: /tmp/build/perf/plugin_jbd2.so] Error 1
make[3]: *** Waiting for unfinished jobs....
/usr/bin/ld: cannot find -lunwind-x86
/usr/bin/ld: cannot find -lunwind-aarch64

So remove those features from there and explicitely test them.

And then move this patch to just before the last one that allows this to
be exposed, so that we keep the tree bisectable.

With all this in place we get, at this point:

$ ldd /tmp/build/perf/feature/test-libunwind.bin
linux-vdso.so.1 (0x00007fffa09c6000)
libunwind-x86_64.so.8 => /lib64/libunwind-x86_64.so.8 (0x00007fbcf4451000)
libunwind.so.8 => /lib64/libunwind.so.8 (0x00007fbcf4435000)
liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fbcf440c000)
libelf.so.1 => /lib64/libelf.so.1 (0x00007fbcf43f2000)
libc.so.6 => /lib64/libc.so.6 (0x00007fbcf422c000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fbcf4211000)
/lib64/ld-linux-x86-64.so.2 (0x00007fbcf4491000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fbcf41ed000)
libz.so.1 => /lib64/libz.so.1 (0x00007fbcf41d3000)
$ cat /tmp/build/perf/feature/test-libunwind-x86.make.output
test-libunwind-x86.c:2:10: fatal error: libunwind-x86.h: No such file or directory
#include <libunwind-x86.h>
^~~~~~~~~~~~~~~~~
compilation terminated.
$ cat /tmp/build/perf/feature/test-libunwind-aarch64.make.output
test-libunwind-aarch64.c:2:10: fatal error: libunwind-aarch64.h: No such file or directory
#include <libunwind-aarch64.h>
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
$
$ ldd ~/bin/perf | grep unwind
libunwind-x86_64.so.8 => /lib64/libunwind-x86_64.so.8 (0x00007f5ceb24b000)
libunwind.so.8 => /lib64/libunwind.so.8 (0x00007f5ceb22f000)
$

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Will Deacon <will.deacon@arm.com>
Link: https://lkml.kernel.org/n/tip-vs6kwqsvwk7oxhs6z9mq87pp@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+11 -4
+4 -4
tools/build/Makefile.feature
··· 53 53 libslang \ 54 54 libcrypto \ 55 55 libunwind \ 56 - libunwind-x86 \ 57 - libunwind-x86_64 \ 58 - libunwind-arm \ 59 - libunwind-aarch64 \ 60 56 pthread-attr-setaffinity-np \ 61 57 pthread-barrier \ 62 58 reallocarray \ ··· 80 84 libbfd-liberty \ 81 85 libbfd-liberty-z \ 82 86 libopencsd \ 87 + libunwind-x86 \ 88 + libunwind-x86_64 \ 89 + libunwind-arm \ 90 + libunwind-aarch64 \ 83 91 libunwind-debug-frame \ 84 92 libunwind-debug-frame-arm \ 85 93 libunwind-debug-frame-aarch64 \
+7
tools/perf/Makefile.config
··· 109 109 FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS) 110 110 FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS) $(LIBUNWIND_LIBS) 111 111 112 + FEATURE_CHECK_LDFLAGS-libunwind-arm = -lunwind -lunwind-arm 113 + FEATURE_CHECK_LDFLAGS-libunwind-aarch64 = -lunwind -lunwind-aarch64 114 + FEATURE_CHECK_LDFLAGS-libunwind-x86 = -lunwind -llzma -lunwind-x86 115 + FEATURE_CHECK_LDFLAGS-libunwind-x86_64 = -lunwind -llzma -lunwind-x86_64 116 + 112 117 ifdef CSINCLUDES 113 118 LIBOPENCSD_CFLAGS := -I$(CSINCLUDES) 114 119 endif ··· 490 485 ifndef NO_LIBUNWIND 491 486 have_libunwind := 492 487 488 + $(call feature_check,libunwind-x86) 493 489 ifeq ($(feature-libunwind-x86), 1) 494 490 $(call detected,CONFIG_LIBUNWIND_X86) 495 491 CFLAGS += -DHAVE_LIBUNWIND_X86_SUPPORT ··· 499 493 have_libunwind = 1 500 494 endif 501 495 496 + $(call feature_check,libunwind-aarch64) 502 497 ifeq ($(feature-libunwind-aarch64), 1) 503 498 $(call detected,CONFIG_LIBUNWIND_AARCH64) 504 499 CFLAGS += -DHAVE_LIBUNWIND_AARCH64_SUPPORT