summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Driver')
-rw-r--r--clang/lib/Driver/ToolChains/Darwin.cpp19
-rw-r--r--clang/lib/Driver/ToolChains/Darwin.h6
2 files changed, 16 insertions, 9 deletions
diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp
index 6c8bba57644..5971a0ae447 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -916,8 +916,10 @@ void MachO::AddLinkRuntimeLib(const ArgList &Args, ArgStringList &CmdArgs,
DarwinLibName += Component;
if (!(Opts & RLO_IsEmbedded))
DarwinLibName += "_";
- }
- DarwinLibName += getOSLibraryNameSuffix();
+ DarwinLibName += getOSLibraryNameSuffix();
+ } else
+ DarwinLibName += getOSLibraryNameSuffix(true);
+
DarwinLibName += IsShared ? "_dynamic.dylib" : ".a";
SmallString<128> Dir(getDriver().ResourceDir);
llvm::sys::path::append(
@@ -983,16 +985,19 @@ StringRef Darwin::getSDKName(StringRef isysroot) {
return "";
}
-StringRef Darwin::getOSLibraryNameSuffix() const {
- switch(TargetPlatform) {
+StringRef Darwin::getOSLibraryNameSuffix(bool IgnoreSim) const {
+ switch (TargetPlatform) {
case DarwinPlatformKind::MacOS:
return "osx";
case DarwinPlatformKind::IPhoneOS:
- return TargetEnvironment == NativeEnvironment ? "ios" : "iossim";
+ return TargetEnvironment == NativeEnvironment || IgnoreSim ? "ios"
+ : "iossim";
case DarwinPlatformKind::TvOS:
- return TargetEnvironment == NativeEnvironment ? "tvos" : "tvossim";
+ return TargetEnvironment == NativeEnvironment || IgnoreSim ? "tvos"
+ : "tvossim";
case DarwinPlatformKind::WatchOS:
- return TargetEnvironment == NativeEnvironment ? "watchos" : "watchossim";
+ return TargetEnvironment == NativeEnvironment || IgnoreSim ? "watchos"
+ : "watchossim";
}
llvm_unreachable("Unsupported platform");
}
diff --git a/clang/lib/Driver/ToolChains/Darwin.h b/clang/lib/Driver/ToolChains/Darwin.h
index 98ad7431919..73c4ac6aeca 100644
--- a/clang/lib/Driver/ToolChains/Darwin.h
+++ b/clang/lib/Driver/ToolChains/Darwin.h
@@ -252,7 +252,9 @@ public:
return llvm::ExceptionHandling::None;
}
- virtual StringRef getOSLibraryNameSuffix() const { return ""; }
+ virtual StringRef getOSLibraryNameSuffix(bool IgnoreSim = false) const {
+ return "";
+ }
/// }
};
@@ -420,7 +422,7 @@ protected:
Action::OffloadKind DeviceOffloadKind) const override;
StringRef getPlatformFamily() const;
- StringRef getOSLibraryNameSuffix() const override;
+ StringRef getOSLibraryNameSuffix(bool IgnoreSim = false) const override;
public:
static StringRef getSDKName(StringRef isysroot);
OpenPOWER on IntegriCloud