Re: [PATCH] bpf: Replace deprecated -target with --target= for Clang

From: Quentin Monnet
Date: Fri Jun 23 2023 - 04:51:37 EST


2023-06-23 02:09 UTC+0000 ~ Fangrui Song <maskray@xxxxxxxxxx>
> -target has been deprecated since Clang 3.4 in 2013. Use the preferred
> --target=bpf form instead. This matches how we use --target= in
> scripts/Makefile.clang.

This seems to be the relevant commit, for reference:

https://github.com/llvm/llvm-project/commit/274b6f0c87a6a1798de0a68135afc7f95def6277

>
> Signed-off-by: Fangrui Song <maskray@xxxxxxxxxx>
> ---
> Documentation/bpf/bpf_devel_QA.rst | 10 +++++-----
> Documentation/bpf/btf.rst | 4 ++--
> Documentation/bpf/llvm_reloc.rst | 6 +++---
> drivers/hid/bpf/entrypoints/Makefile | 2 +-
> kernel/bpf/preload/iterators/Makefile | 2 +-
> samples/bpf/Makefile | 6 +++---
> samples/bpf/gnu/stubs.h | 3 ++-
> samples/bpf/test_lwt_bpf.sh | 2 +-
> samples/hid/Makefile | 6 +++---
> tools/bpf/bpftool/Documentation/bpftool-gen.rst | 4 ++--
> tools/bpf/bpftool/Makefile | 2 +-
> tools/bpf/runqslower/Makefile | 2 +-
> tools/build/feature/Makefile | 2 +-
> tools/perf/Documentation/perf-config.txt | 2 +-
> tools/perf/Makefile.perf | 4 ++--
> tools/perf/util/llvm-utils.c | 4 ++--
> tools/testing/selftests/bpf/Makefile | 6 +++---
> tools/testing/selftests/bpf/gnu/stubs.h | 3 ++-
> tools/testing/selftests/hid/Makefile | 6 +++---
> tools/testing/selftests/net/Makefile | 4 ++--
> tools/testing/selftests/tc-testing/Makefile | 2 +-
> 21 files changed, 42 insertions(+), 40 deletions(-)
>

> diff --git a/samples/bpf/gnu/stubs.h b/samples/bpf/gnu/stubs.h
> index 719225b16626..cc37155fbfa5 100644
> --- a/samples/bpf/gnu/stubs.h
> +++ b/samples/bpf/gnu/stubs.h
> @@ -1 +1,2 @@
> -/* dummy .h to trick /usr/include/features.h to work with 'clang -target bpf' */
> +/* SPDX-License-Identifier: GPL-2.0 */

Are these necessary, seeing that the files only contain this single-line
comment?

> +/* dummy .h to trick /usr/include/features.h to work with 'clang --target=bpf' */

Other than this, the change looks good, thanks. Although it should
probably target bpf-next rather than bpf?

Acked-by: Quentin Monnet <quentin@xxxxxxxxxxxxx>