Skip to content

Commit 5855edb

Browse files
fix(build): enable PIC for sanitizer builds
1 parent f82829d commit 5855edb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎CMakeLists.txt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ if(MAP2CHECK_ENABLE_SANITIZERS)
1717
message(STATUS "Sanitizers enabled: ASan + UBSan (dynamic linking)")
1818
add_compile_options(-fsanitize=address,undefined -fno-omit-frame-pointer -g)
1919
add_link_options(-fsanitize=address,undefined)
20+
# Ensure all targets (including OBJECT libraries) are compiled with -fPIC,
21+
# required for LLVM pass shared libraries (.so)
22+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
2023
# ASan requires dynamic linking — skip static config
2124
set(Map2Check_MODE "SHARED")
2225
else()

0 commit comments

Comments
 (0)