perf build: Move feature checks code under tools/build
Moving feature checks code under tools/build directory. Changing also $feature_dir to point to new feature directory location and perf Makefiles to include Makefile.feature from new location. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <david.ahern@oracle.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/n/tip-3lamtb30dhf4wo99y1n8kxg0@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
970e87b338
commit
e6c76d6203
3
tools/build/feature/.gitignore
vendored
Normal file
3
tools/build/feature/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*.d
|
||||
*.bin
|
||||
*.output
|
160
tools/build/feature/Makefile
Normal file
160
tools/build/feature/Makefile
Normal file
@@ -0,0 +1,160 @@
|
||||
|
||||
FILES= \
|
||||
test-all.bin \
|
||||
test-backtrace.bin \
|
||||
test-bionic.bin \
|
||||
test-dwarf.bin \
|
||||
test-fortify-source.bin \
|
||||
test-sync-compare-and-swap.bin \
|
||||
test-glibc.bin \
|
||||
test-gtk2.bin \
|
||||
test-gtk2-infobar.bin \
|
||||
test-hello.bin \
|
||||
test-libaudit.bin \
|
||||
test-libbfd.bin \
|
||||
test-liberty.bin \
|
||||
test-liberty-z.bin \
|
||||
test-cplus-demangle.bin \
|
||||
test-libelf.bin \
|
||||
test-libelf-getphdrnum.bin \
|
||||
test-libelf-mmap.bin \
|
||||
test-libnuma.bin \
|
||||
test-libperl.bin \
|
||||
test-libpython.bin \
|
||||
test-libpython-version.bin \
|
||||
test-libslang.bin \
|
||||
test-libunwind.bin \
|
||||
test-libunwind-debug-frame.bin \
|
||||
test-pthread-attr-setaffinity-np.bin \
|
||||
test-stackprotector-all.bin \
|
||||
test-timerfd.bin \
|
||||
test-libdw-dwarf-unwind.bin \
|
||||
test-libbabeltrace.bin \
|
||||
test-compile-32.bin \
|
||||
test-compile-x32.bin \
|
||||
test-zlib.bin
|
||||
|
||||
CC := $(CROSS_COMPILE)gcc -MD
|
||||
PKG_CONFIG := $(CROSS_COMPILE)pkg-config
|
||||
|
||||
all: $(FILES)
|
||||
|
||||
__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $(OUTPUT)$@ $(patsubst %.bin,%.c,$@) $(LDFLAGS)
|
||||
BUILD = $(__BUILD) > $(OUTPUT)$(@:.bin=.make.output) 2>&1
|
||||
|
||||
###############################
|
||||
|
||||
test-all.bin:
|
||||
$(BUILD) -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -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 -lz
|
||||
|
||||
test-hello.bin:
|
||||
$(BUILD)
|
||||
|
||||
test-pthread-attr-setaffinity-np.bin:
|
||||
$(BUILD) -D_GNU_SOURCE -lpthread
|
||||
|
||||
test-stackprotector-all.bin:
|
||||
$(BUILD) -fstack-protector-all
|
||||
|
||||
test-fortify-source.bin:
|
||||
$(BUILD) -O2 -D_FORTIFY_SOURCE=2
|
||||
|
||||
test-bionic.bin:
|
||||
$(BUILD)
|
||||
|
||||
test-libelf.bin:
|
||||
$(BUILD) -lelf
|
||||
|
||||
test-glibc.bin:
|
||||
$(BUILD)
|
||||
|
||||
test-dwarf.bin:
|
||||
$(BUILD) -ldw
|
||||
|
||||
test-libelf-mmap.bin:
|
||||
$(BUILD) -lelf
|
||||
|
||||
test-libelf-getphdrnum.bin:
|
||||
$(BUILD) -lelf
|
||||
|
||||
test-libnuma.bin:
|
||||
$(BUILD) -lnuma
|
||||
|
||||
test-libunwind.bin:
|
||||
$(BUILD) -lelf
|
||||
|
||||
test-libunwind-debug-frame.bin:
|
||||
$(BUILD) -lelf
|
||||
|
||||
test-libaudit.bin:
|
||||
$(BUILD) -laudit
|
||||
|
||||
test-libslang.bin:
|
||||
$(BUILD) -I/usr/include/slang -lslang
|
||||
|
||||
test-gtk2.bin:
|
||||
$(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
|
||||
|
||||
test-gtk2-infobar.bin:
|
||||
$(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.bin:
|
||||
$(BUILD) $(FLAGS_PERL_EMBED)
|
||||
|
||||
test-libpython.bin:
|
||||
$(BUILD)
|
||||
|
||||
test-libpython-version.bin:
|
||||
$(BUILD)
|
||||
|
||||
test-libbfd.bin:
|
||||
$(BUILD) -DPACKAGE='"perf"' -lbfd -lz -liberty -ldl
|
||||
|
||||
test-liberty.bin:
|
||||
$(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty
|
||||
|
||||
test-liberty-z.bin:
|
||||
$(CC) -Wall -Werror -o $(OUTPUT)$@ test-libbfd.c -DPACKAGE='"perf"' -lbfd -ldl -liberty -lz
|
||||
|
||||
test-cplus-demangle.bin:
|
||||
$(BUILD) -liberty
|
||||
|
||||
test-backtrace.bin:
|
||||
$(BUILD)
|
||||
|
||||
test-timerfd.bin:
|
||||
$(BUILD)
|
||||
|
||||
test-libdw-dwarf-unwind.bin:
|
||||
$(BUILD) # -ldw provided by $(FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind)
|
||||
|
||||
test-libbabeltrace.bin:
|
||||
$(BUILD) # -lbabeltrace provided by $(FEATURE_CHECK_LDFLAGS-libbabeltrace)
|
||||
|
||||
test-sync-compare-and-swap.bin:
|
||||
$(BUILD)
|
||||
|
||||
test-compile-32.bin:
|
||||
$(CC) -m32 -o $(OUTPUT)$@ test-compile.c
|
||||
|
||||
test-compile-x32.bin:
|
||||
$(CC) -mx32 -o $(OUTPUT)$@ test-compile.c
|
||||
|
||||
test-zlib.bin:
|
||||
$(BUILD) -lz
|
||||
|
||||
-include *.d
|
||||
|
||||
###############################
|
||||
|
||||
clean:
|
||||
rm -f $(FILES) *.d $(FILES:.bin=.make.output)
|
143
tools/build/feature/test-all.c
Normal file
143
tools/build/feature/test-all.c
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* 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_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
|
||||
|
||||
#define main main_test_stackprotector_all
|
||||
# include "test-stackprotector-all.c"
|
||||
#undef main
|
||||
|
||||
#define main main_test_libdw_dwarf_unwind
|
||||
# include "test-libdw-dwarf-unwind.c"
|
||||
#undef main
|
||||
|
||||
#define main main_test_sync_compare_and_swap
|
||||
# include "test-sync-compare-and-swap.c"
|
||||
#undef main
|
||||
|
||||
#define main main_test_zlib
|
||||
# include "test-zlib.c"
|
||||
#undef main
|
||||
|
||||
#define main main_test_pthread_attr_setaffinity_np
|
||||
# include "test-pthread-attr-setaffinity-np.c"
|
||||
#undef main
|
||||
|
||||
# if 0
|
||||
/*
|
||||
* Disable libbabeltrace check for test-all, because the requested
|
||||
* library version is not released yet in most distributions. Will
|
||||
* reenable later.
|
||||
*/
|
||||
|
||||
#define main main_test_libbabeltrace
|
||||
# include "test-libbabeltrace.c"
|
||||
#undef main
|
||||
#endif
|
||||
|
||||
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_backtrace();
|
||||
main_test_libnuma();
|
||||
main_test_timerfd();
|
||||
main_test_stackprotector_all();
|
||||
main_test_libdw_dwarf_unwind();
|
||||
main_test_sync_compare_and_swap(argc, argv);
|
||||
main_test_zlib();
|
||||
main_test_pthread_attr_setaffinity_np();
|
||||
|
||||
return 0;
|
||||
}
|
13
tools/build/feature/test-backtrace.c
Normal file
13
tools/build/feature/test-backtrace.c
Normal file
@@ -0,0 +1,13 @@
|
||||
#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;
|
||||
}
|
6
tools/build/feature/test-bionic.c
Normal file
6
tools/build/feature/test-bionic.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <android/api-level.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return __ANDROID_API__;
|
||||
}
|
4
tools/build/feature/test-compile.c
Normal file
4
tools/build/feature/test-compile.c
Normal file
@@ -0,0 +1,4 @@
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
14
tools/build/feature/test-cplus-demangle.c
Normal file
14
tools/build/feature/test-cplus-demangle.c
Normal file
@@ -0,0 +1,14 @@
|
||||
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;
|
||||
}
|
10
tools/build/feature/test-dwarf.c
Normal file
10
tools/build/feature/test-dwarf.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#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;
|
||||
}
|
6
tools/build/feature/test-fortify-source.c
Normal file
6
tools/build/feature/test-fortify-source.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return puts("hi");
|
||||
}
|
8
tools/build/feature/test-glibc.c
Normal file
8
tools/build/feature/test-glibc.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <gnu/libc-version.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
const char *version = gnu_get_libc_version();
|
||||
|
||||
return (long)version;
|
||||
}
|
11
tools/build/feature/test-gtk2-infobar.c
Normal file
11
tools/build/feature/test-gtk2-infobar.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#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;
|
||||
}
|
10
tools/build/feature/test-gtk2.c
Normal file
10
tools/build/feature/test-gtk2.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#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;
|
||||
}
|
6
tools/build/feature/test-hello.c
Normal file
6
tools/build/feature/test-hello.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return puts("hi");
|
||||
}
|
10
tools/build/feature/test-libaudit.c
Normal file
10
tools/build/feature/test-libaudit.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#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();
|
||||
}
|
9
tools/build/feature/test-libbabeltrace.c
Normal file
9
tools/build/feature/test-libbabeltrace.c
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
#include <babeltrace/ctf-writer/writer.h>
|
||||
#include <babeltrace/ctf-ir/stream-class.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
bt_ctf_stream_class_get_packet_context_type((void *) 0);
|
||||
return 0;
|
||||
}
|
15
tools/build/feature/test-libbfd.c
Normal file
15
tools/build/feature/test-libbfd.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#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;
|
||||
}
|
13
tools/build/feature/test-libdw-dwarf-unwind.c
Normal file
13
tools/build/feature/test-libdw-dwarf-unwind.c
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
#include <elfutils/libdwfl.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/*
|
||||
* This function is guarded via: __nonnull_attribute__ (1, 2).
|
||||
* Passing '1' as arguments value. This code is never executed,
|
||||
* only compiled.
|
||||
*/
|
||||
dwfl_thread_getframes((void *) 1, (void *) 1, NULL);
|
||||
return 0;
|
||||
}
|
8
tools/build/feature/test-libelf-getphdrnum.c
Normal file
8
tools/build/feature/test-libelf-getphdrnum.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <libelf.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
size_t dst;
|
||||
|
||||
return elf_getphdrnum(0, &dst);
|
||||
}
|
8
tools/build/feature/test-libelf-mmap.c
Normal file
8
tools/build/feature/test-libelf-mmap.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <libelf.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
Elf *elf = elf_begin(0, ELF_C_READ_MMAP, 0);
|
||||
|
||||
return (long)elf;
|
||||
}
|
8
tools/build/feature/test-libelf.c
Normal file
8
tools/build/feature/test-libelf.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <libelf.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
Elf *elf = elf_begin(0, ELF_C_READ, 0);
|
||||
|
||||
return (long)elf;
|
||||
}
|
9
tools/build/feature/test-libnuma.c
Normal file
9
tools/build/feature/test-libnuma.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <numa.h>
|
||||
#include <numaif.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
numa_available();
|
||||
|
||||
return 0;
|
||||
}
|
9
tools/build/feature/test-libperl.c
Normal file
9
tools/build/feature/test-libperl.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <EXTERN.h>
|
||||
#include <perl.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
perl_alloc();
|
||||
|
||||
return 0;
|
||||
}
|
10
tools/build/feature/test-libpython-version.c
Normal file
10
tools/build/feature/test-libpython-version.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <Python.h>
|
||||
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
#error
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
8
tools/build/feature/test-libpython.c
Normal file
8
tools/build/feature/test-libpython.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <Python.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
Py_Initialize();
|
||||
|
||||
return 0;
|
||||
}
|
6
tools/build/feature/test-libslang.c
Normal file
6
tools/build/feature/test-libslang.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <slang.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return SLsmg_init_smg();
|
||||
}
|
16
tools/build/feature/test-libunwind-debug-frame.c
Normal file
16
tools/build/feature/test-libunwind-debug-frame.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#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;
|
||||
}
|
27
tools/build/feature/test-libunwind.c
Normal file
27
tools/build/feature/test-libunwind.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#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;
|
||||
}
|
17
tools/build/feature/test-pthread-attr-setaffinity-np.c
Normal file
17
tools/build/feature/test-pthread-attr-setaffinity-np.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <stdint.h>
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int ret = 0;
|
||||
pthread_attr_t thread_attr;
|
||||
cpu_set_t cs;
|
||||
|
||||
pthread_attr_init(&thread_attr);
|
||||
CPU_ZERO(&cs);
|
||||
|
||||
ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs);
|
||||
|
||||
return ret;
|
||||
}
|
6
tools/build/feature/test-stackprotector-all.c
Normal file
6
tools/build/feature/test-stackprotector-all.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return puts("hi");
|
||||
}
|
14
tools/build/feature/test-sync-compare-and-swap.c
Normal file
14
tools/build/feature/test-sync-compare-and-swap.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <stdint.h>
|
||||
|
||||
volatile uint64_t x;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
uint64_t old, new = argc;
|
||||
|
||||
argv = argv;
|
||||
do {
|
||||
old = __sync_val_compare_and_swap(&x, 0, 0);
|
||||
} while (!__sync_bool_compare_and_swap(&x, old, new));
|
||||
return old == new;
|
||||
}
|
18
tools/build/feature/test-timerfd.c
Normal file
18
tools/build/feature/test-timerfd.c
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
9
tools/build/feature/test-zlib.c
Normal file
9
tools/build/feature/test-zlib.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <zlib.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
z_stream zs;
|
||||
|
||||
inflateInit(&zs);
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user