Commit Graph

39 Commits

Author SHA1 Message Date
Evan Wilde
ff92f9e5d3 Modularize signal.h on FreeBSD
This nudges the Glibc modulemap just enough to get SwiftPM and later
targets building. Without it, Swift tries to import the signal hander
APIs through CDispatch instead of Glibc. CDispatch shouldn't be directly
imported, so recommending that is nonsensical.

This is not a full solution for all headers, but meant to perturb the
module machinery sufficiently that it pulls signal.h into glibc
correctly.

Works around:
```
Swift-Project/swiftpm/Sources/Basics/Cancellator.swift:79:24:
error: property '__sigaction_u' is not available due to missing import of defining module 'CDispatch' [#MemberImportVisibility]
```
2025-10-30 16:35:07 -07:00
(null)
cf041b126e address pltaform orders and other nits 2025-06-17 15:37:49 -04:00
Michael Chiu
0c47c45303 Adding FreeBSD support
This commit adds required conditional compilation blocks to enable bulding on
FreeBSD (tested on x86_64 FreeBSD 14.1-RELEASE-p6). Also implements FreeBSD
synchronization shims using `_umtx_op(2)`
2025-03-14 02:15:15 -04:00
Egor Zhdan
5b9186e445 [Glibc] Remove WASI gyb logic from the modulemap
This is a minor cleanup of the generated Glibc modulemap.

WASI no longer uses the Glibc modulemap since 902d75e6.
2024-10-04 01:00:24 +01:00
Egor Zhdan
0c106006db [Glibc] Remove Android gyb logic from the modulemap
This is a minor cleanup of the generated Glibc modulemap.

Android no longer uses the Glibc modulemap since 57b89d53.
2024-10-03 19:37:11 +01:00
Egor Zhdan
78c0540b6f [Glibc] Refer to UUID headers from the modulemap using relative paths
This improves portability of the Swift toolchains by removing a usage of absolute path to Glibc.

The Glibc modulemap is now injected into the Glibc include path using LLVM VFS, so it can reference Glibc headers using relative paths. This already works for other Glibc headers (e.g. `assert.h`)
2022-08-17 15:09:17 +01:00
Egor Zhdan
c314ae0d17 [Glibc] Add missing C stdlib header
`assert.h` is missing from the modulemap, which causes clang to consider `assert.h` to be a part of the first module to include it. This causes issues in SwiftCompilerSources when we try to use classes coming from LLVM headers on Linux.
2022-07-05 16:45:18 +01:00
3405691582
600d500ed6 [stdlib] Use the single-header Glibc modulemap.
This migrates OpenBSD to use the single-header Glibc modulemap proposed
and implemented in #32404, and necessitates introducing some missing
headers for building Foundation added in #38341.

Additionally, incorporate nullability annotations in SwiftShims per
2022-02-11 13:04:12 -05:00
Butta
5eb29d99dd [android] Switch to new single-header modulemap for Bionic too 2021-12-13 23:23:45 +05:30
martinboehme
c5b7e7fb9c Fix two issues with the SwiftGlibc module map (#32404)
* Fix two issues with the SwiftGlibc module map.

The issues are:

- Today, some submodules in `SwiftGlibc` fail to provide definitions that
  they should contain. As a consequence, Swift fails to import some code
  that compiles correctly with standalone Clang. As just one example,
  including `signal.h` should make the type `pid_t` available, but it
  currently does not.

- `SwiftGlibc` is not compatible with the libc++ module map. Trying to
  include libc++ headers in a C++ module imported into Swift results in an
  error message about cyclic dependencies.

This change fixes both of these issues by making it so that `SwiftGlibc`
no actually longer defines a module map for the glibc headers but merely makes
all of the symbols from those headers available in a module that can be
imported into Swift. C / Objective-C / C++ code, on the other hand, will now
include the glibc headers texually.

For more context on the two issues and this fix, see this forum
discussion:

https://forums.swift.org/t/problems-with-swiftglibc-and-proposed-fix/37594

This change only modifies `glibc.modulemap.gyb` for the time being but
leaves `bionic.modulemap.gyb` and `libc-openbsd.modulemap.gyb` unchanged. The
intent is to fix these in the same way, but it will be easier to do this
in separate PRs that can be tested individually.

Co-authored-by: zoecarver <z.zoelec2@gmail.com>
Co-authored-by: Marcel Hlopko <hlopko@google.com>
2021-01-11 14:25:41 +01:00
Max Desiatov
67297904ac [WebAssembly] Add ifdefs for the WASI target 2020-02-08 07:37:10 +00:00
Alexander Shaposhnikov
4a66d9f55f [Glibc] Add missing entry for link.h 2019-07-31 16:35:09 -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
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
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
Gwen Mittertreiner
c79bb5b607 Provide inotify from glibc 2019-04-16 15:54:34 -07:00
Alex Blewitt
0ee1d78beb Add -lm to Glibc.modulemap on Linux
Unlike Darwin, on Linux when using functions from math.h the m library
needs to be added to the compilation. This should be explicit in the
module map, rather than being implicit in the driver.

Fixes SR-9198
2018-11-08 16:53:18 +00:00
Nathan Lanza
e06c52584f Change various uses of SWIFT_SDK_${SDK}_PATH to its architecture specific vairant
Cross-compilation for multiple architectures & sdks require various
variables to be split to specify the arch/adk variant being focused on.
This change modifies various uses of the `SWIFT_SDK_${SDK}_PATH` to
`SWIFT_SDK_${SDK}_ARCH_${ARCH}`
2018-03-30 17:50:59 +00:00
Calvin Hill
aee81d272f Add Initial platform support for Haiku. (#11583) 2017-09-22 21:06:56 -04:00
Guillaume Lessard
7b30d1ef94 add /usr/include/sysexits.h to Glibc module (#11926)
It is part of the Darwin module; this makes things more consistent.
2017-09-17 18:48:10 -04:00
Saleem Abdulrasool
08751a8bb2 stdlib: add sys.user module for Linux
sys/user.h provides definitions for registers.  It would previously get
merged into the sys module which could result in it being multiply
included (as in the case of libdispatch).  Add an explicit submodule.
Noticed when building libdispatch on Linux AArch64.
2017-02-11 14:50:56 -08:00
Joe Groff
808d4d7e51 Merge pull request #4788 from amraboelela/glibc.modulemap.gyb
Added module ifaddrs
2017-01-17 14:36:24 -08:00
swift-ci
294359bd69 Merge pull request #4804 from kstaring/master 2017-01-10 00:01:46 -08:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
K Staring
fb70a1bfad incoorporate @jeremyandrews' suggestion 2016-10-22 12:00:36 +02:00
K Staring
8bda672c70 Merge branch 'master' of https://github.com/apple/swift 2016-10-15 18:36:36 +02:00
Ankit Aggarwal
e7a6ce07ab [GlibcModuleMap] Add sys/file.h to glibc modulemap 2016-10-05 12:35:47 +05:30
K Staring
7edc3100bf fix unbalanced '% if'/'% end', found by gribozavr 2016-09-22 20:28:10 +02:00
K Staring
7c50ccde5e fix cut/paste typo 'CMAKE_SDK != "FreeBSD"' to 'CMAKE_SDK in ["FreeBSD"]' (assuming some time more kqueue-supported platforms will want to support Swift) 2016-09-20 03:53:36 +02:00
K Staring
98a8b58957 add //FIXME for FreeBSD outcommented code, add sys/event.h for kqueue (untested) 2016-09-20 03:46:35 +02:00
K Staring
4dbf4de036 don't try to link "dl" on FreeBSD 2016-09-16 20:49:22 +02:00
Amr Aboelela
dbca4f031a Added module ifaddrs 2016-09-14 17:47:11 -07:00
K Staring
afc95a5e2a disable handy pthread wrappers on FreeBSD since they don't compile
Things like: PthreadBarriers.swift:114:50: error: cannot convert value of type 'UnsafeMutablePointer<pthread_mutex_t>' (aka 'UnsafeMutablePointer<OpaquePointer>') to expected argument type 'UnsafeMutablePointer<pthread_mutex_t?>' (aka 'UnsafeMutablePointer<Optional<OpaquePointer>>')
on barrier.pointee.mutex . I need to do more research to understand this
2016-09-13 11:08:00 +02:00
Paulo Faria
1ed756ec84 Add sendfile to Glibc 2016-08-21 17:43:20 -07:00
Ankit Agarwal
d86e8b7d14 Add pty to Glibc modulemap 2016-08-05 09:07:25 +05:30
Alsey Coleman Miller
ff33f3bb74 Added CUUID to Glibc
Necessary for SR-1756 and SE-0069
2016-06-21 13:48:15 -05:00
practicalswift
8e3ba900b0 [gardening] Fix recently introduced headers. 2016-05-01 12:59:13 +02:00
rintaro ishizaki
458e68900a [Platform] Simplify glibc.modulemap generation
Get rid of cmake configure_file and gyb combination.
2016-04-26 11:59:03 +09:00