Commit Graph

87 Commits

Author SHA1 Message Date
Ryan Mansfield
a097f9f660 Remove additonal unused diagnostics.
Also fix typo in diagnostics verifier error message.
2024-09-12 12:04:54 -04:00
Ryan Mansfield
8dad181aeb Remove unused diagnostics. 2024-07-16 14:10:02 -04:00
Artem Chikin
73b01dccfc Remove incremental builds from the Legacy driver
The C++-based driver is deprecated and this will help reduce the code surface that requires maintenance as the legacy driver is fully sunset.
2024-01-16 16:34:51 -08:00
Tim Kientzle
5ab60e673a Remove support for linking arclite (#63662)
* Remove support for linking arclite

Darwin no longer uses arclite and it's no longer distributed
in the macOS SDKs.

This leaves the options -link-objc-runtime and -no-link-objc-runtime
in place, but strips out all the logic that actually used them.

* Remove a dead function

* Warn if `-link-objc-runtime` is used

* Update tests to not look for arclite library

* Add an explicit test for the deprecation warning

* Move the macOS-only -link-objc-runtime test to a separate test file
2023-02-23 12:20:33 -08:00
Ben Barham
d7a33551f8 [Option] Add all new driver arguments (without implementations)
Various clients still use the old driver to convert a driver arguments to frontend arguments. This has to work when given new driver arguments, ie. not fail with an unknown argument error.

Move all "extra options" from the new driver into `Options.td` and mark them as new driver only.
2022-08-30 12:46:42 +10:00
Yuta Saito
e738a5dba9 Merge branch 'main' into maxd/driver-wasm-toolchain 2021-10-29 12:07:20 +09:00
Kuba (Brecka) Mracek
94f23942db Add a -experimental-hermetic-seal-at-link flag that triggers aggressive LTO-based dead-stripping (VFE, WME, conditional runtime records, internalization) (#39793) 2021-10-20 07:30:43 -07:00
Slava Pestov
c8f3476f19 Don't use back-quotes in diagnostics 2021-09-15 18:38:34 -04:00
Max Desiatov
710816d3e0 Driver: add support for the Wasm toolchain 2021-09-14 13:02:42 +01:00
Robert Widmann
f6b2294d5a Undo Force Load + Incremental Ban on Darwin Platforms
Gather 'round to hear tell of the saga of autolinking in incremental
mode.

In the beginning, there was Swift code, and there was Objective-C code.
To make one import bind two languages, a twinned Swift module named the same as an
Objective-C module could be imported as an overlay. But all was not
well, for an overlay could be created which had no Swift content, yet
required Swift symbols. And there was much wailing and gnashing of teeth
as loaders everywhere disregarded loading these content-less Swift
libraries.

So, a solution was found - a magical symbol _swift_FORCE_LOAD_$_<MODULE>
that forced the loaders to heed the dependency on a Swift library
regardless of its content. It was a constant with common linkage, and it
was good. But, along came COFF which needed to support autolinking but
had no support for such matters. It did, however, have support for
COMDAT sections into which we placed the symbol. Immediately, a darkness
fell across the land as the windows linker loudly proclaimed it had
discovered a contradiction: "_swift_FORCE_LOAD_$_<MODULE> cannot be
a constant!", it said, gratingly, "for this value requires rebasing."
Undeterred, we switched to a function instead, and the windows linker
happily added a level of indirection to its symbol resolution procedure
and all was right with the world.

But this definition was not all right. In order to support multiple
translation units emitting it, and to prevent the linker from dead
stripping it, Weak ODR linkage was used. Weak ODR linkage has the nasty
side effect of pessimizing load times since the dynamic linker must
assume that loading a later library could produce a more definitive
definition for the symbol.

A compromise was drawn up: To keep load times low, external linkage was
used. To keep the linker from complaining about multiple strong
definitions for the same symbol, the first translation unit in the
module was nominated to recieve the magic symbol. But one final problem
remained:

Incremental builds allow for files to be added or removed during the
build procedure. The placement of the symbol was therefore dependent
entirely upon the order of files passed at the command line. This was no
good, so a decree was set forth that using -autolink-force-load and
-incremental together was a criminal offense.

So we must compromise once more: Return to a symbol with common linkage,
but only on Mach-O targets. Preserve the existing COMDAT-friendly
approach everywhere else.

This concludes our tale.

rdar://77803299
2021-05-24 15:53:13 -07:00
Xi Ge
e24eef4b35 driver: emit a warning when user specified flags to disable the new driver
rdar://78021402
2021-05-14 11:00:36 -07:00
Xi Ge
01b1aea958 Driver: diagnose options that are only supported in the new driver 2021-05-11 16:28:57 -07:00
Xi Ge
64a3a25836 driver: use a non-op front-end argument to indicate new driver is getting used
This could help avoiding emitting remarks.

rdar://73710910
2021-02-10 10:35:26 -08:00
Robert Widmann
cc0d919653 Remove Compiled Source 2021-01-13 23:00:16 -08:00
Robert Widmann
2475095021 Remove Ranges File Type 2021-01-13 22:42:17 -08:00
Robert Widmann
1c93feb2ab Remove Source Ranges Diagnostics 2021-01-13 17:15:52 -08:00
Xi Ge
84afba5cf0 driver: forward driver invocation to the new driver by default
rdar://71817843
2020-12-01 15:20:22 -08:00
Xi Ge
f8577b2aa8 driver: allow SWIFT_USE_NEW_DRIVER to specify a driver executable name 2020-11-07 10:26:50 -08:00
Xi Ge
11b2251ac1 Driver: forwarding driver invocations to the new driver when SWIFT_USE_NEW_DRIVER is defined
This allows us to experiment with the new swift-driver without changing build systems.
2020-10-02 14:02:13 -07:00
Artem Chikin
c52982c9de Add option to accept external module dependency map as input
With: `-external-dependency-module-map-file`
2020-07-27 09:24:35 -07:00
Brent Royal-Gordon
d4ebd5df06 [NFC] Avoid violating same-filename rule in tests
…and modify resolveFileIDConflicts() to diagnose any such violations instead of asserting.

Swift does not allow any two files in the same module to have the same filename, even if they are in different directories. However, this is enforced in the driver, so tests that invoke the frontend directly can violate it. Turns out that a couple of those snuck into the test suite at various points.

This commit updates those tests. It also causes the frontend to diagnose the duplicate filename error just as the driver would have, which should help us understand what happened more easily if this crops up again in the future.

NFC, since invoking the frontend directly is unsupported.
2020-07-13 14:05:13 -07:00
martinboehme
40104ba8b1 Link against the C++ standard library when C++ interop is enabled (#30914)
This doesn't yet allow including C++ headers on platforms where libc++
isn't the default; see comments in UnixToolChains.cpp for details.

However, it does, for example, allow throwing and catching exceptions in C++
code used through interop, unblocking
https://github.com/apple/swift/pull/30674/files.

The flags (-enable-experimental-cxx-interop and -experimental-cxx-stdlib) carry
"experimental" in the name to emphasize that C++ interop is still an
experimental feature.

Co-authored-by: Michael Forster <forster@google.com>
2020-07-09 15:59:26 +02:00
Owen Voorhees
fdb6eabb0a [Diagnostics] Move macros used in diagnostic definitions to their own header
These were duplicated in 11 different files, and as they've gotten more
complex a few inconsistencies have snuck in. Sharing them should make future
changes easier and less bug-prone.
2020-04-14 18:10:30 -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
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
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
Vinicius Vendramini
aebfb53966 Ast dump ignore wmo (#20596)
* Ignore -wmo when passing -dump-ast

* Cleanup on driver diagnostics

* Remove the FIXME.

* Add support for ignoring `-index-file`

* Revert unrelated formatting changes

* Revert back to only ignoring `-wmo`

Ignoring both `-wmo` and `-index-file` will be harder than just `-wmo`. This is because when calling the compiler and passing `-index-file` after `-dump-ast`, the option gets un-ignored by `Driver::buildOutputInfo`. Therefore, we will just ignore `-wmo` for now.

* Add tests, inspired by `Driver/batch_mode_with_WMO_or_index.swift`
2019-12-19 11:47:47 -08:00
David Ungar
38a6559aa9 Take path arg for comparo 2019-11-18 20:23:10 -08:00
David Ungar
c913ffa40e Tests the source-comparator 2019-11-15 17:26:37 -08:00
David Ungar
742c3985bd Source-range-based dependencies
Frontend outputs source-as-compiled, and source-ranges file with function body ranges and ranges that were unparsed in secondaries.
Driver computes diffs for each source file. If diffs are in function bodies, only recompiles that one file. Else if diffs are in what another file did not parse, then the other file need not be rebuilt.
2019-11-12 20:41:02 -08:00
Luciano Almeida
49efa57a26 Updating diagnostic message 2019-07-23 19:30:47 -03: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
83ede1f3cc Forward declaring and improvement on warning. 2019-07-15 22:20:00 -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
Thomas Roughton
b34a1cbbc6 Driver: add -static flag for generating static archives 2019-06-17 12:49:03 +12:00
Harlan Haskins
ea7e7e918f [ModuleInterface] Remove 'parseable interface' from diagnostics
Part of rdar://49359734
2019-04-11 18:05:09 -07:00
Jordan Rose
45557ee2f6 [Driver] Disallow emitting swiftinterfaces with bridging headers
There's no place to put the bridging header in a swiftinterface, and
they don't make sense with the intended use case of distribution.
Just disallow it up front.

rdar://problem/44113493
2018-10-04 18:02:09 -07:00
Keith Smiley
7f3804683b Add warning for bitcode marker without object (#18304)
Previously if you passed `-embed-bitcode-marker` to a command that
wasn't producing an object file, it would silently be ignored. This
change puts it inline with `-embed-bitcode` in this same case, which
generates a warning.
2018-07-30 11:24:09 -07:00
Huon Wilson
db476ba5cd [Driver] Completely remove -emit-public-type-metadata-accessors.
This was retained to help ease migration between versions of the 4.2 compiler
between when the flag was originally introduced and the full fix landed. It's
not longer needed and there's no reason to retain it in the full release.

Fixes rdar://problem/40502379.
2018-06-22 11:31:27 +10:00
David Ungar
46339a79d8 Remove “using batch mode” remark. 2018-06-05 11:19:22 -07:00
Xi Ge
7312fea3b2 migrator: emit error messages when migration scripts are missing.
We used to assert migration scripts exist. This patch further
decouples these scripts and the compiler by treating missing scripts
as a regular compiler error.

Related: rdar://40538097
2018-05-25 11:25:32 -07:00
Huon Wilson
60ae475ca0 [IRGen] Make -emit-public-type-metadata-accessors a no-op.
This work-around is no longer needed now that the full fix landed in
https://github.com/apple/swift/pull/16615. The argument is left with a warning
to help with migration between compilers with the work-around and compilers with
the full fix (see also rdar://problem/40502379).

Fixes rdar://problem/40476573.
2018-05-24 09:37:35 +10:00
David Ungar
83c0d77c1f Batch mode driver remark 2018-05-13 12:58:31 -07:00
David Ungar
2b89d1cf1b Instead of crashing for bad output-file-map path, exit. Also print the path in the diagnostic. 2018-04-24 11:53:52 -07:00
Jordan Rose
e1b70cdb7b Merge pull request #15813 from jrose-apple/decremental
[Driver] Disallow -autolink-force-load with -incremental
2018-04-19 14:20:41 -07:00
Nathan Hawes
0a4204e99f [Driver] Add -driver-filelist-threshold to set the number of inputs beyond which filelists are used
When generating a compiler invocation in driver::createCompilerInvocation()
we end up using filelists if the number of inputs is > 128 (to work around
command line arg limits). We never actually write them out though, and so
fail when parsing the frontend arguments that reference them.

As this function is called frequently by SourceKit and command line limits
aren't a concern here, this patch makes the 128 threshold value configurable
via a new -driver-filelist-threshold option. This is set to its maximum value
in driver::createCompilerInvocation() to ensure filelists aren't used. This
new option makes the existing -driver-use-filelists (that forces filelists to
be used) redundant as it's now equivalent to -driver-filelist-threshold=0.

Resolves rdar://problem/38231888
2018-04-12 05:24:03 -07:00
Jordan Rose
36150a8696 [Driver] Disallow -autolink-force-load with -incremental
6af333f3 changed the implementation of -autolink-force-load to only
generate one symbol, but the /placement/ of that one symbol depends on
the order of input files, and -incremental supports adding a file
without rebuilding all other files. We don't have any need for these
two to play nice together right now, so just disallow it.
2018-04-06 20:06:24 -07:00
David Ungar
43b89133af Warn if explicit batch mode is overridden. 2018-03-28 17:31:34 -07:00
David Ungar
90773d298c Write out filemaps for supplementary outputs.
Add -driver-force-one-batch-repartition and enhance  batch_mode-overlong_argv test.
2018-03-20 09:42:13 -07:00