[PATCH] D86877: [Clang][Driver] Support per-target runtime directories in the bare-metal toolchain
Raul Tambre via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 31 08:29:54 PDT 2020
tambre created this revision.
tambre added a reviewer: phosek.
Herald added subscribers: cfe-commits, mgorny.
Herald added a project: clang.
tambre requested review of this revision.
When LLVM_ENABLE_PER_TARGET_RUNTIME_DIR is set to ON the clang_rt.builtins will
not have an architecture prefix and will be placed instead in an architecture
directory.
This causes issues with the bare-metal toolchain, which assumes the suffixed
variant.
Add a define dependent on LLVM_ENABLE_PER_TARGET_RUNTIME_DIR, which switches
the bare-metal toolchain to use the unsuffixed version if enabled.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D86877
Files:
clang/lib/Driver/CMakeLists.txt
clang/lib/Driver/ToolChains/BareMetal.cpp
Index: clang/lib/Driver/ToolChains/BareMetal.cpp
===================================================================
--- clang/lib/Driver/ToolChains/BareMetal.cpp
+++ clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -156,8 +156,12 @@
void BareMetal::AddLinkRuntimeLib(const ArgList &Args,
ArgStringList &CmdArgs) const {
- CmdArgs.push_back(Args.MakeArgString("-lclang_rt.builtins-" +
- getTriple().getArchName()));
+#ifdef PER_TARGET_RUNTIME_DIR
+ CmdArgs.push_back(Args.MakeArgString("-lclang_rt.builtins"));
+#else
+ CmdArgs.push_back(
+ Args.MakeArgString("-lclang_rt.builtins" + getTriple().getArchName()));
+#endif
}
void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,
Index: clang/lib/Driver/CMakeLists.txt
===================================================================
--- clang/lib/Driver/CMakeLists.txt
+++ clang/lib/Driver/CMakeLists.txt
@@ -83,3 +83,7 @@
clangBasic
${system_libs}
)
+
+if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
+ set_source_files_properties(ToolChains/BareMetal.cpp PROPERTIES COMPILE_DEFINITIONS "PER_TARGET_RUNTIME_DIR")
+endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86877.288954.patch
Type: text/x-patch
Size: 1179 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200831/f1c67779/attachment.bin>
More information about the cfe-commits
mailing list