Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
You need to sign in or sign up before continuing.
  • linux
  • tools
  • scripts
  • Makefile.include
Find file BlameHistoryPermalink
  • Florent Revest's avatar
    selftests/bpf: Fix cross compilation with CLANG_CROSS_FLAGS · b539a287
    Florent Revest authored Feb 17, 2023
    
    
    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: default avatarFlorent Revest <revest@chromium.org>
    Link: https://lore.kernel.org/r/20230217151832.27784-1-revest@chromium.org
    
    
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    b539a287
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7