Commit Graph

827 Commits

Author SHA1 Message Date
Robert Widmann
b436825948 Trade Usages of -m${platform}-version-min For -target
There's no reason to use -m${platform}-version-min as of clang-11/Xcode 11. Clang is now smart enough to parse -target and provide Apple's ld with the appropriate -platform_version argument string.
2021-01-13 11:00:39 -08:00
John McCall
c346d94655 Fix the build and implementation of the 16-byte atomics for MSVC.
Credit for the cmake fix here goes to Saleem Abdulrasool.

The substantive fix is embarrassing; I didn't pay close attention
to the intrinsic's argument order and just assumed that the first
argument for the replacement value was the low half (the part
you'd find at index 0 if it were an array), but in fact it's the
high half (the part you'd find at index 1).

I also change the code to be much more reinterpret_casty, which
isolates the type-punning mostly "within" the intrinsic, and
which seems to match how other code uses it.
2020-12-04 01:51:29 -05:00
John McCall
ca16548470 Add a swift::atomic<T> which uses a better ABI than MSVC's 128-bit std::atomic. 2020-12-02 18:47:02 -05:00
Michael Gottesman
86b7bac395 Merge pull request #34023 from buttaface/rpath
[linux] remove absolute rpath of /usr/lib/swift/linux added to many shared libraries
2020-10-19 12:02:32 -07:00
Saleem Abdulrasool
563c99bc7c Merge pull request #34160 from buttaface/arm
[android] Add support for building the toolchain for ARMv7
2020-10-04 14:40:44 -07:00
Butta
f7576a7bef [android] Add support for building the toolchain for ARMv7 2020-10-03 18:55:23 +05:30
John McCall
e1004499c4 [NFC] Split ProtocolDispatchStrategy out of MetadataValues.h.
This allows us to avoid rebuilding most of the compiler
whenever we add a new ABI constant.
2020-10-03 02:26:17 -04:00
Butta
69d04aad08 [linux] remove absolute rpath of /usr/lib/swift/linux added to many shared libraries
This was presumably added as a backup, in case the libraries in a toolchain
couldn't be found, but will not work well, so take it out.
2020-09-25 23:07:14 +05:30
Kuba (Brecka) Mracek
d9d929a594 Revert "Start using optimization (-O0/-O2/-O3/-Os) and debug (-g) flags from CMAKE_CXX_FLAGS_${CFLAGS_BUILD_TYPE} (#33388)" (#33924) 2020-09-11 21:06:05 -07:00
Kuba (Brecka) Mracek
28a2826ef4 Start using optimization (-O0/-O2/-O3/-Os) and debug (-g) flags from CMAKE_CXX_FLAGS_${CFLAGS_BUILD_TYPE} (#33388) 2020-08-17 19:26:24 -07:00
Kuba (Brecka) Mracek
f91fe9c0c1 Use SWIFT_SDK_${prefix}_USE_ISYSROOT to select which SDKs should be building with -isysroot (#33469) 2020-08-14 14:33:28 -07:00
Kuba (Brecka) Mracek
ef89b0dc51 Add a 'standalone_minimal' preset to build a minimal, static, OS independent, self-contained binaries of stdlib. (#33286) 2020-08-12 07:28:34 -07:00
Eric Miotto
6fdcfb0ebf [build] remove support for embedding bitcode in host libraries (#32730)
We are more interested in generating bitcode for the standard library.

Addresses rdar://64952135
2020-07-07 13:46:19 -07:00
Eric Miotto
e80b188213 [build] Add LTO flag to link options (#32683)
Following the refactoring in #31612, LTO flag was only added to compile
flags -- we need to pass this only when linking.

Addresses rdar://65037856
2020-07-02 14:44:37 -07:00
Eric Miotto
d285123c0a [build] Pass target to linker for host tools for Apple SDKs (#32618)
As part of this refactor some code touched as part of #31794 to better fit into the work done in #32120 -- in detail

* `_add_host_variant_c_compile_link_flags` is now invoked by both add_swift_host_library and add_swift_host_library
* `_add_host_variant_c_compile_link_flags` now sets the target in linker arguments when building against Apple SDKs

Addresses rdar://64911978
2020-07-01 11:01:14 -07:00
Saleem Abdulrasool
10d15b8bad build: switch gyb to Python3
Change the build system to invoke gyb with python3 instead of python2.
2020-06-19 11:03:31 -07:00
Saleem Abdulrasool
dc1624dee0 build: style updates (NFC)
Adjust the CMakeLists.txt to match the rest of the usage.
2020-06-06 14:00:50 -07:00
Saleem Abdulrasool
f9128bac81 build: use the same pattern for detecting Darwin platforms
The host platform should be using `CMAKE_SYSTEM_NAME STREQUAL Darwin`.
However, we currently drive the host side of the compilation against
custom variables.  This makes the migration simpler by ensuring that the
entire file uses the same pattern.

Since `is_darwin_based_sdk` is now used only in the standard library
build, sink it to the standard library build.
2020-06-04 08:39:59 -07:00
Saleem Abdulrasool
f5a75dcefd build: simplify macOS path (NFC)
It does not make sense to use the `cl` frontend to clang to build for
macOS.  Remove the unnecessary condition and always perform the
operation.
2020-06-01 08:40:03 -07:00
Saleem Abdulrasool
1cc6698ae6 build: remove unnecessary CXX_STANDARD for Windows
The entire project is now at C++14.  Windows had to adopt C++14 earlier
to support processing the Windows SDK headers.  This is no longer
necessary, adopt the global settings instead.
2020-05-30 15:26:02 -07:00
David Zarzycki
3767ece85c [CMake] Simplify two binary variables into one tri-state variable
Also remove some ancient logic to detect and ignore requests to use LLD.
If people want to explicitly use LLD, they probably have a reason and we
shouldn't second guess them.
2020-05-28 06:08:03 -04:00
Saleem Abdulrasool
79bed6c4a7 Merge pull request #31481 from compnerd/not-everything-that-glitters-is-gold
build: default the lld/gold enabling as per reality
2020-05-23 19:42:24 -04:00
Eric Miotto
0c403fe766 [build] Pass target argument to the linker if needed (#31794)
Following #31125 and #31612, `-target` is not added automatically to
linker flags when that's needed (e.g. when building for Apple SDKs) --
mimic the logic used to add it for compiler flags.

Addresses rdar://63138761
2020-05-18 08:14:59 -07:00
Dario Rexin
32a189c281 Merge pull request #31329 from compnerd/host-library-handling
`add_swift_host_library` cleanup
2020-05-12 12:23:38 -07:00
Dario Rexin
a554f088d6 Merge pull request #31612 from compnerd/out-in
build: convert out parameter to target
2020-05-11 21:50:12 -07:00
Saleem Abdulrasool
84a7882419 build: add file dependencies for gyb
Add dependencies on the files for gyb to ensure that updates gyb are
treated as triggers to regenerate the files.  This is suspected to have
caused issues for incremental builds.
2020-05-07 12:33:04 -07:00
Saleem Abdulrasool
f03cd0e9a8 build: convert out parameter to target
Rework `_add_host_variant_c_compile_link_flags` to apply the flags
directly rather than to compute the value and have the caller apply.
2020-05-06 22:03:13 -07:00
Saleem Abdulrasool
d1f798bedb Merge pull request #31548 from compnerd/analytical-methods
build: remove `ANALYZE_CODE_COVERAGE` from `_add_host_variant_c_compi…
2020-05-06 17:18:20 -07:00
Saleem Abdulrasool
58fc3c5920 build: remove explicit link against atomic
This is no longer required after the fix for the over-aligned type for
the atomic type.
2020-05-05 08:50:34 -07:00
Saleem Abdulrasool
d5c2bc20db build: remove ANALYZE_CODE_COVERAGE from _add_host_variant_c_compile_link_flags
This flag does not make sense here as this function is called from
`_add_host_variant_link_flags` and `_add_host_variant_c_compile_flags`.
The latter will add the flags appropriately.  The former is always
invoked *after* `_add_host_variant_c_compile_flags`.  This effectively
was duplicating the flags.
2020-05-04 16:06:29 -07:00
Saleem Abdulrasool
c6cc769a64 build: default the lld/gold enabling as per reality
Rather than defaulting both of these to true, enable gold by default
only on ELFish targets, and enable LLD by default for Windows on
non-Windows hosts.
2020-05-01 13:56:57 -07:00
Saleem Abdulrasool
d6b43e4b6f build: clean up the mac catalyst flag handling in the host
The toolchain does not actually use any catalyst flavor, which resulted
in these paths actually being dead.  Cull them except for the one path
which simply computes the target triple.
2020-05-01 13:19:59 -07:00
Saleem Abdulrasool
cf1f240534 build: cleanup some of the organization in add_swift_host_library
This is just a cleanup of the implementation of
`add_swift_host_library`, reorganizing the flag computation and
application as well as the property setting.
2020-05-01 12:59:44 -07:00
Saleem Abdulrasool
62a4bd67d6 build: inline _add_swift_host_library_single
This function is used at one site and is an internal function.  Host
libraries are always built in a single configuration, just inline it to
avoid unnecessarily reparsing arguments.
2020-05-01 12:59:44 -07:00
Saleem Abdulrasool
e6f2e6257f build: de-GYB_SOURCES the host tools
Use a newly introduced `swift_gyb_target_sources` to gyb and use the
generated sources when building.  Let CMake figure out when to run the
command, let it invoke the command properly, and indicate that the
sources being added to the target are generated.
2020-04-19 10:24:40 -07:00
Saleem Abdulrasool
0bbc160a44 build: strength reduce add_dependencies usage
The two invocations here both had a single parameter passed to it.
Replace it with `add_dependencies` which already actually supports
multiple dependencies specified.  Sink the custom wrapper into the
usage location in `AddSwiftStdlib.cmake`.
2020-04-19 10:24:40 -07:00
Saleem Abdulrasool
8e736584fa build: remove ICU handling in the android host handling
The host tools do not use ICU, only the standard library does.  Remove
the special handling in the host tool path for ICU.  This simplifies the
flag computation and allows the ICU handling to be sunk entirely into
the target specific paths.
2020-04-19 10:24:40 -07:00
Saleem Abdulrasool
123c2b06dc build: convert output variables to target
Convert the out parameters for `_add_host_variant_c_compile_flags` to
use the target as an in-parameter.  Doing so allows us to set the
properties on the target directly rather than providing them as out
parameters which then get set subsequently.
2020-04-19 10:24:40 -07:00
Saleem Abdulrasool
9873280853 build: convert output variables to target
Convert the out parameters for `_add_host_variant_link_flags` to use the
target as an in-parameter.  Doing so allows us to set the properties on
the target directly rather than providing them as out parameters which
then get set subsequently.
2020-04-19 10:24:38 -07:00
Saleem Abdulrasool
2e132050e1 build: CF, CVP, DAE over flag computation
Perform some constant folding, constant value propagation, dead argument
elimination over the flag computation methods.  This reduces the
unnecessary parameters and more clearly and succinctly describes what is
happening.
2020-04-19 10:24:03 -07:00
Saleem Abdulrasool
6de2863468 build: CVP some of the flags handling
Apply constant value propagation to the host flag variant operations.
This reduces the parameters needed for the invocations and enables
further cleaning in the hopes that we can apply these per-target using
CMake instead.
2020-04-19 10:23:21 -07:00
Daniel Rodríguez Troitiño
6f4455812b Merge pull request #30235 from buttaface/rpath
[build][android] set INSTALL_RPATH properly for shared libraries
2020-04-18 15:38:23 -07:00
Saleem Abdulrasool
84d8bc7b43 build: merge _add_swift_host_executable_single into add_swift_host_executable
Merge the single use `_add_swift_host_executable_single` into the
singular site.  The host tools are built in a single variant.  This
avoids the custom logic for adding multiple variants.  Folding this
away will allow further simplifications in order to move towards a
standard CMake build.
2020-04-13 17:24:18 -07:00
Dario Rexin
20b2fec8a9 Merge pull request #30978 from compnerd/variants
build: duplicate and rename the `_add_variant_*` functions
2020-04-13 13:55:47 -07:00
Saleem Abdulrasool
3d1bfdedb6 Merge pull request #30977 from compnerd/unused
build: prune some unused options for `_add_swift_host_executable_single`
2020-04-11 16:05:17 -07:00
Saleem Abdulrasool
87cbb3132d build: duplicate and rename the _add_variant_* functions
This allows us to start splitting up the swift and C/C++ specific paths.
2020-04-11 13:24:31 -07:00
Saleem Abdulrasool
319a9e0cf0 build: prune some unused options for _add_swift_host_executable_single
Remove some unused parameters for this function.  This simplification
will make it easier to merge `_add_swift_host_executable_single` into
`add_swift_host_executable`.
2020-04-11 12:26:30 -07:00
Saleem Abdulrasool
7e2ca19ba8 build: remove Swift search paths for host
Remove the Swift library search path for the host paths which are C/C++
only.
2020-04-11 12:25:34 -07:00
Butta
4bfbfe935f [build][android] set INSTALL_RPATH properly for shared libraries
Host libraries will likely all need ORIGIN set, whereas only set it for
target libraries that will be packaged with a native toolchain on Android.
2020-03-18 10:32:49 +05:30
Eric Miotto
b3e86610fa [build] set linker parameters in a single way (#30339)
After noticing that also in CMake 3.16 the LINKER: prefix is not
expanded correctly when used in `target_link_options`, prefer to set the
linker parameters in a more verbose way and leave a comment behind on
when this behavior was observed in case we want to change the
implementation later.

Follow up to #29636.
Addresses rdar://problem/59732421
2020-03-11 07:41:50 -07:00