Skip to content

Commit e0dd9ae

Browse files
deepak1556targos
authored andcommitted
build: remove explicit linker call to libm on macOS
/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 <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Shelley Vohr <[email protected]>
1 parent 3e207bd commit e0dd9ae

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

deps/brotli/unofficial.gni

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ template("brotli_gn_build") {
2525
} else if (target_os == "freebsd") {
2626
defines = [ "OS_FREEBSD" ]
2727
}
28-
if (!is_win) {
28+
if (is_linux) {
2929
libs = [ "m" ]
3030
}
3131
if (is_clang || !is_win) {

deps/uv/unofficial.gni

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ template("uv_gn_build") {
8787
]
8888
}
8989
if (is_posix) {
90-
libs = [ "m" ]
9190
ldflags = [ "-pthread" ]
9291
}
9392
if (is_linux) {
9493
libs += [
94+
"m",
9595
"dl",
9696
"rt",
9797
]

0 commit comments

Comments
 (0)