[Tizen] Enable Tizen ASan runtime support
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Wed, 16 Jun 2021 13:24:30 +0000 (16:24 +0300)
committerGleb Balykov <g.balykov@samsung.com>
Tue, 27 Sep 2022 12:50:22 +0000 (15:50 +0300)
Enable libasansi.so support (libasan.so with switchable interceptors).

Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
eng/native/configurecompiler.cmake
packaging/coreclr.spec

index c6f4a6a5627542b548e8c4b50617505b3571520e..974d944d6a721ff3dd54dceffacd001da49dae4d 100644 (file)
@@ -111,6 +111,17 @@ elseif (CLR_CMAKE_HOST_UNIX)
   set(CLR_SANITIZE_CXX_OPTIONS "")
   set(CLR_SANITIZE_LINK_OPTIONS "")
 
+  if(DEFINED ENV{TIZEN_ASAN_ENVIRONMENT})
+    if (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_AMD64)
+      message(STATUS "TIZEN_ASAN_ENVIRONMENT is enabled.")
+      # add definitions to enable ASan support for only external libraries (supported only Tizen)
+      add_definitions(-DTIZEN_ASAN_ENVIRONMENT -DHAS_ADDRESS_SANITIZER)
+      set(TIZEN_ASAN_ENVIRONMENT 1)
+    else()
+      message(STATUS "TIZEN_ASAN_ENVIRONMENT cannot be enabled. Current arch is not supported.")
+    endif()
+  endif()
+
   # set the CLANG sanitizer flags for debug build
   if(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL DEBUG OR UPPERCASE_CMAKE_BUILD_TYPE STREQUAL CHECKED)
     # obtain settings from running enablesanitizers.sh
index 7bcbc07e6b09f508ab3d032d28c01abdaeaf7fd5..9ec55bba83eb5c46921620eaa02116f4a15def98 100755 (executable)
@@ -228,7 +228,9 @@ done
 export ASAN_OPTIONS=use_sigaltstack=false:`cat /ASAN_OPTIONS`
 /usr/bin/gcc-unforce-options
 export LD_LIBRARY_PATH=`pwd`/libicu-57.1
-export CPPFLAGS+=" -DHAS_ADDRESS_SANITIZER "
+
+# enable ASan support for only external libs
+export TIZEN_ASAN_ENVIRONMENT=1
 }
 
 BASE_FLAGS=" --target=%{_host} "