Change-Id: Ia15bb76f7152fff2974e38242d7430ce2987a71e

Cc: Arnaldo Carvalho de Melo <a...@redhat.com>
Cc: Jiri Olsa <jo...@kernel.org>
Cc: Quentin Monnet <quen...@isovalent.com>
Cc: "Frank Ch. Eigler" <f...@redhat.com>
Cc: Stephane Eranian <eran...@google.com>
Cc: Namhyung Kim <namhy...@kernel.org>
Cc: Thomas Hebb <tommyh...@gmail.com>
Change-Id: Ie2c3832eaf050d627764071d1927c7546e7c4b4b
Signed-off-by: Brendan Jackman <jackm...@google.com>
---
 tools/build/feature/Makefile                 | 4 ++++
 tools/build/feature/test-clang-bpf-atomics.c | 9 +++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 tools/build/feature/test-clang-bpf-atomics.c

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index cdde783f3018..81370d7fa193 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -70,6 +70,7 @@ FILES=                                          \
          test-libaio.bin                       \
          test-libzstd.bin                      \
          test-clang-bpf-co-re.bin              \
+         test-clang-bpf-atomics.bin            \
          test-file-handle.bin                  \
          test-libpfm4.bin
 
@@ -331,6 +332,9 @@ $(OUTPUT)test-clang-bpf-co-re.bin:
        $(CLANG) -S -g -target bpf -o - $(patsubst %.bin,%.c,$(@F)) |   \
                grep BTF_KIND_VAR
 
+$(OUTPUT)test-clang-bpf-atomics.bin:
+       $(CLANG) -S -g -target bpf -mcpu=v3 
-Werror=implicit-function-declaration -o - $(patsubst %.bin,%.c,$(@F)) 2>&1
+
 $(OUTPUT)test-file-handle.bin:
        $(BUILD)
 
diff --git a/tools/build/feature/test-clang-bpf-atomics.c 
b/tools/build/feature/test-clang-bpf-atomics.c
new file mode 100644
index 000000000000..8b5fcdd4ba6f
--- /dev/null
+++ b/tools/build/feature/test-clang-bpf-atomics.c
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2020 Google
+
+int x = 0;
+
+int foo(void)
+{
+       return __sync_val_compare_and_swap(&x, 1, 2);
+}
-- 
2.29.2.454.gaff20da3a2-goog

Reply via email to