diff --git a/check-deps/Makefile b/check-deps/Makefile index 2ca41b3ee..8f06dfae4 100644 --- a/check-deps/Makefile +++ b/check-deps/Makefile @@ -14,6 +14,7 @@ CHECK_LIST += have_libdw CHECK_LIST += have_libunwind CHECK_LIST += have_libcapstone CHECK_LIST += cc_has_minline_all_stringops +CHECK_LIST += have_membarrier # # This is needed for checking build dependency diff --git a/check-deps/Makefile.check b/check-deps/Makefile.check index 93443e145..85042658d 100644 --- a/check-deps/Makefile.check +++ b/check-deps/Makefile.check @@ -82,3 +82,7 @@ endif ifneq ($(wildcard $(objdir)/check-deps/cc_has_minline_all_stringops),) LIB_CFLAGS += -minline-all-stringops endif + +ifneq ($(wildcard $(objdir)/check-deps/have_membarrier),) + LIB_CFLAGS += -DHAVE_MEMBARRIER +endif diff --git a/check-deps/__have_membarrier.c b/check-deps/__have_membarrier.c new file mode 100644 index 000000000..30a7c5a92 --- /dev/null +++ b/check-deps/__have_membarrier.c @@ -0,0 +1,10 @@ +#include +#include +#include + +int main() +{ + syscall(__NR_membarrier, MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE, 0, 0); + syscall(__NR_membarrier, MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE, 0, 0); + return 0; +} diff --git a/configure b/configure index 237e5619c..fe7289afd 100755 --- a/configure +++ b/configure @@ -35,6 +35,7 @@ usage() { --without-capstone build without libcapstone (even if found on the system) --without-perf build without perf event (even if available) --without-schedule build without scheduler event (even if available) + --without-membarrier build without membarriers (even if available) --arch= set target architecture (default: system default arch) e.g. x86_64, aarch64, i386, or arm @@ -198,6 +199,7 @@ for dep in $IGNORE; do capstone) TARGET=have_libcapstone ;; perf*) TARGET=perf_clockid ;; sched*) TARGET=perf_context_switch;; + membarrier) TARGET=have_membarrier ;; *) ;; esac if [ ! -z "$TARGET" ]; then @@ -265,6 +267,7 @@ print_feature "perf_event" "perf_clockid" "perf (PMU) event support" print_feature "schedule" "perf_context_switch" "scheduler event support" print_feature "capstone" "have_libcapstone" "full dynamic tracing support" print_feature "libunwind" "have_libunwind" "stacktrace support (optional for debugging)" +print_feature "membarrier" "have_membarrier" "membarrier support (requires Linux 4.16)" cat >$output <