Commit Graph

44 Commits

Author SHA1 Message Date
Doug Gregor
1ec900e2a0 [Macros] Add default plugin paths for Darwin SDKs and platforms.
Corresponding to https://github.com/apple/swift-driver/pull/1377, this
adds some default plugin paths for Darwin SDKs and platforms.
Fixes rdar://110819604.
2023-06-16 14:55:20 -07:00
Yuta Saito
c994500d82 [Driver] Use WebAssembly toolchain for WASI target
The toolchain was introduced in 710816d3e0
but was not used. Test cases now use fake resource dir to lookup
static-executable-args.lnk file, which is required by the toolchain but
is not present when not building stdlib for WASI.
2023-06-08 11:40:10 +00:00
Saleem Abdulrasool
23b1a6b87a Driver: add support for WASI/WASM toolchain
Treat WASM/WASI as a generic Unix toolchain.  This adds the necessary
support to build a toolchain for WASM/WASI.
2019-12-04 20:14:08 -08:00
Jordan Rose
3694686cf6 [test] Add tests for Darwin Driver rpath work 2019-08-02 13:33:36 -07:00
Saleem Abdulrasool
f82572a573 Merge pull request #25990 from compnerd/one-sdk-to-rule-them-all
Driver: look for the runtime object in the SDK
2019-07-25 15:32:51 -07:00
Saleem Abdulrasool
e96e7cc190 Driver: look for the runtime object in the SDK
The runtime object is for the host, and is part of the SDK.  If `-sdk`
is passed, look for the runtime support object relative to the SDK root.
2019-07-09 14:56:42 -07:00
Daniel Rodríguez Troitiño
c099f0e498 [windows] Fix paths in test to work for Windows. 2019-07-09 14:35:31 -07: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
Jason Mittertreiner
4e0b092fbe Fixing Driver tests on Windows (#20209) 2018-12-10 18:27:37 -08:00
Thomas Roughton
5bb6ac2e12 Implement a Windows toolchain. 2018-04-18 15:26:05 +12:00
Saleem Abdulrasool
0c42b57962 ELF: restructure image metadata registration
Restructure the ELF handling to be completely agnostic to the OS.
Rather than usng the loader to query the section information, use the
linker to construct linker tables and synthetic markers for the
beginning and of the table.  Save off the values of these pointers and
pass them along through the constructor to the runtime for registration.

This removes the need for the begin/end objects.  Remove the special
construction of the begin/end objects through the special assembly
constructs, preferring to do this in C with a bit of inline assembly to
ensure that the section is always allocated.

Remove the special handling for the various targets, the empty object
file can be linked on all the targets.

The new object file has no requirements on the ordering.  It needs to
simply be injected into the link.

Name the replacement file `swiftrt.o` mirroring `crt.o` from libc.  Merge
the constructor and the definition into a single object file.

This approach is generally more portable, overall simpler to implement,
and more robust.

Thanks to Orlando Bassotto for help analyzing some of the odd behaviours
when switching over.
2017-11-28 10:04:04 -08:00
David Farler
b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Dmitri Gribenko
cc2a2f8921 Revert "[Driver] Default SDKROOT to / on FreeBSD." 2016-03-02 09:26:06 -08:00
Davide Italiano
c82588b01b [Driver] Default SDKROOT to / on FreeBSD.
This is needed for the testusuite to run correctly.
2016-03-01 20:15:24 +00:00
William Dillon
d0d9b1de5a Discard swift.ld and support gold linker 2016-02-17 17:47:35 -08:00
Adrian Prantl
0de0d43773 Introduce a -modulewrap driver action that wraps a (merged) .swiftmodule
inside a swift ast section in an object file so it can be passed to the
linker. The driver automatically wraps merged swiftmodules iff the target
is ELF.

rdar://problem/22407666

Swift SVN r31641
2015-09-02 21:56:25 +00:00
Jordan Rose
c1ab32e7f2 On Linux, "/" is a perfectly reasonable default SDK.
Swift SVN r31534
2015-08-27 18:47:24 +00:00
Jordan Rose
442b76fe08 [test] Split out Apple parts of Driver/sdk.swift. NFC.
Swift SVN r31533
2015-08-27 18:47:19 +00:00
Dmitri Hrybenko
ea17483633 Add CMake options and #ifs to hide tvOS
Swift SVN r28752
2015-05-19 05:15:52 +00:00
Jordan Rose
b33994fabd [Driver] Bump required versions of the SDKs.
rdar://problem/20408977

Swift SVN r28043
2015-05-01 18:16:13 +00:00
David Farler
544ef4002d Merge tvOS and watchOS Support
- Add frontend and standard library build support for tvOS.
- Add frontend support for watchOS.

watchOS standard library builds are still disabled during SDK bring-up.

To build for TVOS, specify --tvos to build-script.
To build for watchOS, specify --watchos to build-script (not yet supported).

This patch does not include turning on full tests for TVOS or watchOS, and
will be included in a follow-up patch.

Swift SVN r26278
2015-03-18 21:35:07 +00:00
Graham Batty
83b4384fac Update test flags for linux failures and support.
Also removed the sdk 'feature' in favour of the more specific
objc_interop.

Swift SVN r24856
2015-01-30 21:31:48 +00:00
Graham Batty
83f27a8af7 Revert "Mark tests that don't pass on linux as XFAIL."
This reverts commit 2711ca86de7bf6a7885ccea24219a48a590b1e95.

Swift SVN r23577
2014-11-24 17:42:13 +00:00
Graham Batty
198402dcfe Mark tests that don't pass on linux as XFAIL.
Swift SVN r23573
2014-11-24 17:40:37 +00:00
Jordan Rose
f22fd8da7b [test] Disable GuardMalloc logging, and re-enable the tests that logging broke.
Thanks, Greg.

Swift SVN r22009
2014-09-17 06:10:21 +00:00
Jordan Rose
3af1873db1 [test] Add "XFAIL: gmalloc" where appropriate.
As a reminder, you can test with GuardMalloc by passing "--param gmalloc"
to lit.

All other tests pass under GuardMalloc. Hooray!

Swift SVN r21995
2014-09-16 23:12:17 +00:00
Jordan Rose
686e93e7d2 [test] Make driver tests more robust against paths containing dots.
Swift SVN r21853
2014-09-10 22:48:38 +00:00
Jordan Rose
1d8c75ede1 [test] Fix driver tests to handle spaces in the path to Xcode.
Commands like 'ld' are picked up from the path, which can result in picking
the binaries inside Xcode.

Swift SVN r21749
2014-09-05 22:22:41 +00:00
Jordan Rose
e3261af695 [Driver] Don't pass -module-name to the LLDB REPL.
The LLDB REPL doesn't guarantee any particular module name, and in particular
it currently uses multiple modules to handle redefinitions.

<rdar://problem/17918172>

Swift SVN r21303
2014-08-20 01:41:17 +00:00
Jordan Rose
4ceaaa53ee [test] Fix test for r21100 to not rely on empty directories.
...which git completely ignored.

Swift SVN r21103
2014-08-08 01:39:20 +00:00
Jordan Rose
2d727bb7a3 [Driver] Reject SDKs older than OS X 10.10 or iOS 8.
Actually, reject SDK directories whose names match
  "*OSX<version>(.Internal)?.sdk" on OS X with a version older than 10.10
  "*OS7*" on iOS
  "*Simulator7*" on iOS

We only really care about 10.9 anyway, but just in case people install the
one-previous version of iOS...

<rdar://problem/17951615>

Swift SVN r21100
2014-08-08 00:22:35 +00:00
Ben Langmuir
d197964680 Rename -integrated-repl to -deprecated-integrated-repl
Swift SVN r20781
2014-07-30 22:09:37 +00:00
Ben Langmuir
920a8ff343 Make using the -i flag an error
This flag is now obsoleted by the interactive driver and simply
complicates understanding the command-line parsing. Making it an error
to force users to move also allows us to reuse the flag in the future if
we like.

Swift SVN r20641
2014-07-28 20:19:27 +00:00
Ben Langmuir
07a3c7cbd5 Switch to the new swift/swiftc commmand line interface
This makes the command line interface to 'swift' the same as what was
previously in 'swifti', and removes the staging symlink.

For posterity, the command line behaviour for 'swift' is now:
* `swift` -> start the repl
* `swift script.swift` -> run script.swift (the old -i mode)
* Any arguments after the input file are forwarded to the script as
  Process.arguments
* A shebang line is something like #!/usr/bin/xcrun swift

The batch compiler 'swiftc' behaves much like the old 'swift'
executable, but without the interactive bits now in 'swifti'.

<rdar://problem/17710788>

Swift SVN r20540
2014-07-25 13:28:21 +00:00
Ben Langmuir
d2ef235237 Move the lit tests over to the new swift/swiftc interfaces
Most of the tests just got moved to swiftc, but some of them were
duplicated to apply to both swiftc and swift. A handful still use the
existing 'swift' because they are for the existing '-i' syntax.

Note: this means config.swift_driver now uses the staging symlink
'swifti'. The only thing preventing us from dropping the 'i' and getting
rid of the old interface is that Xcode hasn't moved to swiftc yet
<rdar://problem/17769327>.

Swift SVN r20467
2014-07-24 04:34:10 +00:00
Ben Langmuir
afd88cab2a Add parsing support for swifti
Parse until the first input, and then collect the remaining arguments
and forward them to the script.

Swift SVN r20437
2014-07-23 22:42:05 +00:00
Ben Langmuir
8b7cc4f619 Make -i compatible with shebangs and forward arguments correctly
The driver option -i now requires an input file as argument, and any
options after the input file will be treated as arguments to the
interpretted file.

This also renames the frontend option to -interpret, since it is parsed
as a flag, unlike -i. We could support -interpret in the driver if we
wanted, which would allow us to use --, but wouldn't work with shebang
scripts. For now, it's frontend-only.

Swift SVN r19718
2014-07-09 02:37:42 +00:00
Jordan Rose
3f97d035fd [Driver] Allow falling back to / for -i mode if xcrun says to.
After a long discussion with Daniel, the behavior of "xcrun --sdk macosx"
will always pick the best  SDK to use with the Swift found by "xcrun swift".
The only case in which we have a problem is if someone has explicitly
specified the path to a Swift binary, or if someone is on 10.9 but only has
the command line tools installed (in which case they lose anyway).

In order to keep this from polluting the tests, I've changed %swift_driver
to set SDKROOT to an empty path by default. Use -sdk if you need to provide
an SDK in a test, not the SDKROOT environment variable. (This is what
everyone has been doing so far.)

This is still limited to -i and REPL modes; for compilation an explicit SDK
is still required.

<rdar://problem/14395800>

Swift SVN r18770
2014-06-10 01:00:43 +00:00
Jordan Rose
e715940241 [Driver] Teach "swift -i" and "swift -repl" to default to the current OS X SDK.
This only works when swift is packaged with Xcode or installed as a command
line tool, but those are the important cases.

<rdar://problem/14395800>, again.

Swift SVN r18757
2014-06-09 21:29:08 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Connor Wakamo
6384482902 [driver] Added support to honor the SDKROOT environment variable.
Centralized the driver-level handling of the SDK path in OutputInfo and
Driver::buildOutputInfo(), and added support for falling back to getenv(SDKROOT)
if -sdk wasn't passed (and SDKROOT is set in the environment).

Updated Swift::constructJob() to get the SDK path from the OutputInfo instead of
just passing -sdk from the original driver invocation.

Also added a driver-level check to ensure that the specified SDK is present;
if not, print out a warning. This fixes <rdar://problem/14409974>.

Added test/Driver/sdk.swift to test the -sdk and SDKROOT behavior, as well as
the nonexistent SDK warning.

Swift SVN r12815
2014-01-22 23:41:29 +00:00