diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 62d02cd03f29d184b28df5967ecc563f5c5bd913..89b2d47d2e4bb94145d71661582d1722a9e3110f 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -472,23 +472,19 @@ else EXTLIBS += -liberty CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT else - FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd ifeq ($(feature-libbfd), 1) EXTLIBS += -lbfd else - FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty - has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty) - ifeq ($(has_bfd_iberty),y) + $(feature_check,liberty) + ifeq ($(feature-liberty), 1) EXTLIBS += -lbfd -liberty else - FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz - has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz) - ifeq ($(has_bfd_iberty_z),y) + $(feature_check,liberty-z) + ifeq ($(feature-liberty-z), 1) EXTLIBS += -lbfd -liberty -lz else - FLAGS_CPLUS_DEMANGLE=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -liberty - has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle) - ifeq ($(has_cplus_demangle),y) + $(feature_check,cplus-demangle) + ifeq ($(feature-cplus-demangle), 1) EXTLIBS += -liberty CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT else diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile index d4c55acc82bba985bb0095528d34ad6f21aba4d5..e21bceb80bf2e38d932a3507cc8038e7c8cd380c 100644 --- a/tools/perf/config/feature-checks/Makefile +++ b/tools/perf/config/feature-checks/Makefile @@ -11,6 +11,9 @@ FILES= \ test-hello \ test-libaudit \ test-libbfd \ + test-liberty \ + test-liberty-z \ + test-cplus-demangle \ test-libelf \ test-libelf-getphdrnum \ test-libelf-mmap \ @@ -122,6 +125,15 @@ test-libpython-version: test-libbfd: $(BUILD) -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl +test-liberty: + $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl -liberty + +test-liberty-z: + $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='perf' -DPACKAGE=perf -lbfd -ldl -liberty -lz + +test-cplus-demangle: + $(BUILD) -liberty + test-on-exit: $(BUILD) diff --git a/tools/perf/config/feature-checks/test-cplus-demangle.c b/tools/perf/config/feature-checks/test-cplus-demangle.c new file mode 100644 index 0000000000000000000000000000000000000000..5202f5038ad8cb37ef68254b972036a8dc26174f --- /dev/null +++ b/tools/perf/config/feature-checks/test-cplus-demangle.c @@ -0,0 +1,10 @@ + +extern char *cplus_demangle(const char *, int); + +int main(void) +{ + cplus_demangle(0, 0); + + return 0; +} +