[PATCH] D110663: [Driver] Support Debian multiarch style lib/clang/14.0.0/x86_64-linux-gnu runtime path and include/x86_64-linux-gnu/c++/v1 libc++ path
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 16 01:19:25 PST 2022
MaskRay updated this revision to Diff 409171.
MaskRay edited the summary of this revision.
MaskRay added a comment.
Detect both unnormalized and normalized paths for compatibility. hack when default -DLLVM_DEFAULT_TARGET_TRIPLE is x86_64-unknown-linux-gnu on Debian.
-DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-linux-gnu
/tmp/out/custom0/bin/clang++ --stdlib=libc++ -fsanitize=address a.cc
/tmp/out/custom0/bin/clang++ --target=x86_64-linux-gnu --stdlib=libc++ -fsanitize=address a.cc
-DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-linux-gnu
/tmp/out/custom1/bin/clang++ --stdlib=libc++ -fsanitize=address a.cc
/tmp/out/custom1/bin/clang++ --target=x86_64-linux-gnu --stdlib=libc++ -fsanitize=address a.cc
> Say we provide our toolchain to projects A and B. Project A uses clang --target=aarch64-linux-gnu .... Project B uses clang --target=aarch64-unknown-linux-gnu .... Today, this works fine because we internally normalize the target to aarch64-unknown-linux-gnu and use it find headers and libraries. With this change, depending on how we build the toolchain, either project A or B is going to break.
The new diff makes this work, though in the long term -DLLVM_DEFAULT_TARGET_TRIPLE should use x86_64-linux-gnu and mismatching --target= and -DLLVM_DEFAULT_TARGET_TRIPLE should be unsupported.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110663/new/
https://reviews.llvm.org/D110663
Files:
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChain.cpp
clang/lib/Driver/ToolChains/Gnu.cpp
clang/test/Driver/Inputs/debian_per_target_tree/usr/lib/llvm-14/lib/x86_64-linux-gnu/.keep
clang/test/Driver/Inputs/debian_per_target_unknown_tree/usr/lib/llvm-14/bin/.keep
clang/test/Driver/Inputs/debian_per_target_unknown_tree/usr/lib/llvm-14/include/c++/v1/.keep
clang/test/Driver/Inputs/debian_per_target_unknown_tree/usr/lib/llvm-14/include/i386-unknown-linux-gnu/c++/v1/.keep
clang/test/Driver/Inputs/debian_per_target_unknown_tree/usr/lib/llvm-14/include/x86_64-unknown-linux-gnu/c++/v1/.keep
clang/test/Driver/Inputs/debian_per_target_unknown_tree/usr/lib/llvm-14/lib/clang/14.0.0/lib/i386-unknown-linux-gnu/libclang_rt.builtins.a
clang/test/Driver/Inputs/debian_per_target_unknown_tree/usr/lib/llvm-14/lib/clang/14.0.0/lib/x86_64-unknown-linux-gnu/libclang_rt.builtins.a
clang/test/Driver/Inputs/debian_per_target_unknown_tree/usr/lib/llvm-14/lib/i386-unknown-linux-gnu/.keep
clang/test/Driver/Inputs/debian_per_target_unknown_tree/usr/lib/llvm-14/lib/x86_64-unknown-linux-gnu/.keep
clang/test/Driver/linux-cross.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110663.409171.patch
Type: text/x-patch
Size: 14013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220216/4d86ebb3/attachment-0001.bin>
More information about the cfe-commits
mailing list