summaryrefslogtreecommitdiffstats
path: root/tools/build
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2017-12-05 08:14:42 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-12-05 08:21:59 -0500
commit25ab5abf5b141d7fd13eed506c7458aa04749c29 (patch)
tree051064be8b022c964873372404fc3f4b86c4e6f4 /tools/build
parent3b2323c2c1c4acf8961cfcdddcee9889daaa21e3 (diff)
tools build feature: Check if pthread_barrier_t is available
As 'perf bench futex wake-parallel" will use this, which is not available in older systems such as versions of the android NDK used in my container build tests (r12b and r15c at the moment). Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: James Yang <james.yang@arm.com Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kim Phillips <kim.phillips@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: https://lkml.kernel.org/n/tip-1i7iv54in4wj08lwo55b0pzv@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/build')
-rw-r--r--tools/build/Makefile.feature1
-rw-r--r--tools/build/feature/Makefile4
-rw-r--r--tools/build/feature/test-all.c5
-rw-r--r--tools/build/feature/test-pthread-barrier.c12
4 files changed, 22 insertions, 0 deletions
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index c71a05b9c984..e52fcefee379 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -56,6 +56,7 @@ FEATURE_TESTS_BASIC := \
56 libunwind-arm \ 56 libunwind-arm \
57 libunwind-aarch64 \ 57 libunwind-aarch64 \
58 pthread-attr-setaffinity-np \ 58 pthread-attr-setaffinity-np \
59 pthread-barrier \
59 stackprotector-all \ 60 stackprotector-all \
60 timerfd \ 61 timerfd \
61 libdw-dwarf-unwind \ 62 libdw-dwarf-unwind \
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 96982640fbf8..cff38f342283 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -37,6 +37,7 @@ FILES= \
37 test-libunwind-debug-frame-arm.bin \ 37 test-libunwind-debug-frame-arm.bin \
38 test-libunwind-debug-frame-aarch64.bin \ 38 test-libunwind-debug-frame-aarch64.bin \
39 test-pthread-attr-setaffinity-np.bin \ 39 test-pthread-attr-setaffinity-np.bin \
40 test-pthread-barrier.bin \
40 test-stackprotector-all.bin \ 41 test-stackprotector-all.bin \
41 test-timerfd.bin \ 42 test-timerfd.bin \
42 test-libdw-dwarf-unwind.bin \ 43 test-libdw-dwarf-unwind.bin \
@@ -79,6 +80,9 @@ $(OUTPUT)test-hello.bin:
79$(OUTPUT)test-pthread-attr-setaffinity-np.bin: 80$(OUTPUT)test-pthread-attr-setaffinity-np.bin:
80 $(BUILD) -D_GNU_SOURCE -lpthread 81 $(BUILD) -D_GNU_SOURCE -lpthread
81 82
83$(OUTPUT)test-pthread-barrier.bin:
84 $(BUILD) -lpthread
85
82$(OUTPUT)test-stackprotector-all.bin: 86$(OUTPUT)test-stackprotector-all.bin:
83 $(BUILD) -fstack-protector-all 87 $(BUILD) -fstack-protector-all
84 88
diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c
index 4112702e4aed..6fdf83263ab7 100644
--- a/tools/build/feature/test-all.c
+++ b/tools/build/feature/test-all.c
@@ -118,6 +118,10 @@
118# include "test-pthread-attr-setaffinity-np.c" 118# include "test-pthread-attr-setaffinity-np.c"
119#undef main 119#undef main
120 120
121#define main main_test_pthread_barrier
122# include "test-pthread-barrier.c"
123#undef main
124
121#define main main_test_sched_getcpu 125#define main main_test_sched_getcpu
122# include "test-sched_getcpu.c" 126# include "test-sched_getcpu.c"
123#undef main 127#undef main
@@ -187,6 +191,7 @@ int main(int argc, char *argv[])
187 main_test_sync_compare_and_swap(argc, argv); 191 main_test_sync_compare_and_swap(argc, argv);
188 main_test_zlib(); 192 main_test_zlib();
189 main_test_pthread_attr_setaffinity_np(); 193 main_test_pthread_attr_setaffinity_np();
194 main_test_pthread_barrier();
190 main_test_lzma(); 195 main_test_lzma();
191 main_test_get_cpuid(); 196 main_test_get_cpuid();
192 main_test_bpf(); 197 main_test_bpf();
diff --git a/tools/build/feature/test-pthread-barrier.c b/tools/build/feature/test-pthread-barrier.c
new file mode 100644
index 000000000000..0558d9334d97
--- /dev/null
+++ b/tools/build/feature/test-pthread-barrier.c
@@ -0,0 +1,12 @@
1// SPDX-License-Identifier: GPL-2.0
2#include <stdint.h>
3#include <pthread.h>
4
5int main(void)
6{
7 pthread_barrier_t barrier;
8
9 pthread_barrier_init(&barrier, NULL, 1);
10 pthread_barrier_wait(&barrier);
11 return pthread_barrier_destroy(&barrier);
12}