Commit Graph

55 Commits

Author SHA1 Message Date
Doug Gregor
82ceb29576 [Driver] Fix platform name to match what the linker does, not what it says 2020-04-03 13:51:29 -07:00
Doug Gregor
970ff6b818 [Driver] Read SDK version information to pass to the Darwin linker.
Recent-ish SDKs for Darwin platforms include an SDKSettings.json
file with version information and Catalyst SDK version mappings. Read
these (when available) and use them to pass the appropriate SDK
version down to the Darwin linker via `-platform_version`.

Finishes rdar://problem/55972144.
2020-04-02 21:07:26 -07:00
Doug Gregor
6edc32568c [Driver] Adjust Mac Catalyst deployment target to >= iOS 13 for the linker
Mac Catalyst was introduced with an iOS deployment target of 13.0.
If given a deployment target before that, adjust the deployment target
to 13.0 for the linker.
2020-04-02 21:07:26 -07:00
Doug Gregor
336c0c2d54 [Driver] Use -platform_version to specify platform versions for the Darwin linker
Standardize the way in which we pass platform version information to
the Darwin linker, using the `-platform_version` option. In the case
of Mac Catalyst, there may be two such platform arguments.

The eventual point of this refactoring is to also pass information
about the SDK version, which `-platform_version` supports but the
mix of `-*_version_min` parameters do not. For now, the SDK
version is stubbed out to 0.0.0, which is this option's "unknown"
value.

Part of rdar://problem/55972144.
2020-04-02 21:07:26 -07:00
Devin Coughlin
655d89b146 [Driver/Frontend] Add Driver support for macCatalyst and library search paths
Add support in the driver and frontend for macCatalyst target
targets and library search paths.

The compiler now adds two library search paths for overlays when compiling
for macCatalyst: one for macCatalyst libraries and one for zippered macOS
libraries. The macCatalyst path must take priority over the normal macOS path
so that in the case of 'unzippered twins' the macCatalyst library is
found instead of the macOS library.

To support 'zippered' builds, also add support for a new -target-variant
flag. For zippered libraries, the driver invocation takes both a -target and a
-target-variant flag passes them along to the frontend. We support builds both
when the target is a macOS triple and the target variant is macCatalyst and
also the 'reverse zippered' configuration where the target is macCatalyst and the
target-variant is macOS.
2020-01-21 18:28:17 -08:00
David Ungar
aee3cb482e Try both in filelist for linker 2019-11-18 22:19:43 -08:00
David Ungar
1f60d4479e Work with either source of inputs. 2019-11-18 17:53:52 -08:00
David Ungar
76c4742ba0 Use correct designator for filelist 2019-11-18 17:07:22 -08:00
Dan Zheng
3bbc50430b Add -no-toolchain-stdlib-rpath flag. (#27207)
Add `-no-toolchain-stdlib-rpath` flag: the negative version of
`-toolchain-stdlib-rpath`.

Make `-no-toolchain-stdlib-rpath` be the default: use `/usr/lib/swift` as
default RPATH on Darwin platforms instead of toolchain standard library.

Adapted from https://github.com/apple/swift/pull/27206.

tensorflow branch requires the opposite default (use toolchain standard
library as RPATH) because some stdlib modules like TensorFlow do not exist in
`/usr/lib/swift`.
2019-09-21 04:38:25 -07:00
Jordan Rose
87b7ee1bc0 Tweak Swift-in-OS check to account for linker limitations
The backwards-deployment install name trickery we're using doesn't
handle "patch" components in version numbers, so we still need to
provide an rpath even when deploying to macOS 10.14.4.
2019-08-02 13:33:36 -07:00
Graydon Hoare
fa244b2334 Factor out toolchains::Darwin::addLinkerInputArgs. 2019-08-02 13:33:36 -07:00
Jordan Rose
7fb43af6e5 Factor out toolchains::Darwin::addSanitizerArgs. 2019-08-02 13:33:36 -07:00
Graydon Hoare
71dd7417be Factor out toolchains::Darwin::addProfileGenerationArgs. 2019-08-02 13:33:36 -07:00
Graydon Hoare
7953d59571 Factor out toolchains::Darwin::addDeploymentTargetArgs. 2019-08-02 13:33:36 -07:00
Graydon Hoare
7cc1b135e3 Factor out toolchains::Darwin::addArgsToLinkARCLite. 2019-08-02 13:33:32 -07:00
Jordan Rose
05903b593c Factor out toolchains::Darwin::addArgsToLinkStdlib. 2019-08-02 13:28:37 -07:00
Jordan Rose
2765011353 <rdar://43616773> Modify toolchains::Darwin linking logic to account for Swift-in-the-OS.
Manual re-application of a patch by Graydon Hoare.
2019-08-02 13:27:02 -07:00
Luciano Almeida
3bcc072cfe Changing diagnose from error to warning, updating message and tests 2019-07-22 20:58:19 -03:00
Luciano Almeida
0d8da23336 Diagnose libarclite not found on darwing toolchain 2019-07-21 22:27:05 -03:00
Luciano Almeida
874f53daf1 Fixing spacing. 2019-07-19 19:21:09 -03:00
Luciano Almeida
1f3781ccb4 Identation. 2019-07-18 23:22:18 -03:00
Luciano Almeida
ba597a02b9 Refactoring validate Deployment targets to darwing toolchain validation 2019-07-18 23:20:58 -03:00
Luciano Almeida
ed432ac302 Missing forward 2019-07-15 22:56:56 -03:00
Luciano Almeida
7e9516a7fe Fixing nits and unused code. 2019-07-15 22:29:37 -03:00
Luciano Almeida
83ede1f3cc Forward declaring and improvement on warning. 2019-07-15 22:20:00 -03:00
Luciano Almeida
217887ae91 Fixing nitpicks. 2019-07-15 22:12:51 -03:00
Luciano Almeida
c95f28c9dc Moving -static-stdlib validation to Darwin toolchain. 2019-07-15 21:02:39 -03:00
Luciano Almeida
1983e15ef2 Validate -static-stdlib on Driver::validate args and removing handles on Darwing toolchain 2019-07-14 22:22:13 -03:00
Brent Royal-Gordon
1e81ced48d Revert "Revert "Look up runtime libraries in SDK"" 2019-07-03 14:18:48 -07:00
Xi Ge
fdd41aeb68 Revert "Look up runtime libraries in SDK (#25740)"
This reverts commit b818b441f2.
2019-06-25 17:48:41 -07:00
Brent Royal-Gordon
b818b441f2 Look up runtime libraries in SDK (#25740)
In #23175, we started looking in the SDK for swiftmodules, but we want to look for the dylibs there too. Fixes <rdar://problem/52059706>.
2019-06-25 15:39:03 -07:00
Jordan Rose
543632deda Merge pull request #25202 from troughton/static-libraries-driver
[Driver] Add -static flag for generating static archives
2019-06-20 09:10:02 -07:00
Arnold Schwaighofer
a9c83e73ed Fix swiftpm targets without swift
SwiftPM will pass a -runtime-compatibility-version none in this case.
2019-06-18 03:37:43 -07:00
Arnold Schwaighofer
443719d033 Fix invalid deref 2019-06-18 01:00:03 -07:00
Arnold Schwaighofer
d76c8147a0 Fix swiftpm build 2019-06-17 19:47:39 -07:00
Thomas Roughton
e5ea42d774 Driver: renamic LinkJob to DynamicLinkJob and ArchiveJob to StaticLinkJob
# Conflicts:
#	lib/Driver/DarwinToolChains.cpp
2019-06-17 12:49:17 +12:00
Thomas Roughton
b34a1cbbc6 Driver: add -static flag for generating static archives 2019-06-17 12:49:03 +12:00
Joe Groff
4ed8de10f9 Revert "Revert "Use autolinking to pull in compatibility libraries."" 2019-06-03 20:10:51 -07:00
Joe Groff
a7cc3a38cc Revert "Use autolinking to pull in compatibility libraries." 2019-06-03 14:18:39 -07:00
Joe Groff
dffd1b27a1 Use autolinking to pull in compatibility libraries.
Many build systems that support Swift don't use swiftc to drive the linker. To make things
easier for these build systems, also use autolinking to pull in the needed compatibility
libraries. This is less ideal than letting the driver add it at link time, since individual
compile jobs don't know whether they're building an executable or not. Introduce a
`-disable-autolink-runtime-compatibility` flag, which build systems that do drive the linker
with swiftc can pass to avoid autolinking.

rdar://problem/50057445
2019-05-31 13:11:14 -07:00
Joe Groff
2a2d40d870 Driver: Link against compatibility library for deploying back to Swift 5.0 runtimes 2019-05-24 12:44:22 -07:00
Jordan Rose
e76b5a847c [Driver] Always fall back to an arclite in the Xcode default toolchain (#22911)
...instead of the current toolchain, which we would have just
searched by looking relative to the swiftc binary.

rdar://problem/48044350
2019-02-26 08:41:03 -08:00
Rahul Malik
d3cc043e58 Add Undefined Behavior sanitizer to Swift Driver (#18553)
This change allows the swift driver to link the ubsan runtime if
`-sanitize=undefined` is specified.
This is useful for sanitizing linked Objective-C code.
2018-11-13 12:11:56 -08:00
Jordan Rose
e224e31720 Break almost all dependencies of Driver on Frontend
- Sink OutputFileMap{.h,.cpp} and ReferenceDependencyKeys.h to Basic
- Remove unnecessary includes of Frontend.h.
2018-08-27 20:47:58 -07:00
Keith Smiley
ab5588da05 Reorder Xlinker and linker option group 2018-07-30 09:30:12 -07:00
Keith Smiley
1f4e643d42 Move linker arguments to the end 2018-07-27 14:34:00 -07:00
Jordan Rose
e9f71fd61c [Driver] We don't need arclite on pre-10.14 after all
Reverts the effects of df974b2190, but keeps the refactoring and nicer
tests.
2018-07-18 18:28:12 -07:00
Jordan Rose
df974b2190 [Driver] Always link arclite when deploying earlier than macOS 10.14
For the upcoming hook in the ObjC runtime for class_getImageName
(see previous commit).
2018-07-12 15:48:58 -07:00
Jordan Rose
d11704bcc9 Add swift::getNonSimulatorPlatform for DarwinPlatformKind
And use it in getDarwinLibraryNameSuffixForTriple, making the logic
there clearer.

Suggested by David U!
2018-07-11 15:09:53 -07:00
Jordan Rose
d4668833e0 [Driver] Only link to compiler_rt if present for the target platform
Tweak the tests to check this correctly.
2018-07-10 12:45:59 -07:00