Commit Graph

220 Commits

Author SHA1 Message Date
Saleem Abdulrasool
fa4b7ead4e Merge pull request #30990 from compnerd/shellcore
Platform: add ShellCore to WinSDK modulemap
2020-04-13 08:52:23 -07:00
Saleem Abdulrasool
b9e3109fe8 Platform: add ShellCore to WinSDK modulemap
Add the ShellCore module to the Windows SDK modulemap.
2020-04-12 21:37:41 -07:00
Robert Widmann
22b0526917 Merge pull request #30082 from 3405691582/OpenBSD_Port_Build
Build system recognizes OpenBSD.
2020-04-12 09:30:17 -07:00
Saleem Abdulrasool
600d90dbed Platform: alias math constants on Windows
The non-C/C++ standard defined math constants require
`-Xcc -D_USE_MATH_DEFINES` when using the `ucrt` module.  Instead,
provide them through the wrapper `MSVCRT` module as aliases so that the
user does not need to be aware of this in practice.

Repairs the Windows build of `_Differentiation`.
2020-04-09 19:13:10 -07:00
3405691582
f8d0174b85 Build system recognizes OpenBSD.
Commit for CMake and build scripts to recognize OpenBSD. To keep this
commit relatively short, this just deals with the rather simple and
uncontroversial changes to the build system.

Note that OpenBSD calls "x86_64" as "amd64", Since the Swift stdlib will
be put in a subdirectory named after ARCH, to ensure the standard
library is properly found later, we use the native architecture name for
OpenBSD in the build system rather than trying to deal with the
difference the other way around.
2020-04-03 13:34:17 -04:00
Martin Boehme
3ccecc6819 Remove [extern_c] attribute from WinSDK module.
I've verified that all of the header files in this module already
contain their own `extern "C"` blocks that are activated if compiling as
C++.

The additional [extern_c] attribute causes problems for some headers,
like PathCch.h, that define additional overloads of functions when
compiled as C++. The "global" [extern_c] essentially switches off name
mangling with these overloads, which causes them to conflict with the
functions they are overloading.

See here for more context:
https://github.com/apple/swift/pull/30233#issuecomment-601594221

See here for an example of failures caused by the [extern_c]:
https://ci-external.swift.org/job/swift-PR-windows/869/console

(Search for "PathCch.h".)
2020-03-20 10:45:38 +01:00
Saleem Abdulrasool
559dc2a516 WinSDK: further extend the WinSock module
Add the new `afunix.h` header to the WinSock module which was introduced
in the 10.0.17134 release.
2020-03-09 09:54:59 -07:00
Saleem Abdulrasool
4fcd65a411 WinSDK: extend the WinSock module further
This enables the use of `TransmitFile` more fully by adding the
Microsoft extensions to the WinSock module.
2020-03-08 13:14:24 -07:00
3405691582
73bd558925 [stdlib] Modulemap for libc on OpenBSD.
Provide a separate modulemap for OpenBSD's libc, rather than try to
continue to overload the modulemap for glibc, since glibc has its own
idiosyncracies.
2020-03-03 20:23:32 -05:00
3405691582
5847726f51 Preliminary support for OpenBSD in the stdlib.
These should hopefully all be uncontroversial, minimal changes to deal
with progressing the build to completion on OpenBSD or addressing minor
portability issues. This is not the full set of changes to get a
successful build; other portability issues will be addressed in future
commits.

Most of this is just adding the relevant clauses to the ifdefs, but of
note in this commit:

* StdlibUnittest.swift: the default conditional in _getOSVersion assumes
  an Apple platform, therefore the explicit conditional and the relevant
  enums need filling out. The default conditional should be #error, but
  we'll fix this in a different commit.

* tgmath.swift.gyb: inexplicably, OpenBSD is missing just lgammal_r.
  Tests are updated correspondingly.

* ThreadLocalStorage.h: we use the pthread implementation, so it
  seems we should typedef __swift_thread_key_t as pthread_key_t.
  However, that's also a tweak for another commit.
2020-03-01 12:50:06 -05:00
Daniel Rodríguez Troitiño
073e44d6e8 Merge pull request #29296 from buttaface/droid
[android] Get build scripts working natively, fix tests and install
2020-02-24 21:05:47 -08:00
Max Desiatov
67297904ac [WebAssembly] Add ifdefs for the WASI target 2020-02-08 07:37:10 +00:00
Butta
3f4109b3a2 [android] Get build scripts working natively, fix tests and install
The build scripts assume Android cross-compilation using the NDK, so avoid
that configuration if building on an Android host. Fix or disable some tests,
and don't install a glibc.modulemap without a native sysroot prefix.
2020-02-05 11:36:33 +05:30
Saleem Abdulrasool
4e797662e8 swiftMSVCRT: build with -Xcc -D_USE_MATH_DEFINES
This enables the use of the math defines when building tgmath.swift.
Although not used in the normal branch, this define is necessary to
build the swiftMSVCRT module for TensorFlow which uses the math
constants.
2020-01-07 14:31:55 -08:00
Butta
14cc620016 [android] A few tweaks for native compilation and to get more tests working
Now that CMAKE_HOST_SYSTEM_NAME and CMAKE_SYSTEM_NAME are set by default to
Android in the Termux app, make the needed tweaks. Some tests were adapted
to work natively on Android too, adds sys/cdefs.h to the Bionic modulemap,
and includes the start of native Android platform support in the build-script.
2019-12-07 01:01:59 +05:30
Daniel Rodríguez Troitiño
f77e2835f0 [android] Link against math library for Bionic.
The Bionic modulemap was missing the autolinking information against
libm, so using the module math functions might have hit undefined
symbols (it was happening in TestDecimal in Foundation for me). The line
is present in the Linux glibc.modulemap, but was not there for Android
Bionic modulemap.
2019-08-26 17:32:51 -07:00
Saleem Abdulrasool
ff05ffb8c9 Platform: remove FP80 operations on android
These were accidentally re-enabled on Android when SE-0246 was reverted.
This causes the android x64 builds to break.
2019-08-25 11:50:22 -07:00
Stephen Canon
d80b1d39a3 Backout SE-0246 (#26809)
* Revert "Add availability information to the new Math function protocols (#24187)"

This reverts commit d2f695935f.

* Revert "SE-0246: Protocols and static functions (#23824)"

This reverts commit 57a4553832.

* Expected abi changes.
2019-08-23 16:41:17 -04:00
Alex Langford
61be4d969f [CMake][NFC] Introduce component targets for proper dependency tracking
This commit introduces a CMake target for each component, adds install targets
for them, and switches build-script-impl to use the target `install-components`
for installation. Each of the targets for each component depends on each
of the individual targets and outputs that are associated with the
corresponding swift-component.

This is equivalent to what already exists, because right now install rules are
only generated for components that we want to install. Therefore, this commit
should be an NFC.

This is a resubmission (with modifications) of an earlier change. I originally
committed this but there were problems with some installation rules.
2019-08-22 10:16:50 -07:00
Ben Langmuir
327c666b8a Revert "[CMake][NFC] Introduce component targets for proper dependency tracking" 2019-08-08 16:35:59 -07:00
Alex Langford
50a0e87c69 [CMake][NFC] Introduce component targets for proper dependency tracking
This commit introduces a CMake target for each component, adds install targets
for them, and switches build-script-impl to use the target `install-components`
for installation. Each of the targets for each component depends on each
of the individual targets and outputs that are associated with the
corresponding swift-component.

This is equivalent to what already exists, because right now install rules are
only generated for components that we want to install. Therefore, this commit
should be an NFC.
2019-08-08 11:50:35 -07:00
Alex Langford
184d942ba0 [CMake] add_swift_target_library shouldn't implicitly set INSTALL_IN_TARGET
This makes it more explicit what the install component of a target
library is if you don't see one (and its marked as IS_SDK_OVERLAY).
Explicit in this case makes more sense, as you don't have to rely on
knowledge of how `add_swift_target_library` is implemented to understand
what component is used to install the target.
2019-08-02 13:51:52 -07:00
Alexander Shaposhnikov
4a66d9f55f [Glibc] Add missing entry for link.h 2019-07-31 16:35:09 -07:00
Saleem Abdulrasool
a2ceae970b Platform: fix library link names
This adjusts the library link names so that linking works properly on
case sensitive file systems (e.g. ext4) when cross-linking.
2019-07-16 10:26:42 -07:00
Saleem Abdulrasool
84f9eed9c8 Platform: extend WinSDK further
This extends the WinSDK module definition further to better modularise
the headers.  This should improve the header organisation as well as
setup additional autolink rules.
2019-07-14 13:54:37 -07:00
Saleem Abdulrasool
d3babb3737 Platform: start using autolink on Windows
Be more aggressive about using the autolinking functionality of modules
on Windows.  This makes it easier to use WinSDK in Swift as the link
dependencies are implicitly taken care of.
2019-07-09 22:59:07 -07:00
Puyan Lotfi
6691fda8ec Appending SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS to SWIFT_COMPILE_FLAGS.
There are situations where you want to build against a libc that is out
of tree or that is not the system libc (Or for cross build scenarios).
This is a change for passing the -sdk and include paths for things like
this.
2019-07-01 09:43:47 -07:00
Saleem Abdulrasool
61d60a791a build: fix cross-compilation of android
The two modulemap construction were flipped. This showed up as a build
failure trying to cross-compile from Windows to android.
2019-06-29 10:26:05 -07:00
Saleem Abdulrasool
ee5e11ae0d build: allow configuration of the system header location
Rather than hardcoding the paths to /usr/include, allow the user to set
the path to their libc headers.  This is particularly important for
environments which may not use the traditional layout (e.g. exherbo) or
for builds which wish to build against an out-of-tree, non-system
installed libc for a Unix target which does not match the host system
(i.e. foreign cross-compilation).
2019-06-27 19:13:52 -07:00
Vlad Gorlov
6370681656 Android cross-compile on macOS: Fix for compile error addressed Float80 data type. (#25502)
* Fixes issue addressed Float80 data type. Float80 is disabled for Intel architectures (i.e. Android Simulator).

* More precise condition check.
2019-06-17 13:40:44 -04:00
Saleem Abdulrasool
1db3865d90 build: dereference the SDK name variable
This is needed to ensure that we get the correct modulemap file for
Android on certain versions of CMake.
2019-06-16 16:49:06 -07:00
Vlad Gorloff
28d1fb65b7 Android Mac Cross-compile: Fixes issue "ld.gold: error: cannot find -lutil". 2019-06-13 23:57:18 +02:00
Ben Cohen
e9d4687e31 De-underscore @frozen, apply it to structs (#24185)
* De-underscore @frozen for enums

* Add @frozen for structs, deprecate @_fixed_layout for them

* Switch usage from _fixed_layout to frozen
2019-05-30 17:55:37 -07:00
Daniel Rodríguez Troitiño
770bba91bd [android] Fix Bionic modulemap file syntax.
A line was forgotten in the rewrite which break the Android builds.
2019-05-29 11:04:42 -07:00
Saleem Abdulrasool
d48220dd62 Platform: attempt to split out the bionic modulemap
This splits out the bionic modulemap from the glibc modulemap.  They are
sufficiently different that the duplication is worth it.  Furthermore,
it will enable properly identifying the libc on android.  Once fully
detangled, this will enable the use of bionic on non-android platforms.
2019-05-27 12:34:27 -07:00
Alsey Coleman Miller
1f15c87f35 Added missing Linux POSIX errors 2019-05-15 14:03:11 -05:00
Ted Kremenek
4beb673b8e Bump compiler version to Swift 5.1 (#24671)
* Bump version to Swift 5.1

* Update tests with compiler version bump

* Undo flatMap and math obsolescences
2019-05-13 07:32:39 -07:00
Daniel Rodríguez Troitiño
562b79dcf7 [android] Remove uuid.h from Android's Glibc.
Android doesn't ship with uuid.h, so having a module pointing to that
header is an error.
2019-05-06 17:31:45 -07:00
Ross Bayer
c10b815ba4 [Build System: CMake] Install the apinotes in the 'compiler' install component when compiling for Darwin platforms.
Setting the CMake cache variable SWIFT_INCLUDE_APINOTES to true will override the default behavior and unconditionally create the install targets.
2019-05-02 18:42:37 -07:00
Saleem Abdulrasool
2e7c328077 Merge pull request #24168 from xiaobai/sink_component_arg
[CMake] Modify swift_install_in_component to support cmake install components
2019-04-30 21:06:32 -07:00
Daniel Rodríguez Troitiño
73fd7d6551 [android] Add missing POSIX/Linux headers to Android build.
Reviewed the cases of Glibc where branching occurred and checked the
skipped headers against the Android NDK sysroot, and added the Android
check in the right places. This will give access to a lot more
functions from libc.
2019-04-25 13:46:40 -07:00
Saleem Abdulrasool
5d2be1acc7 Windows: expose ConsoleAPI
This exposes the Windows 10 ConsoleAPI from the module.
2019-04-20 17:02:09 -07:00
Alex Langford
3d9a28925b [CMake] Modify swift_install_in_component to support cmake install components
CMake supports the notion of installation components. Right now we have some
custom code for supporting swift components. I think that for installation
purposes, it would be nice to use the CMake component system.

This should be a non-functional change. We should still only be generating
install rules for targets and files in components we want to install, and we
still use the install ninja target to install everything.
2019-04-19 14:06:11 -07:00
Saleem Abdulrasool
9f96244855 Merge pull request #24074 from gmittert/LetMeKnow
Provide inotify from glibc
2019-04-19 13:00:21 -07:00
Stephen Canon
57a4553832 SE-0246: Protocols and static functions (#23824)
This implements the protocols and static functions proposed in SE-0246, plus some initial test coverage. It also has some rough accompanying cleanup of tgmath. It does not include the globals (on scalars or SIMD types) nor does it deprecate much in tgmath.h.
2019-04-17 23:57:33 +02:00
Gwen Mittertreiner
c79bb5b607 Provide inotify from glibc 2019-04-16 15:54:34 -07:00
Alsey Coleman Miller
32fb4980e8 Compile POSIXError.swift for Windows 2019-04-16 02:06:45 -05:00
Alsey Coleman Miller
371b7ca764 Added POSIXErrorCode for Windows
https://docs.microsoft.com/en-us/cpp/c-runtime-library/errno-doserrno-sy
s-errlist-and-sys-nerr
2019-04-16 01:59:04 -05:00
Saleem Abdulrasool
b6ca2fb786 Merge pull request #24028 from colemancda/posixErrorGlibc
[stdlib] Include POSIXError as part of Glibc
2019-04-15 17:05:12 -07:00
David Smith
7db8cb1ea3 SR-10294: convertBoolToDarwinBool and friends should be inlined 2019-04-15 09:00:29 -07:00