Commit Graph

1260 Commits

Author SHA1 Message Date
Dario Rexin
e4e6c16319 Fix linker flags for -static-executable
Also adds a test to ensure it does not break in the future
2020-04-08 13:25:27 -07:00
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
Doug Gregor
963c7fccc3 Merge pull request #30465 from xiaobai/dont-autolink-shared-objects
[Driver] Don't pass ELF shared objects to swift-autolink-extract
2020-03-30 13:51:24 -07:00
Owen Voorhees
791312fb74 Turn Educational Notes On-By-Default (#30583)
* [Diagnostics] Turn educational notes on-by-default

* [Diagnostics] Only include educational notes in printed output if -print-educational-notes is passed

* Make -print-educational-notes a driver option

* [Diagnostics] Issue a printed remark if educational notes are available, but disabled

* [docs] Update educational notes documentation and add a contributing guide

* [Diagnostics] Cleanup PrintingDiagnosticConsumer handling of edu notes

* Revert "[Diagnostics] Issue a printed remark if educational notes are available, but disabled"
For now, don't notify users if edu notes are available but disabled. This decision can be reevaluated later.
2020-03-27 15:29:48 -07:00
Doug Gregor
ddc22a3dc3 Merge pull request #30511 from DougGregor/driver-batch-mode-disable-pch-validation
[Driver] Disable PCH validation in batch mode, too.
2020-03-19 15:48:02 -07:00
Doug Gregor
a04260b82a [Driver] Disable PCH validation in batch mode, too.
When building in batch mode with a precompiled bridging header, tell
the frontends to disable PCH validation. We have always done this for
incremental, non-batch builds, but forgot to update this check when we
added batch mode.

Fixes SR-11986 / rdar://problem/58455465
2020-03-19 12:54:27 -07:00
Ben Langmuir
f30102e959 Fix Ubuntu 16.04 master-next build
Two more pair of string conversion fixes. With this, I was able to build
swift master-next on Ubuntu 16.04 (didn't try anything downstream of
swift, and not sure if the tests pass).
2020-03-19 09:51:39 -07:00
Ben Langmuir
a3cf3737d4 Merge pull request #30471 from benlangmuir/more-str
More explicit StringRef -> std::string conversions
2020-03-18 11:36:03 -07:00
Ben Langmuir
a46b35b5ca More explicit StringRef -> std::string conversions
On the older compiler/stdlib used by our Ubuntu 16.04 bots, the
construction

        std::pair<std::string, X>(StringRef, X)

fails unless you call `.str()`. Newer compilers/stdlib treat this as an
explicit construction, which is what is now needed on master-next, so it
only fails on Ubuntu 16.04.

rdar://60514063
2020-03-18 09:50:56 -07:00
Alex Langford
8953af519f [Driver] Don't pass ELF shared objects to swift-autolink-extract
Prior to performing linking on ELF platforms (except the PS4) we extract
autolink information from the object files that will be used during linking.
The current implementation passes all the linker inputs that are marked as an
TY_Object to swift-autolink-extract. There are a two cases where this is
not necessary or problematic.

In the first case, we are looking at an ELF shared object. Although
harmless, this is wasted work. Specifically, the `.swift1_autolink_entries`
entry in the object files are marked as `SHF_EXCLUDE`, meaning they will not be
merged into the final product during linking.

In the second case, we are linking against a linker script that looks like an
ELF shared object (ends with `.so`). In the previous case, the autolink-extract
step will succeed even if it does unnecessary work. In this case, the
autolink-extract step will fail because it cannot recognize the linker script as
an object file. You will observe an error something like this:
```
<unknown>:0: error: error opening input file '/path/to/libLinkerScript.so'
(The file was not recognized as a valid object file
```
Although your linker will know what to do with it, autolink-extract will halt
before you get to that point.
2020-03-17 21:54:00 -07:00
Saleem Abdulrasool
c7a198bc03 Driver: honour -no-toolchain-stdlib-rpath on Unices
Handle `-no-toolchain-stdlib-rpath` on Linux/android as well as Darwin.  This
enables the flags on other Unix platforms as it can be useful to control the
embedded rpath for the library.
2020-03-17 17:38:24 +00:00
Michael Forster
345a9147ec Explicit SmallString->std::string conversion.
This is only needed temporarily until commit d7049213 from upstream
LLVM hits the swift/master branch.
2020-03-13 19:16:49 +01:00
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01:00
Robert Widmann
ef149d5c86 Merge pull request #30135 from CodaFi/verily-i-depend-on-thee
[Incremental] Introducing: DependencyVerifier
2020-03-03 22:01:38 -08:00
Robert Widmann
f85ec3825f Address review feedback 2020-03-03 16:46:04 -08:00
Visoiu Mistrih Francis
aaab1869af Merge pull request #29650 from francisvm/sil-remark-streamer
[Remarks] Add a specialized RemarkStreamer for SIL remarks
2020-03-03 09:30:17 -08:00
Francis Visoiu Mistrih
e724ebab6b [Remarks] Add a specialized RemarkStreamer for SIL remarks
This allows the usage of the whole remark infrastructure developed in
LLVM, which includes a new binary format, metadata in object files, etc.

This gets rid of the YAMLTraits-based remark serialization and does the
plumbing for hooking to LLVM's main remark streamer.

For more about the idea behind LLVM's main remark streamer, see the
docs/Remarks.rst changes in https://reviews.llvm.org/D73676.

The flags are now:

* -save-optimization-record: enable remarks, defaults to YAML
* -save-optimization-record=<format>: enable remarks, use <format> for
serialization
* -save-optimization-record-passes <regex>: only serialize passes that
match <regex>.

The YAMLTraits in swift had a different `flow` setting for the debug
location, resulting in some test changes.
2020-03-02 18:33:20 -08:00
Robert Widmann
d3edb5b15a [Incremental] Plumb -verify-incremental-dependencies Through The Frontend and Driver
When enabled at the driver level, the frontends will inherit the flag. For each frontend that recieves this option, all primaries will have their reference dependencies validated.
2020-03-02 16:45:37 -08:00
3405691582
0d3b92dfb1 Swift Basic/Driver recognizes OpenBSD.
Add the platform conditional and set up other basics for the toolchain.

The ConditionalCompilation tests are updated to match, since otherwise
they seem to trip when building on non-OpenBSD platforms. The
Driver/linker test is updated to ensure lld is passed on this platform.
Note that OpenBSD calls "x86_64" as "amd64", so we use that name for the
architecture instead of trying to alias one to the other, as this makes
things simpler.
2020-02-27 17:14:22 -05:00
Alexis Laferrière
de37409810 [Driver] pass missing private swiftinterface in merge-modules 2020-02-20 17:24:58 -08:00
Alexis Laferrière
901392896d [Frontend] Output the private module interface with the SPI info 2020-02-19 14:17:14 -08:00
Brent Royal-Gordon
d842fa3763 Merge pull request #29582 from brentdax/the-most-ambitious-crossover-event-in-history
Cross-Import Overlays
2020-02-19 09:10:55 -08:00
Brent Royal-Gordon
6cce3d374e Add swiftcrossimport and swiftoverlays file_types 2020-02-18 11:06:12 -08:00
David Ungar
d06cab7378 .str() for fine-grained 2020-02-18 09:51:35 -07:00
David Ungar
709c58ae8e Merge pull request #29869 from davidungar/unit-test-users-v4
[Incremental] Reorganization of SourceFileDepGraph building and mocking.
2020-02-16 22:26:53 -07:00
David Ungar
314d1e12c3 Reorganization of SourceFileDepGraph building and mocking. 2020-02-14 21:53:45 -07:00
Xi Ge
e013f1fb81 TBDGen: add a flag for embedding external symbols in emitted tbd file
Static-linked libraries could add symbols to the final tbd file. We need
this flag to specify additional module names to collect symbols from.

rdar://59399684
2020-02-12 13:47:59 -08:00
swift-ci
0dc9c02d07 Merge pull request #29772 from DougGregor/disable-one-dependency-file 2020-02-11 17:20:54 -08:00
Robert Widmann
054d7b9913 Merge pull request #29713 from CodaFi/unused-unwanted-unloved
[Gardening] Silence Some Warning Spew
2020-02-11 15:46:16 -08:00
Doug Gregor
d000065ab1 Revert "Change to defaulting on"
This reverts commit b1f6a8941c. This
change is causing some instability with incremental builds, so we're
backing it out. Fixes rdar://problem/59016969.
2020-02-11 15:34:48 -08:00
swift-ci
27b12d5d10 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-09 08:44:24 -08:00
David Ungar
3ac5cebd8f Small fixes and debugging improvements for SwiftDriverTests 2020-02-08 22:45:30 -08:00
Robert Widmann
a8119c5771 [Gardening] Add an explicit use of an error code 2020-02-07 16:09:31 -08:00
Robert Widmann
d2360d2e8c [Gardening] dyn_cast -> isa 2020-02-07 16:09:31 -08:00
swift-ci
9d310503ce Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-03 19:03:03 -08:00
Brent Royal-Gordon
b4771c20a0 Merge pull request #29591 from brentdax/stay-on-target
Add target variant to -print-target-info
2020-02-03 19:00:50 -08:00
swift-ci
782b4e1bfa Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-03 15:42:56 -08:00
Xi Ge
273500ec76 Driver: add an option to avoid emitting .swiftsourceinfo files 2020-02-03 13:05:23 -08:00
Brent Royal-Gordon
161061f8a3 Pass target-variant through the driver for -print-target-info 2020-02-01 15:33:38 -08:00
swift-ci
86520fc853 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-29 19:03:10 -08:00
David Ungar
286781fc3e Add a unit test for an individual node change, & add ability to set fingerprints in unit tests. 2020-01-29 16:48:42 -08:00
swift-ci
81a6a266aa Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-27 18:23:23 -08:00
David Ungar
0a3be7575a unit tests compile 2020-01-27 15:14:46 -08:00
David Ungar
6f65e0ec36 Change unfinished handling 2020-01-27 15:14:46 -08:00
David Ungar
d61f6f2f66 Changes to support per-type-body fingerprints. 2020-01-27 15:14:46 -08:00
swift-ci
f324eb6a1e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-23 15:04:45 -08:00
David Ungar
2f79ff7875 Merge pull request #29390 from davidungar/centralizeDefault
[Incremental] Use the initial value of EnableFineGrainedDependencies as the default.
2020-01-23 14:58:50 -08:00