Centos-kernel-stream-9/tools/scripts
Artem Savkov 6d27347869 selftests/bpf: Fix cross compilation with CLANG_CROSS_FLAGS
Bugzilla: https://bugzilla.redhat.com/2221599

commit b539a287baaa8501b3af4f7f99aba3c0b1d822f8
Author: Florent Revest <revest@chromium.org>
Date:   Fri Feb 17 16:18:32 2023 +0100

    selftests/bpf: Fix cross compilation with CLANG_CROSS_FLAGS
    
    I cross-compile my BPF selftests with the following command:
    
    CLANG_CROSS_FLAGS="--target=aarch64-linux-gnu --sysroot=/sysroot/" \
      make LLVM=1 CC=clang CROSS_COMPILE=aarch64-linux-gnu- SRCARCH=arm64
    
    (Note the use of CLANG_CROSS_FLAGS to specify a custom sysroot instead
    of letting clang use gcc's default sysroot)
    
    However, CLANG_CROSS_FLAGS gets propagated to host tools builds (libbpf
    and bpftool) and because they reference it directly in their Makefiles,
    they end up cross-compiling host objects which results in linking
    errors.
    
    This patch ensures that CLANG_CROSS_FLAGS is reset if CROSS_COMPILE
    isn't set (for example when reaching a BPF host tool build).
    
    Signed-off-by: Florent Revest <revest@chromium.org>
    Link: https://lore.kernel.org/r/20230217151832.27784-1-revest@chromium.org
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2023-09-22 09:12:07 +02:00
..
Makefile.arch arch: remove tile port 2018-03-16 10:56:03 +01:00
Makefile.include selftests/bpf: Fix cross compilation with CLANG_CROSS_FLAGS 2023-09-22 09:12:07 +02:00
utilities.mak kbuild: replace $(if A,A,B) with $(or A,B) 2022-10-27 14:27:59 -04:00