Commit Graph

588 Commits

Author SHA1 Message Date
swift-ci
0302515cf0 Merge remote-tracking branch 'origin/master' into master-next 2017-12-18 12:48:55 -08:00
Saleem Abdulrasool
33ada8e801 build: use C++14 for Windows builds
The Windows SDK headers require C++14 or newer features.  Visual Studio
is lax in enabling these features unlike clang.  Explicitly upgrade to
the higher standard for the Windows cross-compilation.
2017-12-12 16:27:26 -08:00
swift-ci
1270d9d356 Merge remote-tracking branch 'origin/master' into master-next 2017-12-09 14:49:49 -08:00
Saleem Abdulrasool
899103cfa8 COFF: restructure metadata registration
Restructure the COFF metadata handling to use the linker section
grouping to emit section start/stop markers in the appropriate location.
This allows us to lookup the sections statically without having to the
walk the entire image structure.

Introduce a constructor for PE/COFF binaries.  This will ensure that the
registration occurs for all modules appropriately.  This should resolve
rdar://problem/19045112.  The registration should occur prior to
`DllMain` being invoked from `DllMainCRTStartup`.
2017-12-08 16:15:07 -08:00
Bob Wilson
390058972a [master-next] Use PRIVATE in target_link_libraries for executables
This is needed to work with LLVM r319840.
2017-12-06 21:55:22 -08:00
Saleem Abdulrasool
d48686ff0d build: effectively revert 986beb7522
This change broke the Windows builds for all the variants.  `-z defs` cannot be
used on all targets, particularly in environments where the stdlib is being
compiled for a foreign host.  This needs to be handled more carefully as I
mentioned on the PR itself.  In the mean time, revert it to get Windows building
again.
2017-12-01 13:34:30 -08:00
Saleem Abdulrasool
bb762f62f3 build: use older means of getting the swiftrt object
This seems to be failing for some reason.  Fallback to the older way to
get the path to the object.  This should repair the build.
2017-11-30 12:25:49 -08: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 Zarzycki
986beb7522 [CMake] Localize a build hack
The '-Wl,-z,defs' flag is useful, so let's disable it only where needed.
2017-11-13 07:40:54 -05:00
Aaron Dierking
28984778bb build: additional section_magic conditional fix
The variable for the TARGET_LIBRARY option should be
SWIFTLIB_SINGLE_TARGET_LIBRARY.
2017-11-07 12:25:37 -08:00
Saleem Abdulrasool
3c402715e4 build: tweak the conditional for section_magic
This adjusts the conditional to ensure that the section_magic dependency
is only added on target libraries not host libraries (e.g.
SwiftDemangle).
2017-11-07 12:19:38 -08:00
Lance Parker
414614cf88 Revert "Revert "[stdlib]Enable Swift 4 mode for the overlays (#12608)"" (#12751)
This reverts commit bcf5d66c8e.
2017-11-06 14:03:48 -08:00
Saleem Abdulrasool
5e4cd22e41 build: use VFS overlay for Windows SDK
The Windows SDK provides headers which have incorrect cases.  The
incorrect cases are in the SDK headers as well.  On case sensitive file
systems this causes build issues due to the incorrect name.  Use the
clang VFS overlay to avoid the need for providing copies to the expected
cases.  This improves the cross-compilation on Linux to Windows.
2017-11-03 12:50:47 -07:00
Saleem Abdulrasool
7e888d43cd SwiftDemangle: build on non-Darwin targets
This can be useful as a consumer for demangling swift symbols.  Build
the shared library on non-Darwin targets as well.
2017-11-01 13:39:37 -07:00
Anton
18da29d8ca [FreeBSD] Fix undefined references to __atomic* 2017-10-26 18:26:09 -07:00
Roman Levenstein
5047e1b475 Enable the serialization of sil_vtables by default and completely remove the -sil-serialize-vtables option
Only sil_vtables of public classes with fixed layout are serialized.
2017-10-21 11:36:12 -07:00
Roman Levenstein
48d9b99675 Remove -sil-serialize-witness-tables flag completely
The functionality is always enabled now and there is no need to have a dedicated flag for it.
2017-10-20 19:45:29 -07:00
Saleem Abdulrasool
a6323fd362 build: swap include order
Visual Studio places shared above um.  Follow their ordering.
2017-10-16 16:32:51 -07:00
Saleem Abdulrasool
2f9f585b57 build: special case Windows ARM target
Windows ARM NT (the modern, non-Windows CE environment) is a pure thumb2
environment.  The frontend does not canonicalise the target like in
clang.  Ensure that we map the triple by hand to the desired target
triple.
2017-10-15 12:10:58 -07:00
Erik Eckstein
45a2ae48ce benchmarks: replace the Ounchecked build with an Osize build
We don't measure Ounchecked anymore. On the other hand we want to benchmark the Osize build.
2017-10-06 14:09:43 -07:00
Roman Levenstein
9134153bd3 Stop using -sil-serialize-all when building the standard library
We can finally get rid of -sil-serialize-all when building the standard library! This option will be completely eliminated in the future commits.

Instead of serializing just everything as we did before, we now serialize only functions annotated with @_inlineable. This way we can selectively control what needs to be available to the clients. This is an important step towards building a resilient standard library.

While this is a huge change for the serialization of the stdlib, it should be virtually invisible to the clients. For example, there are no noticeable performance regressions on any of the benchmarks.
2017-10-02 14:34:14 -07:00
Michael Gottesman
48f4a276ba [benchmark] Only add -external suffix to targets in standalone builds where SWIFT_BENCHMARK_SUBCMAKE_BUILD is set.
This enables us to distinguish in between builds which are triggered by a
subcmake call from the main swift cmake file and one from a user who is trying
to compile the swift benchmark suite against a misc swift installation/use the
ninja file by hand.
2017-10-01 10:41:48 -07:00
Saleem Abdulrasool
15141bc217 build: quote library search path options
When passing the linker search path options to the driver, ensure that
we quote the argument.  We would previously incorrectly split the
arguments that were passed to the driver if there were spaces.  This
would manifest as link failures on Linux when cross-compiling to
Windows.
2017-09-27 19:08:42 -07:00
Saleem Abdulrasool
699bacae37 build: allow compilation for Windows ARM
The Windows ARM SDK is incomplete.  However, the headers are complete
enough to support building the runtime.  Add the necessary definitions
to permit the stdlib to be built.
2017-09-26 17:32:51 -07:00
Saleem Abdulrasool
87250c24e5 Merge pull request #12055 from compnerd/xwindows
build: improve the Windows build infrastructure
2017-09-26 16:26:30 -07:00
Michael Gottesman
c2d8cc7ff0 [benchmark] Add support for building out of tree via build-script against the just built swift.
I recently broke the out of tree build by mistake [its fixed now ; )]. This
inspired me to make it easy to test this behavior by adding support to
build-script/cmake/etc for running an external benchmark build via
AddExternalProjects.

Now I can just call build-script with --build-external-benchmarks and thats it!
It should just work! It already helped me to avoid breaking the external build
twice!

I hope that eventually we get this on a bot to make sure it keeps working [or
even added to the smoke tests ; )].

*NOTE* This is disabled by default so it will not affect normal builds.

*NOTE* This just builds the external benchmarks. There is an rpath issue that
prevents you from running them (the benchmarks have the rpath set as if they are
next to the stdlib, but they are not. This can be fixed in a few different ways,
but I do not have time to finish implementing it = (. But this commit is a good
first step and at least detects build errors.
2017-09-25 12:31:39 -07:00
Saleem Abdulrasool
27d051a6c3 build: improve the Windows build infrastructure
Rather than use the `INCLUDE` and `LIB` environment variables to build
the Windows code, use the `UniversalCRTSdkDir`, `UCRTVersion`, and
`VCToolsInstallDir` variables.  Using these we can compute the right set
of include directories and library search paths for the various
architectures.  This will enable us to build multiple variants of the
Windows stdlib at the same time.

Additionally, rather than relying on the magic environment variables to
be processed by the driver, pass them explicitly to the driver through
the build system.  This also is needed to allow parallel builds of
various architecture variants of the stdlib on Windows.
2017-09-23 16:08:42 -07:00
Calvin Hill
aee81d272f Add Initial platform support for Haiku. (#11583) 2017-09-22 21:06:56 -04:00
swift-ci
afe5c6b910 Merge pull request #12066 from compnerd/offsetof 2017-09-22 15:50:15 -07:00
Saleem Abdulrasool
3aea816d7c build: use more portable offsetof
When building for Windows, when using `offsetof` in a C++ context, we
would use a `reinterpret_cast`, which is not permissible in the context
of a `constexpr` statement which we do use.  Use a CRT specific macro to
use the `__builtin_offsetof` version of the implementation.  Repairs the
Windows stdlib build with the new include path handling.
2017-09-22 13:08:49 -07:00
Saleem Abdulrasool
b25894b4a4 build: add additional case of special handling for exherbo
The file system layout on exherbo is different from most other Linux
distributions.  Add an additional ignored case for the include paths for
when cross-compiling the stdlib to additional targets.
2017-09-21 23:09:26 -07:00
Brian Gesiak
1c5c75bec3 [CMake] Remove Xcode effective platform name check
The CMake function `get_effective_platform_for_triple` appears to only
be used in one location: from within `escape_path_for_xcode`.
The `get_effective_platform_for_triple` function's only purpose appears to be
to check whether `SWIFT_HOST_TRIPLE` contains the string "macos", and if not,
it emits an error.

However, because on macOS hosts the build-script-impl is responsible
for setting the `SWIFT_HOST_TRIPLE` variable, when `cmake -G Xcode` is invoked
directly to configure the Swift project, this variable is unset, and so
`get_effective_platform_for_triple` emits an error.

I considered two solutions:

1. Have `swift/CMakeLists.txt` set a default `SWIFT_HOST_TRIPLE`, as it
   does for Linux. This would prevent `get_effective_platform_for_triple`
   from emitting an error.
2. Remove `get_effective_platform_for_triple` altogether.

I chose (2) here. `get_effective_platform_for_triple` doesn't appear to
do anything besides restrict the host platform arbitrarily. If users
are somehow able to configure the project using `cmake -G Xcode` on
Linux, shouldn't the Swift's CMake allow them to do so?

Test plan:
1. Configure and build using Xcode and an in-tree Swift checkout.
2. Configure and build using `utils/build-script --xcode`.
2017-08-30 00:11:12 -04:00
George Karpenkov
020801beb4 Update -sanitize=fuzzer option to take into account new libFuzzer location. (#11595) 2017-08-28 17:16:55 -07:00
Michael Ilseman
85c2a886e6 Merge pull request #11546 from amraboelela/android-icu-swift
Android: adding swift suffix to icu generated libs to resolve conflict
2017-08-22 14:10:06 -07:00
Mishal Shah
df070b858f Update swift master to build with Xcode 9 beta 6, macOS 10.13, iOS 11, tvOS 11, and watchOS 4 SDKs. 2017-08-22 11:52:50 -07:00
Amr Aboelela
4bf6f5475d Android: adding swift suffix to icu generated libs to resolve conflict with Android's icu libs 2017-08-21 16:17:17 -07:00
Harlan
ade67ca899 [Syntax] Swift libSyntax API (#11320)
* Create Swift libSyntax API

This patch is an initial implementation of the Swift libSyntax API. It
aims to provide all features of the C++ API but exposed to Swift.

It currently resides in SwiftExperimental and will likely exist in a
molten state for a while.

* Only build SwiftSyntax on macOS
2017-08-14 16:47:48 -07:00
George Karpenkov
efe143c2f4 Adding support for -sanitize=fuzzer flag (#11381)
Similarly to Clang, the flag enables coverage instrumentation, and links
`libLLVMFuzzer.a` to the produced binary.
Additionally, this change affects the driver logic, and enables the
concurrent usage of multiple sanitizers.
2017-08-07 18:16:51 -07:00
swift-ci
d189132667 Merge remote-tracking branch 'origin/master' into master-next 2017-08-01 09:28:54 -07:00
David Zarzycki
dc1d0943b2 [CMake] Infer -Werror=switch via asserts being enabled (#11098)
LLVM-style projects like Swift make heavy use of switch statements and
therefore -Werror=switch is very useful during feature development. That
being said, if asserts are disabled, then you're probably not actively
hacking on the project and -Werror (or warnings in general) aren't
helpful.
2017-08-01 09:23:25 -07:00
swift-ci
5afdf423fb Merge remote-tracking branch 'origin/master' into master-next 2017-07-28 13:28:58 -07:00
Mishal Shah
64a77ca716 Update master to build with Xcode 9 beta 4, macOS 10.13, iOS 11, tvOS 11, and watchOS 4 SDKs. 2017-07-28 11:17:59 -07:00
Chris Bieneman
9c35042ae6 Merge remote-tracking branch 'origin/master' into master-next 2017-07-28 09:51:36 -07:00
Chris B
762841ffa8 Merge pull request #11177 from llvm-beanz/swift-cmake-cross-compile
Support CMake's built-in cross compilation mechanisms, and LLVM's native tools configuration.
2017-07-26 15:44:59 -07:00
swift-ci
0ce8483aa6 Merge remote-tracking branch 'origin/master' into master-next 2017-07-25 18:48:50 -07:00
Harlan
a5098e6b69 Generate libSyntax API (#10926)
* Generate libSyntax API

This patch removes the hand-rolled libSyntax API and replaces it with an
API that's entirely automatically generated. This means the API is
guaranteed to be internally stylistically and functionally consistent.
2017-07-25 18:19:58 -07:00
Chris Bieneman
93717c663c Rename SWIFT_TABLEGEN to LLVM_TABLEGEN
Swift doesn't produce its own tablegen and by faking out the LLVM CMake infrastructure into thinking it does all of LLVM's build cross compilation support breaks.
2017-07-25 14:14:56 -07:00
swift-ci
0de4d6fa79 Merge remote-tracking branch 'origin/master' into master-next 2017-07-17 14:28:56 -07:00
Arnold Schwaighofer
f2c8c2a256 Cleanup dead configuration code for copy-on-write existentials
Copy-on-write existentials are enabled and none of these flags are used
2017-07-17 12:22:03 -07:00
swift-ci
5d753e1f3b Merge remote-tracking branch 'origin/master' into master-next 2017-06-28 19:48:39 -07:00