[PATCH] D87164: Extending Baremetal toolchain's support for the rtlib option.
Manuel Carrasco via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 11 10:08:43 PDT 2020
mcarrasco updated this revision to Diff 291262.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87164/new/
https://reviews.llvm.org/D87164
Files:
clang/lib/Driver/ToolChains/BareMetal.cpp
clang/test/Driver/baremetal.cpp
Index: clang/test/Driver/baremetal.cpp
===================================================================
--- clang/test/Driver/baremetal.cpp
+++ clang/test/Driver/baremetal.cpp
@@ -83,3 +83,7 @@
// RUN: %clangxx -target arm-none-eabi -mthread-model posix -v 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-THREAD-MODEL-POSIX
// CHECK-THREAD-MODEL-POSIX: Thread model: posix
+
+// RUN: %clang -### -target arm-none-eabi -rtlib=libgcc -v %s 2>&1 \
+// RUN: | FileCheck %s --check-prefix=CHECK-RTLIB-GCC
+// CHECK-RTLIB-GCC: -lgcc
Index: clang/lib/Driver/ToolChains/BareMetal.cpp
===================================================================
--- clang/lib/Driver/ToolChains/BareMetal.cpp
+++ clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -156,8 +156,17 @@
void BareMetal::AddLinkRuntimeLib(const ArgList &Args,
ArgStringList &CmdArgs) const {
- CmdArgs.push_back(Args.MakeArgString("-lclang_rt.builtins-" +
- getTriple().getArchName()));
+ ToolChain::RuntimeLibType RLT = GetRuntimeLibType(Args);
+ switch (RLT) {
+ case ToolChain::RLT_CompilerRT:
+ CmdArgs.push_back(
+ Args.MakeArgString("-lclang_rt.builtins-" + getTriple().getArchName()));
+ return;
+ case ToolChain::RLT_Libgcc:
+ CmdArgs.push_back("-lgcc");
+ return;
+ }
+ llvm_unreachable("Unhandled RuntimeLibType.");
}
void baremetal::Linker::ConstructJob(Compilation &C, const JobAction &JA,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87164.291262.patch
Type: text/x-patch
Size: 1473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200911/3372a6a2/attachment.bin>
More information about the cfe-commits
mailing list