Skip to content

Commit

Permalink
Revert "[asan][win][msvc] override new and delete and seperate TUs (l…
Browse files Browse the repository at this point in the history
  • Loading branch information
kstoimenov committed Dec 1, 2023
1 parent d8a0439 commit a09b881
Show file tree
Hide file tree
Showing 46 changed files with 75 additions and 1,696 deletions.
93 changes: 3 additions & 90 deletions compiler-rt/lib/asan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,40 +38,9 @@ if (NOT WIN32 AND NOT APPLE)
)
endif()

if (WIN32)
set(ASAN_CXX_SOURCES asan_win_new_delete.cpp)
else()
set(ASAN_CXX_SOURCES asan_new_delete.cpp)
endif()

if (APPLE)
set(ASAN_SOURCES ASAN_CXX_SOURCES)
endif()

if (WIN32)
set(ASAN_STATIC_IMPLIB_SOURCES
asan_win_delete_array_thunk.cpp
asan_win_delete_array_align_thunk.cpp
asan_win_delete_array_align_nothrow_thunk.cpp
asan_win_delete_array_nothrow_thunk.cpp
asan_win_delete_array_size_thunk.cpp
asan_win_delete_array_size_align_thunk.cpp
asan_win_delete_scalar_thunk.cpp
asan_win_delete_scalar_align_thunk.cpp
asan_win_delete_scalar_align_nothrow_thunk.cpp
asan_win_delete_scalar_nothrow_thunk.cpp
asan_win_delete_scalar_size_thunk.cpp
asan_win_delete_scalar_size_align_thunk.cpp
asan_win_new_array_thunk.cpp
asan_win_new_array_align_thunk.cpp
asan_win_new_array_align_nothrow_thunk.cpp
asan_win_new_array_nothrow_thunk.cpp
asan_win_new_scalar_thunk.cpp
asan_win_new_scalar_align_thunk.cpp
asan_win_new_scalar_align_nothrow_thunk.cpp
asan_win_new_scalar_nothrow_thunk.cpp
)
endif()
set(ASAN_CXX_SOURCES
asan_new_delete.cpp
)

set(ASAN_STATIC_SOURCES
asan_rtl_static.cpp
Expand Down Expand Up @@ -114,20 +83,12 @@ SET(ASAN_HEADERS
asan_thread.h
)

if (WIN32)
list(APPEND ASAN_HEADERS
asan_win_new_delete_thunk_common.h
asan_win_thunk_common.h
)
endif()

include_directories(..)

set(ASAN_CFLAGS ${SANITIZER_COMMON_CFLAGS})
set(ASAN_COMMON_DEFINITIONS ${COMPILER_RT_ASAN_SHADOW_SCALE_DEFINITION})

append_rtti_flag(OFF ASAN_CFLAGS)
append_list_if(MSVC /EHsc ASAN_CFLAGS)

# Silence warnings in system headers with MSVC.
if(NOT CLANG_CL)
Expand Down Expand Up @@ -178,15 +139,6 @@ add_compiler_rt_object_libraries(RTAsan_dynamic
CFLAGS ${ASAN_DYNAMIC_CFLAGS}
DEFS ${ASAN_DYNAMIC_DEFINITIONS})

if (WIN32)
add_compiler_rt_object_libraries(RTAsan_static_implib
ARCHS ${ASAN_SUPPORTED_ARCH}
SOURCES ${ASAN_STATIC_IMPLIB_SOURCES}
ADDITIONAL_HEADERS ${ASAN_HEADERS}
CFLAGS ${ASAN_CFLAGS} ${NO_DEFAULT_LIBS_OPTION}
DEFS ${ASAN_COMMON_DEFINITIONS})
endif()

if(NOT APPLE)
add_compiler_rt_object_libraries(RTAsan
ARCHS ${ASAN_SUPPORTED_ARCH}
Expand Down Expand Up @@ -287,24 +239,13 @@ else()
DEFS ${ASAN_COMMON_DEFINITIONS}
PARENT_TARGET asan)

if(WIN32)
add_compiler_rt_runtime(clang_rt.asan_static
STATIC
ARCHS ${ASAN_SUPPORTED_ARCH}
OBJECT_LIBS RTAsan_static
RTAsan_static_implib
CFLAGS ${ASAN_CFLAGS}
DEFS ${ASAN_COMMON_DEFINITIONS}
PARENT_TARGET asan)
else()
add_compiler_rt_runtime(clang_rt.asan_static
STATIC
ARCHS ${ASAN_SUPPORTED_ARCH}
OBJECT_LIBS RTAsan_static
CFLAGS ${ASAN_CFLAGS}
DEFS ${ASAN_COMMON_DEFINITIONS}
PARENT_TARGET asan)
endif()

add_compiler_rt_runtime(clang_rt.asan-preinit
STATIC
Expand All @@ -314,13 +255,6 @@ endif()
DEFS ${ASAN_COMMON_DEFINITIONS}
PARENT_TARGET asan)


if (MSVC AND COMPILER_RT_DEBUG)
set(MSVC_DBG_SUFFIX _dbg)
else()
set(MSVC_DBG_SUFFIX )
endif()

foreach(arch ${ASAN_SUPPORTED_ARCH})
if (COMPILER_RT_HAS_VERSION_SCRIPT)
add_sanitizer_rt_version_list(clang_rt.asan-dynamic-${arch}
Expand Down Expand Up @@ -377,27 +311,6 @@ endif()
DEFS ${ASAN_DYNAMIC_DEFINITIONS}
PARENT_TARGET asan)

if(WIN32)
set_target_properties(clang_rt.asan${MSVC_DBG_SUFFIX}-dynamic-${arch}
PROPERTIES ARCHIVE_OUTPUT_NAME clang_rt.asan_dynamic-${arch}_implib
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")

add_library(clang_rt.asan-${arch}_implib STATIC)
target_link_libraries(clang_rt.asan-${arch}_implib RTAsan_static_implib.${arch})
add_dependencies(asan clang_rt.asan-${arch}_implib)
add_dependencies(clang_rt.asan-${arch}_implib clang_rt.asan${MSVC_DBG_SUFFIX}-dynamic-${arch})
get_compiler_rt_output_dir(${arch} IMPLIB_OUTPUT_DIR)
set_target_properties(clang_rt.asan-${arch}_implib
PROPERTIES ARCHIVE_OUTPUT_NAME clang_rt.asan${MSVC_DBG_SUFFIX}_dynamic-${arch}
ARCHIVE_OUTPUT_DIRECTORY ${IMPLIB_OUTPUT_DIR}
STATIC_LIBRARY_OPTIONS "$<TARGET_LINKER_FILE:clang_rt.asan${MSVC_DBG_SUFFIX}-dynamic-${arch}>")
get_compiler_rt_install_dir(${arch} IMPLIB_INSTALL_DIR)
install(TARGETS clang_rt.asan-${arch}_implib
ARCHIVE DESTINATION ${IMPLIB_INSTALL_DIR}
LIBRARY DESTINATION ${IMPLIB_INSTALL_DIR}
RUNTIME DESTINATION ${IMPLIB_INSTALL_DIR})
endif()

if (SANITIZER_USE_SYMBOLS AND NOT ${arch} STREQUAL "i386")
add_sanitizer_rt_symbols(clang_rt.asan_cxx
ARCHS ${arch})
Expand Down
19 changes: 0 additions & 19 deletions compiler-rt/lib/asan/asan_interface.inc
Original file line number Diff line number Diff line change
Expand Up @@ -187,22 +187,3 @@ INTERFACE_FUNCTION(__asan_update_allocation_context)
INTERFACE_WEAK_FUNCTION(__asan_default_options)
INTERFACE_WEAK_FUNCTION(__asan_default_suppressions)
INTERFACE_WEAK_FUNCTION(__asan_on_error)

#if SANITIZER_WINDOWS
INTERFACE_FUNCTION(__asan_delete)
INTERFACE_FUNCTION(__asan_delete_align)
INTERFACE_FUNCTION(__asan_delete_array)
INTERFACE_FUNCTION(__asan_delete_array_align)
INTERFACE_FUNCTION(__asan_delete_array_size)
INTERFACE_FUNCTION(__asan_delete_array_size_align)
INTERFACE_FUNCTION(__asan_delete_size)
INTERFACE_FUNCTION(__asan_delete_size_align)
INTERFACE_FUNCTION(__asan_new)
INTERFACE_FUNCTION(__asan_new_align)
INTERFACE_FUNCTION(__asan_new_align_nothrow)
INTERFACE_FUNCTION(__asan_new_array)
INTERFACE_FUNCTION(__asan_new_array_align)
INTERFACE_FUNCTION(__asan_new_array_align_nothrow)
INTERFACE_FUNCTION(__asan_new_array_nothrow)
INTERFACE_FUNCTION(__asan_new_nothrow)
#endif // SANITIZER_WINDOWS
24 changes: 0 additions & 24 deletions compiler-rt/lib/asan/asan_win_delete_array_align_nothrow_thunk.cpp

This file was deleted.

28 changes: 0 additions & 28 deletions compiler-rt/lib/asan/asan_win_delete_array_align_thunk.cpp

This file was deleted.

23 changes: 0 additions & 23 deletions compiler-rt/lib/asan/asan_win_delete_array_nothrow_thunk.cpp

This file was deleted.

28 changes: 0 additions & 28 deletions compiler-rt/lib/asan/asan_win_delete_array_size_align_thunk.cpp

This file was deleted.

27 changes: 0 additions & 27 deletions compiler-rt/lib/asan/asan_win_delete_array_size_thunk.cpp

This file was deleted.

28 changes: 0 additions & 28 deletions compiler-rt/lib/asan/asan_win_delete_array_thunk.cpp

This file was deleted.

This file was deleted.

24 changes: 0 additions & 24 deletions compiler-rt/lib/asan/asan_win_delete_scalar_align_thunk.cpp

This file was deleted.

Loading

0 comments on commit a09b881

Please sign in to comment.