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

From: Yonghong Song
Date: Fri Jun 23 2023 - 11:06:38 EST




On 6/22/23 7:09 PM, Fangrui Song wrote:
-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.

Signed-off-by: Fangrui Song <maskray@xxxxxxxxxx>

LGTM with a few nits below. As Daniel mentioned earlier. It would be
to separate tools/perf changes to a separate patch to perf subsystem.
Please also cc
bpf@xxxxxxxxxxxxxxx

Acked-by: Yonghong Song <yhs@xxxxxx>


---
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 */
+/* dummy .h to trick /usr/include/features.h to work with 'clang --target=bpf' */

Quentin and Daniel already mentioned this one. The SPDX license
change can be removed. This is irrelavent to the theme of this patch.


[...]
diff --git a/tools/testing/selftests/bpf/gnu/stubs.h b/tools/testing/selftests/bpf/gnu/stubs.h
index 719225b16626..cc37155fbfa5 100644
--- a/tools/testing/selftests/bpf/gnu/stubs.h
+++ b/tools/testing/selftests/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 */
+/* dummy .h to trick /usr/include/features.h to work with 'clang --target=bpf' */

Here is another place that the SPDX license is not needed.

diff --git a/tools/testing/selftests/hid/Makefile b/tools/testing/selftests/hid/Makefile
index 01c0491d64da..2e986cbf1a46 100644
--- a/tools/testing/selftests/hid/Makefile
+++ b/tools/testing/selftests/hid/Makefile
@@ -167,7 +167,7 @@ $(RESOLVE_BTFIDS): $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/resolve_btfids \
OUTPUT=$(HOST_BUILD_DIR)/resolve_btfids/ BPFOBJ=$(HOST_BPFOBJ)
# Get Clang's default includes on this system, as opposed to those seen by
-# '-target bpf'. This fixes "missing" files on some architectures/distros,
+# '--target=bpf'. This fixes "missing" files on some architectures/distros,
[...]