[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzbN==quHrXgGswSVKwK_9mqKMmzw=2y21uc-Sfz1_VGuQ@mail.gmail.com>
Date: Thu, 3 Dec 2020 13:02:33 -0800
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Brendan Jackman <jackmanb@...gle.com>
Cc: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Yonghong Song <yhs@...com>,
Daniel Borkmann <daniel@...earbox.net>,
KP Singh <kpsingh@...omium.org>,
Florent Revest <revest@...omium.org>,
open list <linux-kernel@...r.kernel.org>,
Jann Horn <jannh@...gle.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Jiri Olsa <jolsa@...nel.org>,
Quentin Monnet <quentin@...valent.com>,
"Frank Ch. Eigler" <fche@...hat.com>,
Stephane Eranian <eranian@...gle.com>,
Namhyung Kim <namhyung@...nel.org>,
Thomas Hebb <tommyhebb@...il.com>
Subject: Re: [PATCH bpf-next v3 11/14] tools build: Implement feature check
for BPF atomics in Clang
On Thu, Dec 3, 2020 at 8:08 AM Brendan Jackman <jackmanb@...gle.com> wrote:
>
> Change-Id: Ia15bb76f7152fff2974e38242d7430ce2987a71e
>
See recent discussion on KP's patch set. There needs to be a commit
message, even if it's just a copy/paste of subject line. But see also
my other reply, I'm not sure it's worth it to do it this way for
selftests.
> Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Quentin Monnet <quentin@...valent.com>
> Cc: "Frank Ch. Eigler" <fche@...hat.com>
> Cc: Stephane Eranian <eranian@...gle.com>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Cc: Thomas Hebb <tommyhebb@...il.com>
> Change-Id: Ie2c3832eaf050d627764071d1927c7546e7c4b4b
> Signed-off-by: Brendan Jackman <jackmanb@...gle.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
>
Powered by blists - more mailing lists