Skip to content
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

Use dynamic libasan on MacOS #840

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ if(UNIX) # APPLE, LINUX, FREE_BSD
message(STATUS "AddressSanitizer is enabled")
message(STATUS "To disable AddressSanitizer, use -DPCM_NO_ASAN=1 option")
set(PCM_ASAN "-fsanitize=address")
if(APPLE)
set(PCM_ASAN "${PCM_ASAN} -shared-libasan")
endif()
endif()
set(PCM_HARDENING_FLAGS "-fPIE -fstack-protector -D_FORTIFY_SOURCE=2 -ftrapv ${PCM_ASAN} -fwrapv -fno-delete-null-pointer-checks -fno-strict-overflow -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ if(NOT PCM_NO_ASAN)
set(PCM_NO_STATIC_LIBASAN ON)
message(STATUS "CentOS detected, using dynamic libasan")
endif()
if (APPLE)
set(PCM_NO_STATIC_LIBASAN ON)
message(STATUS "MacOS detected, using dynamic libasan")
endif()
endif()

if(UNIX) # LINUX, FREE_BSD, APPLE
Expand Down
1 change: 1 addition & 0 deletions src/MacMSRDriver/PcmMsr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ target_link_libraries(PcmMsrDriver PRIVATE
"-lkmodc++"
"-lkmod"
"-lcc_kext"
"-lasan"
"-nostdlib"
"-Xlinker -export_dynamic"
"-Xlinker -kext"
Expand Down
Loading