Commit Graph

411 Commits

Author SHA1 Message Date
practicalswift
451a104116 [gardening] Fix recently introduced typo: "dependcy" → "dependency" 2016-03-01 11:28:52 +01:00
AnnaZaks
767d9ca914 Merge pull request #1434 from apple/asan
[asan] Add basic support for Address Sanitizer function instrumentation
2016-02-29 18:58:40 -08:00
zaks
2110235fd3 [asan] Cleanup based on Jordan's review comments 2016-02-26 16:02:40 -08:00
zaks
d727c68fde [asan] Add "unsupported option .. for target" error message
ASan support for Linux does not exist at this point.
2016-02-25 15:20:51 -08:00
zaks
ef925f8fb3 [asan] Add basic support for Address Sanitizer function instrumentation
ASan allows to catch and diagnose memory corruption errors, which are possible
when using unsafe pointers.

This patch introduces a new driver/frontend option -sanitize=address to enable
ASan. When option is passed in, the ASan llvm passes will be turned on and
all functions will gain SanitizeAddress llvm attribute.
2016-02-24 09:45:38 -08:00
Han Sangjin
e06c7136cb Porting to Cygwin. rebased and squashed 2016-02-22 13:20:21 +09:00
William Dillon
d0d9b1de5a Discard swift.ld and support gold linker 2016-02-17 17:47:35 -08:00
Orlando Bassotto
f889bcc64f Implement -use-ld= switch in Swift 2016-02-17 17:47:35 -08:00
AlexDenisov
f8688daf57 Use operator== to compare YAML iterators 2016-02-07 16:55:01 +01:00
William Dillon
ab7c87e7e8 Implemented ARMv6 and fixed up ARMv7 2016-01-29 21:41:22 +00:00
Jordan Rose
9c6cdd3296 [Driver] Fix references to Clang's profiling runtime.
(1) We no longer put the Clang version string in our copy of or symlink to
    Clang's resource directory.
(2) Newer Clang builds now generate a separate library for the Apple OS
    simulators, instead of a fat binary.

We still need a proper end-to-end test for this, but that depends on
building compiler-rt with Swift, which isn't a standard config yet.
2016-01-28 20:00:41 -08:00
practicalswift
8efa5f587e [gardening] Remove "-*- C++ -*-" tag from .cpp files
Emacs assumes .h files are C files by default which is why the
tag "-*- C++ -*-" is needed.

.cpp files do not have this problem.
2016-01-23 12:09:32 +01:00
Michael Ilseman
dc689e607c [Diagnostics] -suppress-warnings and -warnings-as-errors flags
Exposes the global warning suppression and treatment as errors
functionality to the Swift driver. Introduces the flags
"-suppress-warnings" and "-warnings-as-errors". Test case include.
2016-01-15 14:20:44 -08:00
Jordan Rose
bbc14afd04 [Driver] Write per-job filelists even under -save-temps.
Same as the previous commit; here's a test case that triggers it.

Last bit of https://bugs.swift.org/browse/SR-280.
2016-01-13 18:41:05 -08:00
Jordan Rose
ce34ed593c [Driver] Use filelists for the *output* of a threaded WMO build.
This is only the driver side of the work; the frontend doesn't understand
this new -output-filelist option yet. Next commit.

More https://bugs.swift.org/browse/SR-280.
2016-01-13 18:39:24 -08:00
Jordan Rose
062713d600 [Driver] Use -filelist for the merge-module step.
More https://bugs.swift.org/browse/SR-280.
2016-01-13 18:39:24 -08:00
Jordan Rose
3328a30ea8 [Driver] Write the all-sources file even under -save-temps.
We optimize subprocess invocation to a simple execve() if there's no
cleanup work to do, but that doesn't get us out of doing /setup/ work.
2016-01-13 18:39:24 -08:00
Jordan Rose
6067120f81 [Driver] Emit filelists for Jobs that want them (inputs).
This is the other half of the previous commit: we can use -filelist for
linking on Darwin.

More https://bugs.swift.org/browse/SR-280.
2016-01-13 18:39:24 -08:00
Jordan Rose
f557563068 [Driver] Pass -filelist to Darwin 'ld' too.
Start sketching out a way for individual jobs to request filelists for
their inputs or their outputs. This should cover all the cases mentioned
in ad945426.

More https://bugs.swift.org/browse/SR-280.
2016-01-13 18:39:24 -08:00
Jordan Rose
f8bb54f6e6 [Driver] Pass around 'const char *' instead of 'const std::string &'.
No functionality change -- lifetime extension is handled by the
ArgumentList already owned by the Compilation.
2016-01-13 18:39:24 -08:00
Jordan Rose
fe00083eb1 [Driver] Actually write out the source file list file.
This is simply a newline-separated list of files, matching the format
from Darwin ld's -filelist option.

Part 2 of https://bugs.swift.org/browse/SR-280.
2016-01-12 19:20:50 -08:00
Jordan Rose
b45a69ef09 [Driver] Allow passing all source files in a filelist.
Generate frontend commands with -filelist in them. This isn't actually
implemented yet, but we can start testing at this point.

Part 1 of https://bugs.swift.org/browse/SR-280.
2016-01-12 19:20:50 -08:00
Jordan Rose
7be3effeed [Driver] Remove an unused accessor.
No one should be accessing the raw input argument list; it's there merely
to keep the info about the derived argument list alive.
2016-01-12 16:17:27 -08:00
Jordan Rose
7552d49c4a [Driver] Eliminate unused fields from Compilation.
No functionality change.
2016-01-12 16:17:27 -08:00
Jordan Rose
5f78d24e85 [Driver] Make the list of input files available when creating Jobs.
Previously jobs had to grovel this information out of the raw argument
list, which dropped the types we had inferred on input files. This
makes things more consistent across the compiler, though arguably we
should be able to designate "primary" and "non-primary" inputs on a
per-action basis rather than resorting to "global" state.

Use this new information to stop passing object file inputs to the
Swift frontend, fixing rdar://problem/23213785.

The list wouldn't have to live on the Compilation, but I'm going to use
it to fix SR-280 / rdar://problem/23878192 as well.
2016-01-12 11:52:31 -08:00
Jordan Rose
af8eb3766d [Driver] Constify a parameter. No functionality change. 2016-01-12 11:52:31 -08:00
Jordan Rose
dbd0d47568 [Driver] Only JobActions have inputs, not InputActions.
Also, cluster the flags on Action into a single word. This probably doesn't
make any real difference, but it's the convention.

No functionality change.
2016-01-12 11:52:31 -08:00
Jordan Rose
1890de0ca9 [Driver] Collapse duplicated code.
No functionality change.
2016-01-12 11:52:31 -08:00
practicalswift
1339b5403b Consistent use of header comment format.
Correct format:
//===--- Name of file - Description ----------------------------*- Lang -*-===//
2016-01-04 13:26:31 +01:00
practicalswift
f91525a10f Consistent placement of "-*- [language] -*-===//" in header. 2016-01-04 09:46:20 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
practicalswift
8ab8847684 Fix typos. 2015-12-16 22:09:32 +01:00
Jordan Rose
51aee8b3be [Driver] Properly handle new cascading dependencies.
The existing code was only recording a change in the /last/ dependency as needing
to rebuild the file. This could have caused things not to get rebuilt when they
should have.

In practice, a number of things have to coincide for this to cause problems:
- A dependency (let's say a type) has to be considered "modified" in this build.
- Some other file has to get rebuilt that didn't previously depend on the type,
  or only depended on it in a non-cascading way (e.g. it's only used in function
  bodies).
- The file had to not be rebuilt because of any cascading dependencies (or
  because it itself changed).
- The file has to now depend on the type in a cascading way, so that downstream
  files need to be rebuilt when they didn't before.

Noticed by inspection while fixing the previous issue.
2015-12-14 13:24:31 -08:00
Jordan Rose
4698886b54 [Driver] Fix an uninitialized variable.
This only shows up when there's a present-but-empty sequence node in
a swiftdeps file. The compiler never generates this, but it's in some of
the tests. I'm not sure why ASan didn't catch this.

This should fix the failures some people have been seeing with
test/Driver/Dependencies/private-after.swift, rdar://problem/23382722.
2015-12-14 13:24:31 -08:00
Dmitri Gribenko
f28d34845c Merge pull request #439 from hpux735/master
Beginning support for ARMv7 hosts (RasPi, etc.)
2015-12-13 00:10:20 -08:00
William Dillon
4bf81e09da Build working on ARMv7l 2015-12-12 22:06:13 -08:00
Davide Italiano
2e78fdf58f Fix a bunch of pessimizing moves which prevent copy elision. 2015-12-11 19:09:13 +00:00
Dmitri Gribenko
109d8e6402 FreeBSD toolchain: remove code duplication 2015-12-04 22:51:20 -08:00
Landon Fuller
daa97e0079 Adopt suggested 'GenericUnix' toolchain class name. 2015-12-04 17:30:42 -07:00
Landon Fuller
83b706df8a Merge branch 'master' into landonf/freebsd-patchset-1 2015-12-04 17:11:54 -07:00
Dmitri Gribenko
a3c92e1b0d Remove build options for conditionally enabling targets
* We don't have a use-case for this.

* Swift, like Clang, is fundamentally a cross-compiler, and there is no
  known reason to artificially limit it.
2015-12-04 16:04:35 -08:00
Landon Fuller
49ba19f8c3 Fix namespace/#endif tokens lost in merge. 2015-12-04 14:29:03 -07:00
Landon Fuller
0aeef6fec3 Merge branch 'master' into landonf/freebsd-patchset-1 2015-12-04 14:22:28 -07:00
Landon Fuller
d7721781bc Unify the identical Linux/FreeBSD definitions.
When these diverge, we can use the Unix toolchain as
a common baseclass for both.
2015-12-04 14:14:02 -07:00
Jordan Rose
5a54c7ef21 [Driver] Now that we set DYLD_LIBRARY_PATH, stop passing -L to the frontend.
...again, specifically for interpreter jobs. There's no point in the frontend
repeating work that the dynamic linker can do itself.
2015-12-04 12:18:48 -08:00
Jordan Rose
4f9367041f [Driver] Always use the runtime resource library path for DYLD_LIBRARY_PATH.
...when interpreting. Otherwise, the script may depend on library X, which
depends on library Y, where library Y is a standard Swift library, located
in lib/swift/$PLATFORM/.

Finishes rdar://problem/23588774
2015-12-04 12:18:48 -08:00
Jordan Rose
16a647249d [Driver] Actually set extra environment variables in single-command mode.
Implementing this for the general case either requires duplicating the
existing environment, or modifying TaskQueue to support "extra environment"
settings. Since we don't actually have any use cases for this yet, I'm
leaving it unimplemented for now.

Rest of rdar://problem/23588774
2015-12-04 12:18:47 -08:00
Jordan Rose
8021ed0873 [Driver] Set [DY]LD_LIBRARY_PATH when building an interpreter job.
That's DYLD_LIBRARY_PATH on OS X and LD_LIBRARY_PATH on Linux for -L,
and DYLD_FRAMEWORK_PATH on OS X for -F.

Note that this commit doesn't actually include the setenv calls yet, so an
end-to-end test is coming in the next commit.

Part of rdar://problem/23588774
2015-12-04 12:18:47 -08:00
Jordan Rose
528298c12b [Driver] Add the notion of "extra environment variables" to Jobs.
This is groundwork for setting [DY]LD_LIBRARY_PATH ahead of time when
invoking the interpreter, which is rdar://problem/23588774. The next
commit will set up the appropriate variable and use -driver-print-jobs
to test it; the following commit will apply the environment variable
when running a job.
2015-12-04 12:18:46 -08:00
Jordan Rose
13470ae19d [Driver] Replace a std::pair with a struct in Job construction.
No functionality change. Groundwork for setting [DY]LD_LIBRARY_PATH ahead
of time when invoking the interpreter, which is rdar://problem/23588774.
2015-12-04 12:18:46 -08:00