Repository navigation
build: a darwin sysroot stub names only what macOS exports (#2530) - #2775
Merged
Merged
Conversation
The declared libraries' .tbd stubs named every API a header declares, but Apple builds some of it out: libsqlite3's stub named 9 symbols /usr/lib/libsqlite3.dylib does not export (sqlite3_load_extension and sqlite3_enable_load_extension under SQLITE_OMIT_LOAD_EXTENSION, sqlite3_unlock_notify, the win32 entry points), libz 14, libxml2 40, libiconv 1. A call of one linked against the stub and crashed at run time: the probe calling sqlite3_enable_load_extension built and exited 139 at the call (lazy bind of a missing symbol). Against Apple's SDK the same program fails at link. Root cause: sdk_darwin_declared_libraries built each stub from the header's API macros alone (sdk_header_api_symbols); nothing compared it with what the OS exports. - build/darwin_exports/<lib>.txt records each library's exports, read from /usr/lib with dyld_info by tools/darwin_exports.w (macOS 26.6.2 named in each file). The sysroot build reads only these committed lists, never the host. - Each stub is the header's declarations that the list exports (sdk_declared_and_exported). The lists are darwin-sysroot inputs. - tools/darwin_exports.w --check compares a built sysroot's stubs with the host's dylibs. It needs dyld_info, an xcrun shim (Command Line Tools), so it is a maintainer check beside the rewrite, not a gate target (#1915: the build reads nothing of the host). Evidence: --check before: 64 stub symbols not exported; after: every stub symbol exported (sqlite3 284 -> 275, libz 93 -> 79, libxml2 1718 -> 1678, libiconv 12 -> 11). The probe now fails at link ("ld64.lld: error: undefined symbol: _sqlite3_enable_load_extension"); examples/c-interop runs green without SDKROOT on stage1. test/compile_errors/err_2530_stub_names_only_exported.w failed on the installed compiler (the build succeeded) and passes on stage1.
Contributor
Author
|
Seed-driven battery GREEN on the stack top 6cba97b ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
build: a darwin sysroot stub names only what macOS exports (#2530)
The declared libraries' .tbd stubs named every API a header declares,
but Apple builds some of it out: libsqlite3's stub named 9 symbols
/usr/lib/libsqlite3.dylib does not export (sqlite3_load_extension and
sqlite3_enable_load_extension under SQLITE_OMIT_LOAD_EXTENSION,
sqlite3_unlock_notify, the win32 entry points), libz 14, libxml2 40,
libiconv 1. A call of one linked against the stub and crashed at run
time: the probe calling sqlite3_enable_load_extension built and exited
139 at the call (lazy bind of a missing symbol). Against Apple's SDK
the same program fails at link.
Root cause: sdk_darwin_declared_libraries built each stub from the
header's API macros alone (sdk_header_api_symbols); nothing compared
it with what the OS exports.
from /usr/lib with dyld_info by tools/darwin_exports.w (macOS 26.6.2
named in each file). The sysroot build reads only these committed
lists, never the host.
(sdk_declared_and_exported). The lists are darwin-sysroot inputs.
the host's dylibs. It needs dyld_info, an xcrun shim (Command Line
Tools), so it is a maintainer check beside the rewrite, not a gate
target (Zero dependencies on every platform: the SDK carries link stubs, CRT, builtins, libc++ and headers (no Xcode/CLT, no MSVC/Windows SDK, no system glibc/libgcc) #1915: the build reads nothing of the host).
Evidence: --check before: 64 stub symbols not exported; after: every
stub symbol exported (sqlite3 284 -> 275, libz 93 -> 79, libxml2
1718 -> 1678, libiconv 12 -> 11). The probe now fails at link
("ld64.lld: error: undefined symbol: _sqlite3_enable_load_extension");
examples/c-interop runs green without SDKROOT on stage1.
test/compile_errors/err_2530_stub_names_only_exported.w failed on the
installed compiler (the build succeeded) and passes on stage1.