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>hifive-unleashed-5.1
parent
3b2323c2c1
commit
25ab5abf5b
|
@ -56,6 +56,7 @@ FEATURE_TESTS_BASIC := \
|
||||||
libunwind-arm \
|
libunwind-arm \
|
||||||
libunwind-aarch64 \
|
libunwind-aarch64 \
|
||||||
pthread-attr-setaffinity-np \
|
pthread-attr-setaffinity-np \
|
||||||
|
pthread-barrier \
|
||||||
stackprotector-all \
|
stackprotector-all \
|
||||||
timerfd \
|
timerfd \
|
||||||
libdw-dwarf-unwind \
|
libdw-dwarf-unwind \
|
||||||
|
|
|
@ -37,6 +37,7 @@ FILES= \
|
||||||
test-libunwind-debug-frame-arm.bin \
|
test-libunwind-debug-frame-arm.bin \
|
||||||
test-libunwind-debug-frame-aarch64.bin \
|
test-libunwind-debug-frame-aarch64.bin \
|
||||||
test-pthread-attr-setaffinity-np.bin \
|
test-pthread-attr-setaffinity-np.bin \
|
||||||
|
test-pthread-barrier.bin \
|
||||||
test-stackprotector-all.bin \
|
test-stackprotector-all.bin \
|
||||||
test-timerfd.bin \
|
test-timerfd.bin \
|
||||||
test-libdw-dwarf-unwind.bin \
|
test-libdw-dwarf-unwind.bin \
|
||||||
|
@ -79,6 +80,9 @@ $(OUTPUT)test-hello.bin:
|
||||||
$(OUTPUT)test-pthread-attr-setaffinity-np.bin:
|
$(OUTPUT)test-pthread-attr-setaffinity-np.bin:
|
||||||
$(BUILD) -D_GNU_SOURCE -lpthread
|
$(BUILD) -D_GNU_SOURCE -lpthread
|
||||||
|
|
||||||
|
$(OUTPUT)test-pthread-barrier.bin:
|
||||||
|
$(BUILD) -lpthread
|
||||||
|
|
||||||
$(OUTPUT)test-stackprotector-all.bin:
|
$(OUTPUT)test-stackprotector-all.bin:
|
||||||
$(BUILD) -fstack-protector-all
|
$(BUILD) -fstack-protector-all
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,10 @@
|
||||||
# include "test-pthread-attr-setaffinity-np.c"
|
# include "test-pthread-attr-setaffinity-np.c"
|
||||||
#undef main
|
#undef main
|
||||||
|
|
||||||
|
#define main main_test_pthread_barrier
|
||||||
|
# include "test-pthread-barrier.c"
|
||||||
|
#undef main
|
||||||
|
|
||||||
#define main main_test_sched_getcpu
|
#define main main_test_sched_getcpu
|
||||||
# include "test-sched_getcpu.c"
|
# include "test-sched_getcpu.c"
|
||||||
#undef main
|
#undef main
|
||||||
|
@ -187,6 +191,7 @@ int main(int argc, char *argv[])
|
||||||
main_test_sync_compare_and_swap(argc, argv);
|
main_test_sync_compare_and_swap(argc, argv);
|
||||||
main_test_zlib();
|
main_test_zlib();
|
||||||
main_test_pthread_attr_setaffinity_np();
|
main_test_pthread_attr_setaffinity_np();
|
||||||
|
main_test_pthread_barrier();
|
||||||
main_test_lzma();
|
main_test_lzma();
|
||||||
main_test_get_cpuid();
|
main_test_get_cpuid();
|
||||||
main_test_bpf();
|
main_test_bpf();
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
pthread_barrier_t barrier;
|
||||||
|
|
||||||
|
pthread_barrier_init(&barrier, NULL, 1);
|
||||||
|
pthread_barrier_wait(&barrier);
|
||||||
|
return pthread_barrier_destroy(&barrier);
|
||||||
|
}
|
|
@ -263,6 +263,10 @@ ifeq ($(feature-pthread-attr-setaffinity-np), 1)
|
||||||
CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
|
CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(feature-pthread-barrier), 1)
|
||||||
|
CFLAGS += -DHAVE_PTHREAD_BARRIER
|
||||||
|
endif
|
||||||
|
|
||||||
ifndef NO_BIONIC
|
ifndef NO_BIONIC
|
||||||
$(call feature_check,bionic)
|
$(call feature_check,bionic)
|
||||||
ifeq ($(feature-bionic), 1)
|
ifeq ($(feature-bionic), 1)
|
||||||
|
|
Loading…
Reference in New Issue