aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Bieneman <chris.bieneman@me.com>2018-08-15 22:50:06 +0000
committerChris Bieneman <chris.bieneman@me.com>2018-08-15 22:50:06 +0000
commit0603ce8ab13aa43b7a35f54e4177502fd648c39a (patch)
tree786462615f08fca00867eca0e348bd46fa3f6ad5
parentb8bf4263674baa6b5fa506c28661e429a660d0e2 (diff)
[Darwin Driver] Fix Simulator builtins and test cases
In r339807, I broke linking the builtins libraries for simulator targets, which itself was bad, but turns out it was all completely untested and marked with FIXME in the test suite. This fixes all the test cases so they actually work, and fixes the bug I introduced in r339807. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339829 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Driver/ToolChains/Darwin.cpp19
-rw-r--r--lib/Driver/ToolChains/Darwin.h6
-rw-r--r--test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.cc_kext_tvos.a0
-rw-r--r--test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.cc_kext_watchos.a0
-rw-r--r--test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.ios.a0
-rw-r--r--test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.osx.a0
-rw-r--r--test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.profile_tvos.a0
-rw-r--r--test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.profile_watchos.a0
-rw-r--r--test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.tvos.a0
-rw-r--r--test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.watchos.a0
-rw-r--r--test/Driver/darwin-ld.c69
11 files changed, 37 insertions, 57 deletions
diff --git a/lib/Driver/ToolChains/Darwin.cpp b/lib/Driver/ToolChains/Darwin.cpp
index 6c8bba5764..5971a0ae44 100644
--- a/lib/Driver/ToolChains/Darwin.cpp
+++ b/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/lib/Driver/ToolChains/Darwin.h b/lib/Driver/ToolChains/Darwin.h
index 98ad743191..73c4ac6aec 100644
--- a/lib/Driver/ToolChains/Darwin.h
+++ b/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);
diff --git a/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.cc_kext_tvos.a b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.cc_kext_tvos.a
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.cc_kext_tvos.a
diff --git a/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.cc_kext_watchos.a b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.cc_kext_watchos.a
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.cc_kext_watchos.a
diff --git a/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.ios.a b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.ios.a
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.ios.a
diff --git a/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.osx.a b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.osx.a
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.osx.a
diff --git a/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.profile_tvos.a b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.profile_tvos.a
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.profile_tvos.a
diff --git a/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.profile_watchos.a b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.profile_watchos.a
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.profile_watchos.a
diff --git a/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.tvos.a b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.tvos.a
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.tvos.a
diff --git a/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.watchos.a b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.watchos.a
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/test/Driver/Inputs/resource_dir/lib/darwin/libclang_rt.watchos.a
diff --git a/test/Driver/darwin-ld.c b/test/Driver/darwin-ld.c
index c98d1abcab..3c339a117d 100644
--- a/test/Driver/darwin-ld.c
+++ b/test/Driver/darwin-ld.c
@@ -152,78 +152,51 @@
// RUN: FileCheck -check-prefix=LINK_NO_IOS_ARM64_CRT1 %s < %t.log
// LINK_NO_IOS_ARM64_CRT1-NOT: crt
-// RUN: %clang -target x86_64-apple-ios6.0 -miphoneos-version-min=6.0 -fprofile-instr-generate -### %t.o 2> %t.log
+// RUN: %clang -target x86_64-apple-ios6.0 -miphoneos-version-min=6.0 -fprofile-instr-generate -resource-dir=%S/Inputs/resource_dir -### %t.o 2> %t.log
// RUN: FileCheck -check-prefix=LINK_IOSSIM_PROFILE %s < %t.log
// LINK_IOSSIM_PROFILE: {{ld(.exe)?"}}
// LINK_IOSSIM_PROFILE: libclang_rt.profile_iossim.a
+// LINK_IOSSIM_PROFILE: libclang_rt.ios.a
-// FIXME: Currently the builtin library is only added to the command line if it,
-// so we can't check for it here
-// FIXME_LINK_IOSSIM_PROFILE: libclang_rt.ios.a
-
-// RUN: %clang -target arm64-apple-tvos8.3 -mtvos-version-min=8.3 -### %t.o 2> %t.log
+// RUN: %clang -target arm64-apple-tvos8.3 -mtvos-version-min=8.3 -resource-dir=%S/Inputs/resource_dir -### %t.o 2> %t.log
// RUN: FileCheck -check-prefix=LINK_TVOS_ARM64 %s < %t.log
// LINK_TVOS_ARM64: {{ld(.exe)?"}}
// LINK_TVOS_ARM64: -tvos_version_min
// LINK_TVOS_ARM64-NOT: crt
// LINK_TVOS_ARM64-NOT: lgcc_s.1
-// FIXME: This library does not get built unless the tvOS SDK is
-// installed, and the driver will not try to link it if it does not exist.
-// This should be reenabled when the tvOS SDK becomes a standard part
-// of Xcode.
-// FIXME_LINK_TVOS_ARM64: libclang_rt.tvos.a
+// LINK_TVOS_ARM64: libclang_rt.tvos.a
-// RUN: %clang -target arm64-apple-tvos8.3 -mtvos-version-min=8.3 -fprofile-instr-generate -### %t.o 2> %t.log
+// RUN: %clang -target arm64-apple-tvos8.3 -mtvos-version-min=8.3 -fprofile-instr-generate -resource-dir=%S/Inputs/resource_dir -### %t.o 2> %t.log
// RUN: FileCheck -check-prefix=LINK_TVOS_PROFILE %s < %t.log
// LINK_TVOS_PROFILE: {{ld(.exe)?"}}
-// FIXME: These libraries do not get built unless the tvOS SDK is
-// installed, and the driver will not try to link them if they do not exist.
-// This should be reenabled when the tvOS SDK becomes a standard part
-// of Xcode.
-// FIXME_LINK_TVOS_PROFILE: libclang_rt.profile_tvos.a
-// FIXME_LINK_TVOS_PROFILE: libclang_rt.tvos.a
-
-// RUN: %clang -target arm64-apple-tvos8.3 -mtvos-version-min=8.3 -### %t.o -lcc_kext 2> %t.log
+// LINK_TVOS_PROFILE: libclang_rt.profile_tvos.a
+// LINK_TVOS_PROFILE: libclang_rt.tvos.a
+
+// RUN: %clang -target arm64-apple-tvos8.3 -mtvos-version-min=8.3 -resource-dir=%S/Inputs/resource_dir -### %t.o -lcc_kext 2> %t.log
// RUN: FileCheck -check-prefix=LINK_TVOS_KEXT %s < %t.log
// LINK_TVOS_KEXT: {{ld(.exe)?"}}
-// FIXME: These libraries do not get built unless the tvOS SDK is
-// installed, and the driver will not try to link them if they do not exist.
-// This should be reenabled when the tvOS SDK becomes a standard part
-// of Xcode.
-// FIXME_LINK_TVOS_KEXT: libclang_rt.cc_kext_tvos.a
-// FIXME_LINK_TVOS_KEXT: libclang_rt.tvos.a
-
-// RUN: %clang -target armv7k-apple-watchos2.0 -mwatchos-version-min=2.0 -### %t.o 2> %t.log
+// LINK_TVOS_KEXT: libclang_rt.cc_kext_tvos.a
+// LINK_TVOS_KEXT: libclang_rt.tvos.a
+
+// RUN: %clang -target armv7k-apple-watchos2.0 -mwatchos-version-min=2.0 -resource-dir=%S/Inputs/resource_dir -### %t.o 2> %t.log
// RUN: FileCheck -check-prefix=LINK_WATCHOS_ARM %s < %t.log
// LINK_WATCHOS_ARM: {{ld(.exe)?"}}
// LINK_WATCHOS_ARM: -watchos_version_min
// LINK_WATCHOS_ARM-NOT: crt
// LINK_WATCHOS_ARM-NOT: lgcc_s.1
-// FIXME: This library does not get built unless the watchOS SDK is
-// installed, and the driver will not try to link it if it does not exist.
-// This should be reenabled when the watchOS SDK becomes a standard part
-// of Xcode.
-// FIXME_LINK_WATCHOS_ARM: libclang_rt.watchos.a
+// LINK_WATCHOS_ARM: libclang_rt.watchos.a
-// RUN: %clang -target armv7k-apple-watchos2.0 -mwatchos-version-min=2.0 -fprofile-instr-generate -### %t.o 2> %t.log
+// RUN: %clang -target armv7k-apple-watchos2.0 -mwatchos-version-min=2.0 -resource-dir=%S/Inputs/resource_dir -fprofile-instr-generate -### %t.o 2> %t.log
// RUN: FileCheck -check-prefix=LINK_WATCHOS_PROFILE %s < %t.log
// LINK_WATCHOS_PROFILE: {{ld(.exe)?"}}
-// FIXME: These libraries do not get built unless the watchOS SDK is
-// installed, and the driver will not try to link them if they do not exist.
-// This should be reenabled when the watchOS SDK becomes a standard part
-// of Xcode.
-// FIXME_LINK_WATCHOS_PROFILE: libclang_rt.profile_watchos.a
-// FIXME_LINK_WATCHOS_PROFILE: libclang_rt.watchos.a
-
-// RUN: %clang -target armv7k-apple-watchos2.0 -mwatchos-version-min=2.0 -### %t.o -lcc_kext 2> %t.log
+// LINK_WATCHOS_PROFILE: libclang_rt.profile_watchos.a
+// LINK_WATCHOS_PROFILE: libclang_rt.watchos.a
+
+// RUN: %clang -target armv7k-apple-watchos2.0 -mwatchos-version-min=2.0 -resource-dir=%S/Inputs/resource_dir -### %t.o -lcc_kext 2> %t.log
// RUN: FileCheck -check-prefix=LINK_WATCHOS_KEXT %s < %t.log
// LINK_WATCHOS_KEXT: {{ld(.exe)?"}}
-// FIXME: These libraries do not get built unless the watchOS SDK is
-// installed, and the driver will not try to link them if they do not exist.
-// This should be reenabled when the watchOS SDK becomes a standard part
-// of Xcode.
-// FIXME_LINK_WATCHOS_KEXT: libclang_rt.cc_kext_watchos.a
-// FIXME_LINK_WATCHOS_KEXT: libclang_rt.watchos.a
+// LINK_WATCHOS_KEXT: libclang_rt.cc_kext_watchos.a
+// LINK_WATCHOS_KEXT: libclang_rt.watchos.a
// RUN: %clang -target i386-apple-darwin12 -pg -### %t.o 2> %t.log
// RUN: FileCheck -check-prefix=LINK_PG %s < %t.log