summaryrefslogtreecommitdiff
path: root/lib/Driver/ToolChain.cpp
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2019-03-12 02:12:48 +0000
committerPetr Hosek <phosek@chromium.org>2019-03-12 02:12:48 +0000
commit3b51fa8ce9293a268c824bc9003c3da5fc627811 (patch)
treeb243a6efdbb915136409b55ea6b5c926bd566552 /lib/Driver/ToolChain.cpp
parent56866cce9d65da85c2f90778aeb3bdab5ea49de8 (diff)
downloadclang-3b51fa8ce9293a268c824bc9003c3da5fc627811.tar.gz
[Driver] Support object files in addition to static and shared libraries in compiler-rt
This change introduces support for object files in addition to static and shared libraries which were already supported which requires changing the type of the argument from boolean to an enum. Differential Revision: https://reviews.llvm.org/D56044 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355891 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChain.cpp')
-rw-r--r--lib/Driver/ToolChain.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/lib/Driver/ToolChain.cpp b/lib/Driver/ToolChain.cpp
index a89983d955..6b56271570 100644
--- a/lib/Driver/ToolChain.cpp
+++ b/lib/Driver/ToolChain.cpp
@@ -362,16 +362,27 @@ std::string ToolChain::getCompilerRTPath() const {
}
std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
- bool Shared) const {
+ FileType Type) const {
const llvm::Triple &TT = getTriple();
bool IsITANMSVCWindows =
TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment();
- const char *Prefix = IsITANMSVCWindows ? "" : "lib";
- const char *Suffix = Shared ? (Triple.isOSWindows() ? ".lib" : ".so")
- : (IsITANMSVCWindows ? ".lib" : ".a");
- if (Shared && Triple.isWindowsGNUEnvironment())
- Suffix = ".dll.a";
+ const char *Prefix =
+ IsITANMSVCWindows || Type == ToolChain::FT_Object ? "" : "lib";
+ const char *Suffix;
+ switch (Type) {
+ case ToolChain::FT_Object:
+ Suffix = IsITANMSVCWindows ? ".obj" : ".o";
+ break;
+ case ToolChain::FT_Static:
+ Suffix = IsITANMSVCWindows ? ".lib" : ".a";
+ break;
+ case ToolChain::FT_Shared:
+ Suffix = Triple.isOSWindows()
+ ? (Triple.isWindowsGNUEnvironment() ? ".dll.a" : ".lib")
+ : ".so";
+ break;
+ }
for (const auto &LibPath : getLibraryPaths()) {
SmallString<128> P(LibPath);
@@ -390,8 +401,8 @@ std::string ToolChain::getCompilerRT(const ArgList &Args, StringRef Component,
const char *ToolChain::getCompilerRTArgString(const llvm::opt::ArgList &Args,
StringRef Component,
- bool Shared) const {
- return Args.MakeArgString(getCompilerRT(Args, Component, Shared));
+ FileType Type) const {
+ return Args.MakeArgString(getCompilerRT(Args, Component, Type));
}
std::string ToolChain::getArchSpecificLibPath() const {