Skip to content

Platform: Update module maps for the static SDK #81826

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

Merged
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
74 changes: 52 additions & 22 deletions stdlib/public/Platform/ucrt.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,25 @@

// The following modules have to be standalone top-level modules to deal with
// version 10.0.26100 of the Windows SDK.
module _malloc [system] [no_undeclared_includes] {
use corecrt
header "malloc.h"
export *
}

module _complex [system] [no_undeclared_includes] {
use corecrt
use std
header "complex.h"
export *
}

module _stddef [system] [no_undeclared_includes] {
header "stddef.h"
export *
}

module _stdlib [system] [no_undeclared_includes] {
use corecrt
header "stdlib.h"
export *
}

module ucrt [system] {
export _malloc

module C {
export _complex
export _stddef
export _stdlib

module ctype {
header "ctype.h"
export *
}

module errno {
header "errno.h"
textual header "errno.h"
export *
}

Expand All @@ -74,6 +54,11 @@ module ucrt [system] {
export *
}

module malloc {
header "malloc.h"
export *
}

module math {
header "math.h"
export *
Expand All @@ -84,6 +69,16 @@ module ucrt [system] {
export *
}

module stdalign {
header "stdalign.h"
export *
}

module stddef {
textual header "stddef.h"
export *
}

module stdio {
header "stdio.h"
export *
Expand All @@ -101,6 +96,11 @@ module ucrt [system] {
export *
}

module stdnoreturn {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this textual?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The textual annotation prevents the header from being compiled when the header is built. It is instead textually included on demand. It must still parse properly, mind you.
IIUC, for our use case, what this means is that its symbols are not directly included in the compiled stdnoreturn module but they will still be present in the ucrt module since this header is included by other headers in the module - this also applies to other textual headers defined here.
This is a hackier solution than I would like but it works for all of the Windows 10 SDK versions that I have tried.

complex.h is still being a pain because it includes ccomplex if you build it in C++ mode and also disables some symbols, which is just wrong IMO.

For the rest, we can rely on Swift tests. It has been my experience that they are rather extensive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I understand the behaviour of the textual heaader. I am wondering what is the cycle that this is trying to break. It seems that there are two cycles present:

  1. stddef.h
  2. stdnoreturn.h

TBH, making these two textual to make things work as a workaround is fine. This is still a better state than we were in previously.

textual header "stdnoreturn.h"
export *
}

module string {
header "string.h"
export *
Expand Down Expand Up @@ -187,8 +187,14 @@ module corecrt [system] {
export *
}

module direct {
header "corecrt_wdirect.h"
export *
}

module io {
header "corecrt_io.h"
header "corecrt_wio.h"
export *
}

Expand All @@ -202,11 +208,36 @@ module corecrt [system] {
export *
}

module memory {
header "corecrt_memory.h"
export *
}

module memcpy {
header "corecrt_memcpy_s.h"
export *
}

module process {
header "corecrt_wprocess.h"
export *
}

module search {
header "corecrt_search.h"
export *
}

module share {
header "corecrt_share.h"
export *
}

module ctype {
header "corecrt_wctype.h"
export *
}

module stdio {
header "corecrt_wstdio.h"
export *
Expand All @@ -227,4 +258,3 @@ module corecrt [system] {
export *
}
}

30 changes: 30 additions & 0 deletions stdlib/public/Platform/vcruntime.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,45 @@ module vcruntime [system] {

header "vcruntime.h"

module iso646 {
header "iso646.h"
export *
}

module limits {
header "limits.h"
export *
}

module setjmp {
header "setjmp.h"
export *
}

module stdarg {
header "stdarg.h"
export *
}

module stdbool {
header "stdbool.h"
export *
}

module stdint {
header "stdint.h"
export *
}

module string {
header "vcruntime_string.h"
export *
}

module vadefs {
header "vadefs.h"
export *
}
}

module std_config [system] {
Expand Down