diff options
Diffstat (limited to 'tools/perf/config')
31 files changed, 393 insertions, 792 deletions
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index f7d11a8..5f6f9b3 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile @@ -23,21 +23,15 @@ ifeq ($(ARCH),x86_64) endif ifeq (${IS_X86_64}, 1) RAW_ARCH := x86_64 - CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT + CFLAGS += -DARCH_X86_64 ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S - LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 - else - LIBUNWIND_LIBS = -lunwind -lunwind-x86 endif NO_PERF_REGS := 0 -endif -ifeq ($(ARCH),arm) - NO_PERF_REGS := 0 - LIBUNWIND_LIBS = -lunwind -lunwind-arm + LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 endif ifeq ($(NO_PERF_REGS),0) - CFLAGS += -DHAVE_PERF_REGS_SUPPORT + CFLAGS += -DHAVE_PERF_REGS endif ifeq ($(src-perf),) @@ -57,6 +51,7 @@ LIB_INCLUDE := $(srctree)/tools/lib/ # include ARCH specific config -include $(src-perf)/arch/$(ARCH)/Makefile +include $(src-perf)/config/feature-tests.mak include $(src-perf)/config/utilities.mak ifeq ($(call get-executable,$(FLEX)),) @@ -72,11 +67,10 @@ ifneq ($(WERROR),0) CFLAGS += -Werror endif -ifndef DEBUG - DEBUG := 0 +ifeq ("$(origin DEBUG)", "command line") + PERF_DEBUG = $(DEBUG) endif - -ifeq ($(DEBUG),0) +ifndef PERF_DEBUG CFLAGS += -O6 endif @@ -95,126 +89,20 @@ CFLAGS += -std=gnu99 EXTLIBS = -lelf -lpthread -lrt -lm -ldl -ifneq ($(OUTPUT),) - OUTPUT_FEATURES = $(OUTPUT)config/feature-checks/ - $(shell mkdir -p $(OUTPUT_FEATURES)) -endif - -feature_check = $(eval $(feature_check_code)) -define feature_check_code - feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0) -endef - -feature_set = $(eval $(feature_set_code)) -define feature_set_code - feature-$(1) := 1 -endef - -# -# Build the feature check binaries in parallel, ignore errors, ignore return value and suppress output: -# - -# -# Note that this is not a complete list of all feature tests, just -# those that are typically built on a fully configured system. -# -# [ Feature tests not mentioned here have to be built explicitly in -# the rule that uses them - an example for that is the 'bionic' -# feature check. ] -# -CORE_FEATURE_TESTS = \ - backtrace \ - dwarf \ - fortify-source \ - glibc \ - gtk2 \ - gtk2-infobar \ - libaudit \ - libbfd \ - libelf \ - libelf-getphdrnum \ - libelf-mmap \ - libnuma \ - libperl \ - libpython \ - libpython-version \ - libslang \ - libunwind \ - on-exit \ - stackprotector \ - stackprotector-all \ - timerfd - -# -# So here we detect whether test-all was rebuilt, to be able -# to skip the print-out of the long features list if the file -# existed before and after it was built: -# -ifeq ($(wildcard $(OUTPUT)config/feature-checks/test-all),) - test-all-failed := 1 -else - test-all-failed := 0 -endif - -# -# Special fast-path for the 'all features are available' case: -# -$(call feature_check,all,$(MSG)) - -# -# Just in case the build freshly failed, make sure we print the -# feature matrix: -# -ifeq ($(feature-all), 0) - test-all-failed := 1 -endif - -ifeq ($(test-all-failed),1) - $(info ) - $(info Auto-detecting system features:) -endif - -ifeq ($(feature-all), 1) - # - # test-all.c passed - just set all the core feature flags to 1: - # - $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat))) -else - $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(CORE_FEATURE_TESTS) >/dev/null 2>&1) - $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat))) -endif - -# -# Print the result of the feature test: -# -feature_print = $(eval $(feature_print_code)) $(info $(MSG)) - -define feature_print_code - ifeq ($(feature-$(1)), 1) - MSG = $(shell printf '...%30s: [ \033[32mon\033[m ]' $(1)) - else - MSG = $(shell printf '...%30s: [ \033[31mOFF\033[m ]' $(1)) - endif -endef - -# -# Only print out our features if we rebuilt the testcases or if a test failed: -# -ifeq ($(test-all-failed), 1) - $(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_print,$(feat))) - $(info ) -endif - -ifeq ($(feature-stackprotector-all), 1) +ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y) CFLAGS += -fstack-protector-all endif -ifeq ($(feature-stackprotector), 1) +ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y) CFLAGS += -Wstack-protector endif -ifeq ($(DEBUG),0) - ifeq ($(feature-fortify-source), 1) +ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y) + CFLAGS += -Wvolatile-register-var +endif + +ifndef PERF_DEBUG + ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y) CFLAGS += -D_FORTIFY_SOURCE=2 endif endif @@ -240,121 +128,120 @@ CFLAGS += -I$(LIB_INCLUDE) CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE ifndef NO_BIONIC - $(call feature_check,bionic) - ifeq ($(feature-bionic), 1) - BIONIC := 1 - EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) - EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) - endif +ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y) + BIONIC := 1 + EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) + EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) endif +endif # NO_BIONIC ifdef NO_LIBELF NO_DWARF := 1 NO_DEMANGLE := 1 NO_LIBUNWIND := 1 else - ifeq ($(feature-libelf), 0) - ifeq ($(feature-glibc), 1) - LIBC_SUPPORT := 1 - endif - ifeq ($(BIONIC),1) - LIBC_SUPPORT := 1 - endif - ifeq ($(LIBC_SUPPORT),1) - msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev); +FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) +ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y) + FLAGS_GLIBC=$(CFLAGS) $(LDFLAGS) + ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y) + LIBC_SUPPORT := 1 + endif + ifeq ($(BIONIC),1) + LIBC_SUPPORT := 1 + endif + ifeq ($(LIBC_SUPPORT),1) + msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev); - NO_LIBELF := 1 - NO_DWARF := 1 - NO_DEMANGLE := 1 - else - msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); - endif + NO_LIBELF := 1 + NO_DWARF := 1 + NO_DEMANGLE := 1 else - # for linking with debug library, run like: - # make DEBUG=1 LIBDW_DIR=/opt/libdw/ - ifdef LIBDW_DIR - LIBDW_CFLAGS := -I$(LIBDW_DIR)/include - LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib - endif + msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); + endif +else + # for linking with debug library, run like: + # make DEBUG=1 LIBDW_DIR=/opt/libdw/ + ifdef LIBDW_DIR + LIBDW_CFLAGS := -I$(LIBDW_DIR)/include + LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib + endif - ifneq ($(feature-dwarf), 1) - msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); - NO_DWARF := 1 - endif # Dwarf support - endif # libelf support + FLAGS_DWARF=$(CFLAGS) $(LIBDW_CFLAGS) -ldw -lz -lelf $(LIBDW_LDFLAGS) $(LDFLAGS) $(EXTLIBS) + ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y) + msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev); + NO_DWARF := 1 + endif # Dwarf support +endif # SOURCE_LIBELF endif # NO_LIBELF ifndef NO_LIBELF - CFLAGS += -DHAVE_LIBELF_SUPPORT +CFLAGS += -DLIBELF_SUPPORT +FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) +ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y) + CFLAGS += -DLIBELF_MMAP +endif +ifeq ($(call try-cc,$(SOURCE_ELF_GETPHDRNUM),$(FLAGS_LIBELF),-DHAVE_ELF_GETPHDRNUM),y) + CFLAGS += -DHAVE_ELF_GETPHDRNUM +endif - ifeq ($(feature-libelf-mmap), 1) - CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT - endif +# include ARCH specific config +-include $(src-perf)/arch/$(ARCH)/Makefile - ifeq ($(feature-libelf-getphdrnum), 1) - CFLAGS += -DHAVE_ELF_GETPHDRNUM_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); + NO_DWARF := 1 +else + CFLAGS += -DDWARF_SUPPORT $(LIBDW_CFLAGS) + LDFLAGS += $(LIBDW_LDFLAGS) + EXTLIBS += -lelf -ldw +endif # PERF_HAVE_DWARF_REGS +endif # NO_DWARF - # include ARCH specific config - -include $(src-perf)/arch/$(ARCH)/Makefile +endif # NO_LIBELF - 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); - NO_DWARF := 1 - else - CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) - LDFLAGS += $(LIBDW_LDFLAGS) - EXTLIBS += -lelf -ldw - endif # PERF_HAVE_DWARF_REGS - endif # NO_DWARF +ifndef NO_LIBELF +CFLAGS += -DLIBELF_SUPPORT +FLAGS_LIBELF=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) +ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y) + CFLAGS += -DLIBELF_MMAP +endif # try-cc endif # NO_LIBELF -ifeq ($(LIBUNWIND_LIBS),) +# There's only x86 (both 32 and 64) support for CFI unwind so far +ifneq ($(ARCH),x86) NO_LIBUNWIND := 1 endif ifndef NO_LIBUNWIND - # - # For linking with debug library, run like: - # - # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ - # - ifdef LIBUNWIND_DIR - LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include - LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib - endif - - ifneq ($(feature-libunwind), 1) - msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1); - NO_LIBUNWIND := 1 - else - ifeq ($(ARCH),arm) - $(call feature_check,libunwind-debug-frame) - ifneq ($(feature-libunwind-debug-frame), 1) - msg := $(warning No debug_frame support found in libunwind); - CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME - endif - else - # non-ARM has no dwarf_find_debug_frame() function: - CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME - endif - endif +# for linking with debug library, run like: +# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ +ifdef LIBUNWIND_DIR + LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include + LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib endif +FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(CFLAGS) $(LIBUNWIND_LDFLAGS) $(LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS) +ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y) + msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); + NO_LIBUNWIND := 1 +endif # Libunwind support +endif # NO_LIBUNWIND + ifndef NO_LIBUNWIND - CFLAGS += -DHAVE_LIBUNWIND_SUPPORT + CFLAGS += -DLIBUNWIND_SUPPORT EXTLIBS += $(LIBUNWIND_LIBS) CFLAGS += $(LIBUNWIND_CFLAGS) LDFLAGS += $(LIBUNWIND_LDFLAGS) -endif +endif # NO_LIBUNWIND ifndef NO_LIBAUDIT - ifneq ($(feature-libaudit), 1) + FLAGS_LIBAUDIT = $(CFLAGS) $(LDFLAGS) -laudit + ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y) msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); NO_LIBAUDIT := 1 else - CFLAGS += -DHAVE_LIBAUDIT_SUPPORT + CFLAGS += -DLIBAUDIT_SUPPORT EXTLIBS += -laudit endif endif @@ -364,30 +251,30 @@ ifdef NO_NEWT endif ifndef NO_SLANG - ifneq ($(feature-libslang), 1) + FLAGS_SLANG=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang + ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y) msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev); NO_SLANG := 1 else # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h CFLAGS += -I/usr/include/slang - CFLAGS += -DHAVE_SLANG_SUPPORT + CFLAGS += -DSLANG_SUPPORT EXTLIBS += -lslang endif endif ifndef NO_GTK2 FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) - ifneq ($(feature-gtk2), 1) + ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y) msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); NO_GTK2 := 1 else - ifeq ($(feature-gtk2-infobar), 1) - GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT + ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y) + CFLAGS += -DHAVE_GTK_INFO_BAR endif - CFLAGS += -DHAVE_GTK2_SUPPORT - GTK_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) - GTK_LIBS := $(shell pkg-config --libs gtk+-2.0 2>/dev/null) - EXTLIBS += -ldl + CFLAGS += -DGTK2_SUPPORT + CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) + EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null) endif endif @@ -403,7 +290,7 @@ else PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) - ifneq ($(feature-libperl), 1) + ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED),perl),y) CFLAGS += -DNO_LIBPERL NO_LIBPERL := 1 else @@ -412,12 +299,6 @@ else endif endif -ifeq ($(feature-timerfd), 1) - CFLAGS += -DHAVE_TIMERFD_SUPPORT -else - msg := $(warning No timerfd support. Disables 'perf kvm stat live'); -endif - disable-python = $(eval $(disable-python_code)) define disable-python_code CFLAGS += -DNO_LIBPYTHON @@ -454,11 +335,11 @@ else PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) - ifneq ($(feature-libpython), 1) + ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED),python),y) $(call disable-python,Python.h (for Python 2.x)) else - ifneq ($(feature-libpython-version), 1) + ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED),python version),y) $(warning Python 3 is not yet supported; please set) $(warning PYTHON and/or PYTHON_CONFIG appropriately.) $(warning If you also have Python 2 installed, then) @@ -481,30 +362,33 @@ else endif endif -ifeq ($(feature-libbfd), 1) - EXTLIBS += -lbfd -endif - ifdef NO_DEMANGLE CFLAGS += -DNO_DEMANGLE else - ifdef HAVE_CPLUS_DEMANGLE_SUPPORT + ifdef HAVE_CPLUS_DEMANGLE EXTLIBS += -liberty - CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT + CFLAGS += -DHAVE_CPLUS_DEMANGLE else - ifneq ($(feature-libbfd), 1) - $(call feature_check,liberty) - ifeq ($(feature-liberty), 1) + FLAGS_BFD=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd + has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) + ifeq ($(has_bfd),y) + 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) EXTLIBS += -lbfd -liberty else - $(call feature_check,liberty-z) - ifeq ($(feature-liberty-z), 1) + 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) EXTLIBS += -lbfd -liberty -lz else - $(call feature_check,cplus-demangle) - ifeq ($(feature-cplus-demangle), 1) + 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) EXTLIBS += -liberty - CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT + CFLAGS += -DHAVE_CPLUS_DEMANGLE else msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling) CFLAGS += -DNO_DEMANGLE @@ -515,28 +399,31 @@ else endif endif -ifneq ($(filter -lbfd,$(EXTLIBS)),) - CFLAGS += -DHAVE_LIBBFD_SUPPORT +ifndef NO_STRLCPY + ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y) + CFLAGS += -DHAVE_STRLCPY + endif endif ifndef NO_ON_EXIT - ifeq ($(feature-on-exit), 1) - CFLAGS += -DHAVE_ON_EXIT_SUPPORT + ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT),y) + CFLAGS += -DHAVE_ON_EXIT endif endif ifndef NO_BACKTRACE - ifeq ($(feature-backtrace), 1) - CFLAGS += -DHAVE_BACKTRACE_SUPPORT + ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y) + CFLAGS += -DBACKTRACE_SUPPORT endif endif ifndef NO_LIBNUMA - ifeq ($(feature-libnuma), 0) + FLAGS_LIBNUMA = $(CFLAGS) $(LDFLAGS) -lnuma + ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y) msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev); NO_LIBNUMA := 1 else - CFLAGS += -DHAVE_LIBNUMA_SUPPORT + CFLAGS += -DLIBNUMA_SUPPORT EXTLIBS += -lnuma endif endif @@ -572,12 +459,7 @@ else sysconfdir = $(prefix)/etc ETC_PERFCONFIG = etc/perfconfig endif -ifeq ($(IS_X86_64),1) -lib = lib64 -else lib = lib -endif -libdir = $(prefix)/$(lib) # Shell quote (do not use $(call) to accommodate ancient setups); ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG)) @@ -590,7 +472,6 @@ template_dir_SQ = $(subst ','\'',$(template_dir)) htmldir_SQ = $(subst ','\'',$(htmldir)) prefix_SQ = $(subst ','\'',$(prefix)) sysconfdir_SQ = $(subst ','\'',$(sysconfdir)) -libdir_SQ = $(subst ','\'',$(libdir)) ifneq ($(filter /%,$(firstword $(perfexecdir))),) perfexec_instdir = $(perfexecdir) diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile deleted file mode 100644 index 87e7900..0000000 --- a/tools/perf/config/feature-checks/Makefile +++ /dev/null @@ -1,152 +0,0 @@ - -FILES= \ - test-all \ - test-backtrace \ - test-bionic \ - test-dwarf \ - test-fortify-source \ - test-glibc \ - test-gtk2 \ - test-gtk2-infobar \ - test-hello \ - test-libaudit \ - test-libbfd \ - test-liberty \ - test-liberty-z \ - test-cplus-demangle \ - test-libelf \ - test-libelf-getphdrnum \ - test-libelf-mmap \ - test-libnuma \ - test-libperl \ - test-libpython \ - test-libpython-version \ - test-libslang \ - test-libunwind \ - test-libunwind-debug-frame \ - test-on-exit \ - test-stackprotector-all \ - test-stackprotector \ - test-timerfd - -CC := $(CC) -MD - -all: $(FILES) - -BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ $@.c - -############################### - -test-all: - $(BUILD) -Werror -fstack-protector -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma $(LIBUNWIND_LIBS) -lelf -laudit -I/usr/include/slang -lslang $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl - -test-hello: - $(BUILD) - -test-stackprotector-all: - $(BUILD) -Werror -fstack-protector-all - -test-stackprotector: - $(BUILD) -Werror -fstack-protector -Wstack-protector - -test-fortify-source: - $(BUILD) -O2 -Werror -D_FORTIFY_SOURCE=2 - -test-bionic: - $(BUILD) - -test-libelf: - $(BUILD) -lelf - -test-glibc: - $(BUILD) - -test-dwarf: - $(BUILD) -ldw - -test-libelf-mmap: - $(BUILD) -lelf - -test-libelf-getphdrnum: - $(BUILD) -lelf - -test-libnuma: - $(BUILD) -lnuma - -test-libunwind: - $(BUILD) $(LIBUNWIND_LIBS) -lelf - -test-libunwind-debug-frame: - $(BUILD) $(LIBUNWIND_LIBS) -lelf - -test-libaudit: - $(BUILD) -laudit - -test-libslang: - $(BUILD) -I/usr/include/slang -lslang - -test-gtk2: - $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) - -test-gtk2-infobar: - $(BUILD) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) - -grep-libs = $(filter -l%,$(1)) -strip-libs = $(filter-out -l%,$(1)) - -PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) -PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) -PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) -PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` -FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) - -test-libperl: - $(BUILD) $(FLAGS_PERL_EMBED) - -override PYTHON := python -override PYTHON_CONFIG := python-config - -escape-for-shell-sq = $(subst ','\'',$(1)) -shell-sq = '$(escape-for-shell-sq)' - -PYTHON_CONFIG_SQ = $(call shell-sq,$(PYTHON_CONFIG)) - -PYTHON_EMBED_LDOPTS = $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) -PYTHON_EMBED_LDFLAGS = $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) -PYTHON_EMBED_LIBADD = $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -PYTHON_EMBED_CCOPTS = $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) -FLAGS_PYTHON_EMBED = $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) - -test-libpython: - $(BUILD) $(FLAGS_PYTHON_EMBED) - -test-libpython-version: - $(BUILD) $(FLAGS_PYTHON_EMBED) - -test-libbfd: - $(BUILD) -DPACKAGE='"perf"' -lbfd -ldl - -test-liberty: - $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty - -test-liberty-z: - $(CC) -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz - -test-cplus-demangle: - $(BUILD) -liberty - -test-on-exit: - $(BUILD) - -test-backtrace: - $(BUILD) - -test-timerfd: - $(BUILD) - --include *.d - -############################### - -clean: - rm -f $(FILES) *.d diff --git a/tools/perf/config/feature-checks/test-all.c b/tools/perf/config/feature-checks/test-all.c deleted file mode 100644 index 59e7a70..0000000 --- a/tools/perf/config/feature-checks/test-all.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * test-all.c: Try to build all the main testcases at once. - * - * A well-configured system will have all the prereqs installed, so we can speed - * up auto-detection on such systems. - */ - -/* - * Quirk: Python and Perl headers cannot be in arbitrary places, so keep - * these 3 testcases at the top: - */ -#define main main_test_libpython -# include "test-libpython.c" -#undef main - -#define main main_test_libpython_version -# include "test-libpython-version.c" -#undef main - -#define main main_test_libperl -# include "test-libperl.c" -#undef main - -#define main main_test_hello -# include "test-hello.c" -#undef main - -#define main main_test_libelf -# include "test-libelf.c" -#undef main - -#define main main_test_libelf_mmap -# include "test-libelf-mmap.c" -#undef main - -#define main main_test_glibc -# include "test-glibc.c" -#undef main - -#define main main_test_dwarf -# include "test-dwarf.c" -#undef main - -#define main main_test_libelf_getphdrnum -# include "test-libelf-getphdrnum.c" -#undef main - -#define main main_test_libunwind -# include "test-libunwind.c" -#undef main - -#define main main_test_libaudit -# include "test-libaudit.c" -#undef main - -#define main main_test_libslang -# include "test-libslang.c" -#undef main - -#define main main_test_gtk2 -# include "test-gtk2.c" -#undef main - -#define main main_test_gtk2_infobar -# include "test-gtk2-infobar.c" -#undef main - -#define main main_test_libbfd -# include "test-libbfd.c" -#undef main - -#define main main_test_on_exit -# include "test-on-exit.c" -#undef main - -#define main main_test_backtrace -# include "test-backtrace.c" -#undef main - -#define main main_test_libnuma -# include "test-libnuma.c" -#undef main - -#define main main_test_timerfd -# include "test-timerfd.c" -#undef main - -int main(int argc, char *argv[]) -{ - main_test_libpython(); - main_test_libpython_version(); - main_test_libperl(); - main_test_hello(); - main_test_libelf(); - main_test_libelf_mmap(); - main_test_glibc(); - main_test_dwarf(); - main_test_libelf_getphdrnum(); - main_test_libunwind(); - main_test_libaudit(); - main_test_libslang(); - main_test_gtk2(argc, argv); - main_test_gtk2_infobar(argc, argv); - main_test_libbfd(); - main_test_on_exit(); - main_test_backtrace(); - main_test_libnuma(); - main_test_timerfd(); - - return 0; -} diff --git a/tools/perf/config/feature-checks/test-backtrace.c b/tools/perf/config/feature-checks/test-backtrace.c deleted file mode 100644 index 7124aa1..0000000 --- a/tools/perf/config/feature-checks/test-backtrace.c +++ /dev/null @@ -1,13 +0,0 @@ -#include <execinfo.h> -#include <stdio.h> - -int main(void) -{ - void *backtrace_fns[10]; - size_t entries; - - entries = backtrace(backtrace_fns, 10); - backtrace_symbols_fd(backtrace_fns, entries, 1); - - return 0; -} diff --git a/tools/perf/config/feature-checks/test-bionic.c b/tools/perf/config/feature-checks/test-bionic.c deleted file mode 100644 index eac24e9..0000000 --- a/tools/perf/config/feature-checks/test-bionic.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <android/api-level.h> - -int main(void) -{ - return __ANDROID_API__; -} diff --git a/tools/perf/config/feature-checks/test-cplus-demangle.c b/tools/perf/config/feature-checks/test-cplus-demangle.c deleted file mode 100644 index 610c686..0000000 --- a/tools/perf/config/feature-checks/test-cplus-demangle.c +++ /dev/null @@ -1,14 +0,0 @@ -extern int printf(const char *format, ...); -extern char *cplus_demangle(const char *, int); - -int main(void) -{ - char symbol[4096] = "FieldName__9ClassNameFd"; - char *tmp; - - tmp = cplus_demangle(symbol, 0); - - printf("demangled symbol: {%s}\n", tmp); - - return 0; -} diff --git a/tools/perf/config/feature-checks/test-dwarf.c b/tools/perf/config/feature-checks/test-dwarf.c deleted file mode 100644 index 3fc1801..0000000 --- a/tools/perf/config/feature-checks/test-dwarf.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <dwarf.h> -#include <elfutils/libdw.h> -#include <elfutils/version.h> - -int main(void) -{ - Dwarf *dbg = dwarf_begin(0, DWARF_C_READ); - - return (long)dbg; -} diff --git a/tools/perf/config/feature-checks/test-fortify-source.c b/tools/perf/config/feature-checks/test-fortify-source.c deleted file mode 100644 index c9f398d..0000000 --- a/tools/perf/config/feature-checks/test-fortify-source.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <stdio.h> - -int main(void) -{ - return puts("hi"); -} diff --git a/tools/perf/config/feature-checks/test-glibc.c b/tools/perf/config/feature-checks/test-glibc.c deleted file mode 100644 index b082034..0000000 --- a/tools/perf/config/feature-checks/test-glibc.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <gnu/libc-version.h> - -int main(void) -{ - const char *version = gnu_get_libc_version(); - - return (long)version; -} diff --git a/tools/perf/config/feature-checks/test-gtk2-infobar.c b/tools/perf/config/feature-checks/test-gtk2-infobar.c deleted file mode 100644 index 397b464..0000000 --- a/tools/perf/config/feature-checks/test-gtk2-infobar.c +++ /dev/null @@ -1,11 +0,0 @@ -#pragma GCC diagnostic ignored "-Wstrict-prototypes" -#include <gtk/gtk.h> -#pragma GCC diagnostic error "-Wstrict-prototypes" - -int main(int argc, char *argv[]) -{ - gtk_init(&argc, &argv); - gtk_info_bar_new(); - - return 0; -} diff --git a/tools/perf/config/feature-checks/test-gtk2.c b/tools/perf/config/feature-checks/test-gtk2.c deleted file mode 100644 index 6bd80e5..0000000 --- a/tools/perf/config/feature-checks/test-gtk2.c +++ /dev/null @@ -1,10 +0,0 @@ -#pragma GCC diagnostic ignored "-Wstrict-prototypes" -#include <gtk/gtk.h> -#pragma GCC diagnostic error "-Wstrict-prototypes" - -int main(int argc, char *argv[]) -{ - gtk_init(&argc, &argv); - - return 0; -} diff --git a/tools/perf/config/feature-checks/test-hello.c b/tools/perf/config/feature-checks/test-hello.c deleted file mode 100644 index c9f398d..0000000 --- a/tools/perf/config/feature-checks/test-hello.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <stdio.h> - -int main(void) -{ - return puts("hi"); -} diff --git a/tools/perf/config/feature-checks/test-libaudit.c b/tools/perf/config/feature-checks/test-libaudit.c deleted file mode 100644 index afc019f..0000000 --- a/tools/perf/config/feature-checks/test-libaudit.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <libaudit.h> - -extern int printf(const char *format, ...); - -int main(void) -{ - printf("error message: %s\n", audit_errno_to_name(0)); - - return audit_open(); -} diff --git a/tools/perf/config/feature-checks/test-libbfd.c b/tools/perf/config/feature-checks/test-libbfd.c deleted file mode 100644 index 2405990..0000000 --- a/tools/perf/config/feature-checks/test-libbfd.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <bfd.h> - -extern int printf(const char *format, ...); - -int main(void) -{ - char symbol[4096] = "FieldName__9ClassNameFd"; - char *tmp; - - tmp = bfd_demangle(0, symbol, 0); - - printf("demangled symbol: {%s}\n", tmp); - - return 0; -} diff --git a/tools/perf/config/feature-checks/test-libelf-getphdrnum.c b/tools/perf/config/feature-checks/test-libelf-getphdrnum.c deleted file mode 100644 index d710459..0000000 --- a/tools/perf/config/feature-checks/test-libelf-getphdrnum.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <libelf.h> - -int main(void) -{ - size_t dst; - - return elf_getphdrnum(0, &dst); -} diff --git a/tools/perf/config/feature-checks/test-libelf-mmap.c b/tools/perf/config/feature-checks/test-libelf-mmap.c deleted file mode 100644 index 564427d..0000000 --- a/tools/perf/config/feature-checks/test-libelf-mmap.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <libelf.h> - -int main(void) -{ - Elf *elf = elf_begin(0, ELF_C_READ_MMAP, 0); - - return (long)elf; -} diff --git a/tools/perf/config/feature-checks/test-libelf.c b/tools/perf/config/feature-checks/test-libelf.c deleted file mode 100644 index 08db322..0000000 --- a/tools/perf/config/feature-checks/test-libelf.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <libelf.h> - -int main(void) -{ - Elf *elf = elf_begin(0, ELF_C_READ, 0); - - return (long)elf; -} diff --git a/tools/perf/config/feature-checks/test-libnuma.c b/tools/perf/config/feature-checks/test-libnuma.c deleted file mode 100644 index 4763d9c..0000000 --- a/tools/perf/config/feature-checks/test-libnuma.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <numa.h> -#include <numaif.h> - -int main(void) -{ - numa_available(); - - return 0; -} diff --git a/tools/perf/config/feature-checks/test-libperl.c b/tools/perf/config/feature-checks/test-libperl.c deleted file mode 100644 index 8871f6a..0000000 --- a/tools/perf/config/feature-checks/test-libperl.c +++ /dev/null @@ -1,9 +0,0 @@ -#include <EXTERN.h> -#include <perl.h> - -int main(void) -{ - perl_alloc(); - - return 0; -} diff --git a/tools/perf/config/feature-checks/test-libpython-version.c b/tools/perf/config/feature-checks/test-libpython-version.c deleted file mode 100644 index facea12..0000000 --- a/tools/perf/config/feature-checks/test-libpython-version.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <Python.h> - -#if PY_VERSION_HEX >= 0x03000000 - #error -#endif - -int main(void) -{ - return 0; -} diff --git a/tools/perf/config/feature-checks/test-libpython.c b/tools/perf/config/feature-checks/test-libpython.c deleted file mode 100644 index b24b28a..0000000 --- a/tools/perf/config/feature-checks/test-libpython.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <Python.h> - -int main(void) -{ - Py_Initialize(); - - return 0; -} diff --git a/tools/perf/config/feature-checks/test-libslang.c b/tools/perf/config/feature-checks/test-libslang.c deleted file mode 100644 index 22ff22e..0000000 --- a/tools/perf/config/feature-checks/test-libslang.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <slang.h> - -int main(void) -{ - return SLsmg_init_smg(); -} diff --git a/tools/perf/config/feature-checks/test-libunwind-debug-frame.c b/tools/perf/config/feature-checks/test-libunwind-debug-frame.c deleted file mode 100644 index 0ef8087..0000000 --- a/tools/perf/config/feature-checks/test-libunwind-debug-frame.c +++ /dev/null @@ -1,16 +0,0 @@ -#include <libunwind.h> -#include <stdlib.h> - -extern int -UNW_OBJ(dwarf_find_debug_frame) (int found, unw_dyn_info_t *di_debug, - unw_word_t ip, unw_word_t segbase, - const char *obj_name, unw_word_t start, - unw_word_t end); - -#define dwarf_find_debug_frame UNW_OBJ(dwarf_find_debug_frame) - -int main(void) -{ - dwarf_find_debug_frame(0, NULL, 0, 0, NULL, 0, 0); - return 0; -} diff --git a/tools/perf/config/feature-checks/test-libunwind.c b/tools/perf/config/feature-checks/test-libunwind.c deleted file mode 100644 index 43b9369..0000000 --- a/tools/perf/config/feature-checks/test-libunwind.c +++ /dev/null @@ -1,27 +0,0 @@ -#include <libunwind.h> -#include <stdlib.h> - -extern int UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as, - unw_word_t ip, - unw_dyn_info_t *di, - unw_proc_info_t *pi, - int need_unwind_info, void *arg); - - -#define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table) - -static unw_accessors_t accessors; - -int main(void) -{ - unw_addr_space_t addr_space; - - addr_space = unw_create_addr_space(&accessors, 0); - if (addr_space) - return 0; - - unw_init_remote(NULL, addr_space, NULL); - dwarf_search_unwind_table(addr_space, 0, NULL, NULL, 0, NULL); - - return 0; -} diff --git a/tools/perf/config/feature-checks/test-on-exit.c b/tools/perf/config/feature-checks/test-on-exit.c deleted file mode 100644 index 8e88b16..0000000 --- a/tools/perf/config/feature-checks/test-on-exit.c +++ /dev/null @@ -1,16 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> - -static void exit_fn(int status, void *__data) -{ - printf("exit status: %d, data: %d\n", status, *(int *)__data); -} - -static int data = 123; - -int main(void) -{ - on_exit(exit_fn, &data); - - return 321; -} diff --git a/tools/perf/config/feature-checks/test-stackprotector-all.c b/tools/perf/config/feature-checks/test-stackprotector-all.c deleted file mode 100644 index c9f398d..0000000 --- a/tools/perf/config/feature-checks/test-stackprotector-all.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <stdio.h> - -int main(void) -{ - return puts("hi"); -} diff --git a/tools/perf/config/feature-checks/test-stackprotector.c b/tools/perf/config/feature-checks/test-stackprotector.c deleted file mode 100644 index c9f398d..0000000 --- a/tools/perf/config/feature-checks/test-stackprotector.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <stdio.h> - -int main(void) -{ - return puts("hi"); -} diff --git a/tools/perf/config/feature-checks/test-timerfd.c b/tools/perf/config/feature-checks/test-timerfd.c deleted file mode 100644 index 8c5c083..0000000 --- a/tools/perf/config/feature-checks/test-timerfd.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * test for timerfd functions used by perf-kvm-stat-live - */ -#include <sys/timerfd.h> - -int main(void) -{ - struct itimerspec new_value; - - int fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK); - if (fd < 0) - return 1; - - if (timerfd_settime(fd, 0, &new_value, NULL) != 0) - return 1; - - return 0; -} diff --git a/tools/perf/config/feature-checks/test-volatile-register-var.c b/tools/perf/config/feature-checks/test-volatile-register-var.c deleted file mode 100644 index c9f398d..0000000 --- a/tools/perf/config/feature-checks/test-volatile-register-var.c +++ /dev/null @@ -1,6 +0,0 @@ -#include <stdio.h> - -int main(void) -{ - return puts("hi"); -} diff --git a/tools/perf/config/feature-tests.mak b/tools/perf/config/feature-tests.mak new file mode 100644 index 0000000..f793057 --- /dev/null +++ b/tools/perf/config/feature-tests.mak @@ -0,0 +1,246 @@ +define SOURCE_HELLO +#include <stdio.h> +int main(void) +{ + return puts(\"hi\"); +} +endef + +ifndef NO_DWARF +define SOURCE_DWARF +#include <dwarf.h> +#include <elfutils/libdw.h> +#include <elfutils/version.h> +#ifndef _ELFUTILS_PREREQ +#error +#endif + +int main(void) +{ + Dwarf *dbg = dwarf_begin(0, DWARF_C_READ); + return (long)dbg; +} +endef +endif + +define SOURCE_LIBELF +#include <libelf.h> + +int main(void) +{ + Elf *elf = elf_begin(0, ELF_C_READ, 0); + return (long)elf; +} +endef + +define SOURCE_GLIBC +#include <gnu/libc-version.h> + +int main(void) +{ + const char *version = gnu_get_libc_version(); + return (long)version; +} +endef + +define SOURCE_BIONIC +#include <android/api-level.h> + +int main(void) +{ + return __ANDROID_API__; +} +endef + +define SOURCE_ELF_MMAP +#include <libelf.h> +int main(void) +{ + Elf *elf = elf_begin(0, ELF_C_READ_MMAP, 0); + return (long)elf; +} +endef + +define SOURCE_ELF_GETPHDRNUM +#include <libelf.h> +int main(void) +{ + size_t dst; + return elf_getphdrnum(0, &dst); +} +endef + +ifndef NO_SLANG +define SOURCE_SLANG +#include <slang.h> + +int main(void) +{ + return SLsmg_init_smg(); +} +endef +endif + +ifndef NO_GTK2 +define SOURCE_GTK2 +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#include <gtk/gtk.h> +#pragma GCC diagnostic error \"-Wstrict-prototypes\" + +int main(int argc, char *argv[]) +{ + gtk_init(&argc, &argv); + + return 0; +} +endef + +define SOURCE_GTK2_INFOBAR +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#include <gtk/gtk.h> +#pragma GCC diagnostic error \"-Wstrict-prototypes\" + +int main(void) +{ + gtk_info_bar_new(); + + return 0; +} +endef +endif + +ifndef NO_LIBPERL +define SOURCE_PERL_EMBED +#include <EXTERN.h> +#include <perl.h> + +int main(void) +{ +perl_alloc(); +return 0; +} +endef +endif + +ifndef NO_LIBPYTHON +define SOURCE_PYTHON_VERSION +#include <Python.h> +#if PY_VERSION_HEX >= 0x03000000 + #error +#endif +int main(void) +{ + return 0; +} +endef +define SOURCE_PYTHON_EMBED +#include <Python.h> +int main(void) +{ + Py_Initialize(); + return 0; +} +endef +endif + +define SOURCE_BFD +#include <bfd.h> + +int main(void) +{ + bfd_demangle(0, 0, 0); + return 0; +} +endef + +define SOURCE_CPLUS_DEMANGLE +extern char *cplus_demangle(const char *, int); + +int main(void) +{ + cplus_demangle(0, 0); + return 0; +} +endef + +define SOURCE_STRLCPY +#include <stdlib.h> +extern size_t strlcpy(char *dest, const char *src, size_t size); + +int main(void) +{ + strlcpy(NULL, NULL, 0); + return 0; +} +endef + +ifndef NO_LIBUNWIND +define SOURCE_LIBUNWIND +#include <libunwind.h> +#include <stdlib.h> + +extern int UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as, + unw_word_t ip, + unw_dyn_info_t *di, + unw_proc_info_t *pi, + int need_unwind_info, void *arg); + + +#define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table) + +int main(void) +{ + unw_addr_space_t addr_space; + addr_space = unw_create_addr_space(NULL, 0); + unw_init_remote(NULL, addr_space, NULL); + dwarf_search_unwind_table(addr_space, 0, NULL, NULL, 0, NULL); + return 0; +} +endef +endif + +ifndef NO_BACKTRACE +define SOURCE_BACKTRACE +#include <execinfo.h> +#include <stdio.h> + +int main(void) +{ + backtrace(NULL, 0); + backtrace_symbols(NULL, 0); + return 0; +} +endef +endif + +ifndef NO_LIBAUDIT +define SOURCE_LIBAUDIT +#include <libaudit.h> + +int main(void) +{ + printf(\"error message: %s\", audit_errno_to_name(0)); + return audit_open(); +} +endef +endif + +define SOURCE_ON_EXIT +#include <stdio.h> + +int main(void) +{ + return on_exit(NULL, NULL); +} +endef + +define SOURCE_LIBNUMA +#include <numa.h> +#include <numaif.h> + +int main(void) +{ + numa_available(); + return 0; +} +endef diff --git a/tools/perf/config/utilities.mak b/tools/perf/config/utilities.mak index f168deb..94d2d4f 100644 --- a/tools/perf/config/utilities.mak +++ b/tools/perf/config/utilities.mak @@ -179,9 +179,16 @@ _ge_attempt = $(if $(get-executable),$(get-executable),$(_gea_warn)$(call _gea_e _gea_warn = $(warning The path '$(1)' is not executable.) _gea_err = $(if $(1),$(error Please set '$(1)' appropriately)) -ifneq ($(findstring $(MAKEFLAGS),s),s) - ifneq ($(V),1) - QUIET_CLEAN = @printf ' CLEAN %s\n' $1; - QUIET_INSTALL = @printf ' INSTALL %s\n' $1; - endif +# try-cc +# Usage: option = $(call try-cc, source-to-build, cc-options, msg) +ifneq ($(V),1) +TRY_CC_OUTPUT= > /dev/null 2>&1 endif +TRY_CC_MSG=echo " CHK $(3)" 1>&2; + +try-cc = $(shell sh -c \ + 'TMP="$(OUTPUT)$(TMPOUT).$$$$"; \ + $(TRY_CC_MSG) \ + echo "$(1)" | \ + $(CC) -x c - $(2) -o "$$TMP" $(TRY_CC_OUTPUT) && echo y; \ + rm -f "$$TMP"') |