Skip to content

Commit ecc6ba8

Browse files
authored
Always add sanitizer flags when linking (#912)
There were errors in building LLVM without this
1 parent dbe78cb commit ecc6ba8

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

triplets/arm64-osx-asan.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ set(VCPKG_LIBRARY_LINKAGE static)
55
# ASAN
66
# Make sure this value matches up with https://llvm.org/docs/CMake.html "LLVM_USE_SANITIZER"
77
set(VCPKG_USE_SANITIZER "Address")
8+
89
# If the following flags cause errors during build, you might need to manually
910
# ignore the PORT and check VCPKG_USE_SANITIZER
1011
if(NOT PORT MATCHES "^((llvm)|(llvm-[0-9]+)|(upb))$")
1112
set(VCPKG_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections")
1213
set(VCPKG_C_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections")
13-
set(VCPKG_LINKER_FLAGS "-fsanitize=address")
1414
endif()
1515

16+
# Always apply sanitizer to linker flags
17+
set(VCPKG_LINKER_FLAGS "-fsanitize=address")
18+
1619
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
1720
set(VCPKG_OSX_ARCHITECTURES arm64)

triplets/x64-linux-rel-asan.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ set(VCPKG_LIBRARY_LINKAGE static)
55
# ASAN
66
# Make sure this value matches up with https://llvm.org/docs/CMake.html "LLVM_USE_SANITIZER"
77
set(VCPKG_USE_SANITIZER "Address")
8+
89
# If the following flags cause errors during build, you might need to manually
910
# ignore the PORT and check VCPKG_USE_SANITIZER
1011
if(NOT PORT MATCHES "^((llvm)|(llvm-[0-9]+)|(upb))$")
1112
set(VCPKG_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections")
1213
set(VCPKG_C_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections")
13-
set(VCPKG_LINKER_FLAGS "-fsanitize=address")
1414
endif()
1515

16+
# Always apply sanitizer to linker flags
17+
set(VCPKG_LINKER_FLAGS "-fsanitize=address")
18+
1619
# Only release builds
1720
set(VCPKG_BUILD_TYPE release)
1821

triplets/x64-osx-rel-asan.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ set(VCPKG_USE_SANITIZER "Address")
1212
if(NOT PORT MATCHES "^((llvm)|(llvm-[0-9]+)|(upb))$")
1313
set(VCPKG_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections")
1414
set(VCPKG_C_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections")
15-
set(VCPKG_LINKER_FLAGS "-fsanitize=address")
1615
endif()
1716

17+
# Always apply sanitizer to linker flags
18+
set(VCPKG_LINKER_FLAGS "-fsanitize=address")
19+
1820
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
1921
set(VCPKG_OSX_ARCHITECTURES x86_64)

0 commit comments

Comments
 (0)