-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
build: remove explicit linker call to libm on macOS #56901
Closed
Closed
+11
−6
Conversation
This file contains 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
/usr/lib/libm.tbd is available via libSystem.*.dylib and reexports sanitizer symbols. When building for asan this becomes an issue as the linker will resolve the symbols from the system library rather from libclang_rt.* For V8 that rely on specific version of these symbols that get bundled as part of clang, for ex: https://source.chromium.org/chromium/chromium/src/+/main:v8/src/heap/cppgc/platform.cc;l=93-97 accepting nullptr for shadow_offset in `asan_get_shadow_mapping`, linking to system version that doesn't support this will lead to a crash. Clang driver eventually links with `-lSystem` https://github.com/llvm/llvm-project/blob/e82f93890daefeb38fe2a22ee3db87a89948ec57/clang/lib/Driver/ToolChains/Darwin.cpp#L1628-L1631, this is done after linking the sanitizer libraries which ensures right order of resolution for the symbols.
Review requested:
|
deepak1556
commented
Feb 3, 2025
joyeecheung
approved these changes
Feb 3, 2025
legendecas
approved these changes
Feb 3, 2025
lpinca
approved these changes
Feb 3, 2025
codebytere
approved these changes
Feb 3, 2025
Landed in c0953d9...b7ce941 |
nodejs-github-bot
pushed a commit
that referenced
this pull request
Feb 7, 2025
/usr/lib/libm.tbd is available via libSystem.*.dylib and reexports sanitizer symbols. When building for asan this becomes an issue as the linker will resolve the symbols from the system library rather from libclang_rt.* For V8 that rely on specific version of these symbols that get bundled as part of clang, for ex: https://source.chromium.org/chromium/chromium/src/+/main:v8/src/heap/cppgc/platform.cc;l=93-97 accepting nullptr for shadow_offset in `asan_get_shadow_mapping`, linking to system version that doesn't support this will lead to a crash. Clang driver eventually links with `-lSystem` https://github.com/llvm/llvm-project/blob/e82f93890daefeb38fe2a22ee3db87a89948ec57/clang/lib/Driver/ToolChains/Darwin.cpp#L1628-L1631, this is done after linking the sanitizer libraries which ensures right order of resolution for the symbols. PR-URL: #56901 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
nodejs-github-bot
pushed a commit
that referenced
this pull request
Feb 7, 2025
PR-URL: #56901 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
brotli
Issues and PRs related to the brotli dependency.
commit-queue-rebase
Add this label to allow the Commit Queue to land a PR in several commits.
dependencies
Pull requests that update a dependency file.
libuv
Issues and PRs related to the libuv dependency or the uv binding.
needs-ci
PRs that need a full CI run.
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.
/usr/lib/libm.tbd
is available vialibSystem.*.dylib
and reexports sanitizer symbols. When building for asan or other sanitizers this becomes an issue as the linker will resolve the symbols from the system library rather fromlibclang_rt.*
For V8 that rely on specific version of these symbols that get bundled as part of clang, for ex:
https://source.chromium.org/chromium/chromium/src/+/main:v8/src/heap/cppgc/platform.cc;l=93-97 accepting nullptr for shadow_offset in
asan_get_shadow_mapping
, linking to system version that doesn't support this will lead to a crash.Clang linker driver eventually links with
-lSystem
https://github.com/llvm/llvm-project/blob/e82f93890daefeb38fe2a22ee3db87a89948ec57/clang/lib/Driver/ToolChains/Darwin.cpp#L1628-L1631, this is done after linking the sanitizer libraries which ensures right order of resolution for the symbols.
After:
Fixes #55583