Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stdlib] Use the single-header Glibc modulemap. #40557

Merged
merged 1 commit into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions stdlib/public/Platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,7 @@ foreach(sdk ${SWIFT_SDKS})
set(module_dir "${SWIFTLIB_DIR}/${arch_subdir}")
set(module_dir_static "${SWIFTSTATICLIB_DIR}/${arch_subdir}")

if(${sdk} STREQUAL OPENBSD)
set(glibc_modulemap_source "libc-openbsd.modulemap.gyb")
else()
set(glibc_modulemap_source "glibc.modulemap.gyb")
endif()
set(glibc_modulemap_source "glibc.modulemap.gyb")
set(glibc_modulemap_out "${module_dir}/glibc.modulemap")
set(glibc_modulemap_out_static "${module_dir_static}/glibc.modulemap")

Expand Down
2 changes: 2 additions & 0 deletions stdlib/public/Platform/SwiftGlibc.h.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ headers = [
'string.h',
'tgmath.h',
'time.h',
'util.h',
'utmp.h',

# POSIX
Expand Down Expand Up @@ -69,6 +70,7 @@ headers = [
'sys/ioctl.h',
'sys/ipc.h',
'sys/mman.h',
'sys/mount.h',
'sys/msg.h',
'sys/resource.h',
'sys/select.h',
Expand Down
8 changes: 5 additions & 3 deletions stdlib/public/Platform/glibc.modulemap.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@
/// It's not named just Glibc so that it doesn't conflict in the event of a
/// future official glibc modulemap.
module SwiftGlibc [system] {
% if CMAKE_SDK in ["LINUX", "ANDROID"]:
% if CMAKE_SDK in ["LINUX", "ANDROID", "OPENBSD"]:
link "m"
% end
% if CMAKE_SDK in ["LINUX", "FREEBSD", "CYGWIN"]:
% if CMAKE_SDK in ["LINUX", "FREEBSD", "OPENBSD", "CYGWIN"]:
link "pthread"
// FIXME: util contains rarely used functions and not usually needed. Unfortunately
// link directive doesn't work in the submodule yet.
% if CMAKE_SDK != "OPENBSD":
link "util"
% end
% end

% if CMAKE_SDK != "FREEBSD" and CMAKE_SDK != "HAIKU":
% if CMAKE_SDK not in ["FREEBSD", "OPENBSD", "HAIKU"]:
link "dl"
% end

Expand Down
327 changes: 0 additions & 327 deletions stdlib/public/Platform/libc-openbsd.modulemap.gyb

This file was deleted.

2 changes: 1 addition & 1 deletion stdlib/public/SwiftShims/LibcShims.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static inline __swift_size_t _swift_stdlib_strlen_unsigned(const unsigned char *
SWIFT_READONLY
static inline int _swift_stdlib_memcmp(const void *s1, const void *s2,
__swift_size_t n) {
#if defined(__APPLE__) || defined(__ANDROID__)
#if defined(__APPLE__) || defined(__ANDROID__) || defined(__OpenBSD__)
extern int memcmp(const void * _Nullable, const void * _Nullable, __swift_size_t);
#else
extern int memcmp(const void *, const void *, __swift_size_t);
Expand Down