From 2ab75569934b0f54aaa6dd0b584503a92f668eb4 Mon Sep 17 00:00:00 2001 From: Aakanksha Patil Date: Mon, 12 Apr 2021 17:46:33 -0400 Subject: [PATCH 1/4] [HIPIFY] Address sanitizer support --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f46988bc..3342fb50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,8 +85,11 @@ else() string(APPEND StdCpp "11") endif() -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${StdCpp} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\"") +# Address Sanitize Flag + if (ADDRESS_SANITIZER) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fsanitize=address") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${StdCpp} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\" -fsanitize=address") + endif() set(INSTALL_PATH_DOC_STRING "hipify-clang Installation Path") set(HIPIFY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}) From be4a3cfffdeb729d0d03bbda25248738a034f7bf Mon Sep 17 00:00:00 2001 From: Aakanksha Patil Date: Mon, 12 Apr 2021 17:46:33 -0400 Subject: [PATCH 2/4] [HIPIFY] Address sanitizer support --- CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3342fb50..b0367deb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,10 +86,14 @@ else() endif() # Address Sanitize Flag - if (ADDRESS_SANITIZER) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fsanitize=address") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${StdCpp} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\" -fsanitize=address") - endif() +if (ADDRESS_SANITIZER) + set(addr_var address) +else() + set(addr_var ) +endif() + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fsanitize=${addr_var}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${StdCpp} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\" -fsanitize=${addr_var}") set(INSTALL_PATH_DOC_STRING "hipify-clang Installation Path") set(HIPIFY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}) From 21368be5a6fad1680d320ac61eeece01585d50d4 Mon Sep 17 00:00:00 2001 From: Aakanksha Patil Date: Mon, 12 Apr 2021 17:46:33 -0400 Subject: [PATCH 3/4] [HIPIFY] Address sanitizer support --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b0367deb..ee7b92b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,13 +87,13 @@ endif() # Address Sanitize Flag if (ADDRESS_SANITIZER) - set(addr_var address) + set(addr_var -fsanitize=address) else() set(addr_var ) endif() -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fsanitize=${addr_var}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${StdCpp} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\" -fsanitize=${addr_var}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${addr_var}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${StdCpp} -DHIPIFY_CLANG_RES=\\\"${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}\\\" ${addr_var}") set(INSTALL_PATH_DOC_STRING "hipify-clang Installation Path") set(HIPIFY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}) From eee820ce148b3ede47c2ec908918b5064352823d Mon Sep 17 00:00:00 2001 From: Aakanksha Patil Date: Mon, 12 Apr 2021 17:46:33 -0400 Subject: [PATCH 4/4] [HIPIFY] Address sanitizer support --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f46e33f2..22ceef82 100644 --- a/README.md +++ b/README.md @@ -256,7 +256,7 @@ Run `Visual Studio 16 2019`, open the generated `LLVM.sln`, build all, build pro -DCMAKE_INSTALL_PREFIX=../dist \ -DLLVM_SOURCE_DIR=../llvm-project \ -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" \ - -DLLVM_ENABLE_PROJECTS="clang" \ + -DLLVM_ENABLE_PROJECTS="clang;compiler-rt" \ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \ -DCMAKE_BUILD_TYPE=Release \ ../llvm-project/llvm @@ -270,7 +270,7 @@ Run `Visual Studio 16 2019`, open the generated `LLVM.sln`, build all, build pro -DCMAKE_INSTALL_PREFIX=../dist \ -DLLVM_SOURCE_DIR=../llvm-project \ -DLLVM_TARGETS_TO_BUILD="NVPTX" \ - -DLLVM_ENABLE_PROJECTS="clang" \ + -DLLVM_ENABLE_PROJECTS="clang;compiler-rt" \ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \ -DCMAKE_BUILD_TYPE=Release \ -Thost=x64 \