Merge address sanitizer branch into amd-staging

Merge in topic branch to enable address sanitizer and CLANG compilation
support into amd-staging branch

Change-Id: I3fcd24c6fac83d0619bef4cbbc56fd95e9fb009d
Signed-off-by: Kent Russell <kent.russell@amd.com>


[ROCm/ROCR-Runtime commit: c742764d01]
This commit is contained in:
Kent Russell
2021-01-06 11:49:51 -05:00
2 changed files with 25 additions and 2 deletions
+18 -1
View File
@@ -94,7 +94,24 @@ set ( HSAKMT_LINKER_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/src/libhsakmt.ver" )
## Linker Flags
## Add --enable-new-dtags to generate DT_RUNPATH
set (HSAKMT_LINK_FLAGS "-Wl,--enable-new-dtags -Wl,--version-script=${HSAKMT_LINKER_SCRIPT} -Wl,-soname=${HSAKMT_COMPONENT}.so.${LIB_VERSION_MAJOR} -Wl,-z,nodelete -Wl,-no-undefined" )
set (HSAKMT_LINK_FLAGS "${HSAKMT_LINK_FLAGS} -Wl,--enable-new-dtags -Wl,--version-script=${HSAKMT_LINKER_SCRIPT} -Wl,-soname=${HSAKMT_COMPONENT}.so.${LIB_VERSION_MAJOR} -Wl,-z,nodelete")
## Address Sanitize Flag
if ( ${ADDRESS_SANITIZER} )
set ( HSAKMT_C_FLAGS "${HSAKMT_C_FLAGS}" -fsanitize=address )
set ( HSAKMT_LINK_FLAGS "${HSAKMT_LINK_FLAGS}" -fsanitize=address )
if ( BUILD_SHARED_LIBS} )
set ( HSAKMT_LINK_FLAGS "${HSAKMT_LINK_FLAGS}" -shared-libasan )
else ()
set ( HSAKMT_LINK_FLAGS "${HSAKMT_LINK_FLAGS}" -static-libasan )
endif ()
else ()
if ( CMAKE_COMPILER_IS_GNUCC )
set ( HSAKMT_LINK_FLAGS "${HSAKMT_LINK_FLAGS}" -Wl,-no-undefined )
else ()
set ( HSAKMT_LINK_FLAGS "${HSAKMT_LINK_FLAGS}" -Wl,-undefined,error )
endif ()
endif ()
## Source files
set ( HSAKMT_SRC "src/debug.c"
@@ -24,7 +24,7 @@
# If environment variable DRM_DIR or LIBHSAKMT_PATH is set, the script
# will pick up the corresponding libraries from those pathes.
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
project(KFDTest)
@@ -165,6 +165,12 @@ else ()
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g" )
endif ()
## Address Sanitize Flag
if ( ${ADDRESS_SANITIZER} )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address" )
set ( CMAKE_EXE_LINKER_FLAGS -fsanitize=address )
endif ()
# link_directories() has to be put before add_executable()
# The modules found by pkg_check_modules() in the default pkg config
# path do not need to use link_directories() here.