mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-22 23:48:58 +00:00
Memory Sanitizer build
This commit is contained in:
parent
2ce8a28e41
commit
bb3fe16bd5
@ -13,7 +13,7 @@ ExternalProject_Add(
|
|||||||
GIT_REPOSITORY https://github.com/llvm/llvm-project.git
|
GIT_REPOSITORY https://github.com/llvm/llvm-project.git
|
||||||
GIT_TAG llvmorg-12.0.0
|
GIT_TAG llvmorg-12.0.0
|
||||||
GIT_SHALLOW TRUE
|
GIT_SHALLOW TRUE
|
||||||
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=${LLVM_PROJECT_TARGETS} -DLLVM_USE_SANITIZER=MemoryWithOrigins -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm-project/llvm
|
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=${LLVM_PROJECT_TARGETS} -DLLVM_USE_SANITIZER=MemoryWithOrigins -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm-project/llvm -DLLVM_INCLUDE_BENCHMARKS=OFF
|
||||||
BUILD_COMMAND ${MAKE_PROGRAM} cxx cxxabi
|
BUILD_COMMAND ${MAKE_PROGRAM} cxx cxxabi
|
||||||
INSTALL_COMMAND DESTDIR=${PREFIX} make install-cxx-headers install-cxx install-cxxabi
|
INSTALL_COMMAND DESTDIR=${PREFIX} make install-cxx-headers install-cxx install-cxxabi
|
||||||
COMMENT "Building memcheck instrumented libc++ and libc++abi"
|
COMMENT "Building memcheck instrumented libc++ and libc++abi"
|
||||||
@ -37,4 +37,6 @@ set_target_properties(
|
|||||||
set_target_properties(
|
set_target_properties(
|
||||||
cxxabi PROPERTIES IMPORTED_LOCATION ${LLVM_LIB_CXXABI})
|
cxxabi PROPERTIES IMPORTED_LOCATION ${LLVM_LIB_CXXABI})
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY llvmproject_build_install_dir_property ${PREFIX}/usr/local)
|
set_property(
|
||||||
|
GLOBAL PROPERTY llvmproject_build_install_dir_property
|
||||||
|
${PREFIX}/usr/local)
|
||||||
|
32
.github/workflows/main.yml
vendored
32
.github/workflows/main.yml
vendored
@ -86,19 +86,19 @@ jobs:
|
|||||||
curl http://amongbytes.com/~flowher/permalinks/kat.zip --output kat.zip
|
curl http://amongbytes.com/~flowher/permalinks/kat.zip --output kat.zip
|
||||||
unzip kat.zip
|
unzip kat.zip
|
||||||
cargo run --release -- --katdir KAT
|
cargo run --release -- --katdir KAT
|
||||||
# MEMSAN:
|
MEMSAN:
|
||||||
# name: Memory Sanitizer build
|
name: Memory Sanitizer build
|
||||||
# runs-on: [ubuntu-20.04]
|
runs-on: [ubuntu-20.04]
|
||||||
# steps:
|
steps:
|
||||||
# - uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
# with:
|
with:
|
||||||
# submodules: true
|
submodules: true
|
||||||
# - name: build
|
- name: build
|
||||||
# run: |
|
run: |
|
||||||
# mkdir -p build
|
mkdir -p build
|
||||||
# cd build
|
cd build
|
||||||
# CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release -DMEMSAN=1 ..
|
CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release -DMEMSAN=1 ..
|
||||||
# make
|
make
|
||||||
# - name: run tests
|
- name: run tests
|
||||||
# run: |
|
run: |
|
||||||
# cd build && ./ut --gtest_filter="NONE"
|
cd build && ./ut --gtest_filter="NONE"
|
||||||
|
@ -53,7 +53,6 @@ FetchContent_Declare(
|
|||||||
SOURCE_DIR ${PROJECT_SOURCE_DIR}/3rd/gbench
|
SOURCE_DIR ${PROJECT_SOURCE_DIR}/3rd/gbench
|
||||||
GIT_REPOSITORY https://github.com/kriskwiatkowski/benchmark.git
|
GIT_REPOSITORY https://github.com/kriskwiatkowski/benchmark.git
|
||||||
GIT_TAG 49862ab56b6b7c3afd87b80bd5d787ed78ce3b96
|
GIT_TAG 49862ab56b6b7c3afd87b80bd5d787ed78ce3b96
|
||||||
GIT_SHALLOW TRUE
|
|
||||||
)
|
)
|
||||||
FetchContent_Populate(gbench)
|
FetchContent_Populate(gbench)
|
||||||
|
|
||||||
@ -62,7 +61,6 @@ FetchContent_Declare(
|
|||||||
SOURCE_DIR ${PROJECT_SOURCE_DIR}/3rd/cpu_features
|
SOURCE_DIR ${PROJECT_SOURCE_DIR}/3rd/cpu_features
|
||||||
GIT_REPOSITORY https://github.com/google/cpu_features.git
|
GIT_REPOSITORY https://github.com/google/cpu_features.git
|
||||||
GIT_TAG bc2846e78faeb26b8a46c17df369d4e5f1f9e2bb
|
GIT_TAG bc2846e78faeb26b8a46c17df369d4e5f1f9e2bb
|
||||||
GIT_SHALLOW TRUE
|
|
||||||
)
|
)
|
||||||
FetchContent_Populate(cpu_features)
|
FetchContent_Populate(cpu_features)
|
||||||
|
|
||||||
@ -382,8 +380,16 @@ if(NOT CMAKE_BUILD_TYPE_LOWER STREQUAL "debug")
|
|||||||
# set(BENCHMARK_ENABLE_LTO ON CACHE BOOL "Enable link time optim" FORCE)
|
# set(BENCHMARK_ENABLE_LTO ON CACHE BOOL "Enable link time optim" FORCE)
|
||||||
#endif()
|
#endif()
|
||||||
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "" FORCE)
|
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "" FORCE)
|
||||||
|
set(BENCHMARK_ENABLE_EXCEPTIONS OFF CACHE BOOL "" FORCE)
|
||||||
set(CMAKE_C_FLAGS "${C_CXX_FLAGS} ${EXTRA_CXX_FLAGS}")
|
set(CMAKE_C_FLAGS "${C_CXX_FLAGS} ${EXTRA_CXX_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS "${C_CXX_FLAGS} ${EXTRA_CXX_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${C_CXX_FLAGS} ${EXTRA_CXX_FLAGS}")
|
||||||
|
if (MEMSAN)
|
||||||
|
set(BENCHMARK_USE_LIBCXX ON CACHE BOOL "" FORCE)
|
||||||
|
# Since build requires C++20 it is safe to assume that std::regex is available.
|
||||||
|
# It seems I need to force it as benchmark build doesn't work very well with libc++
|
||||||
|
set(HAVE_STD_REGEX ON CACHE BOOL "OK" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(${CMAKE_SOURCE_DIR}/3rd/gbench)
|
add_subdirectory(${CMAKE_SOURCE_DIR}/3rd/gbench)
|
||||||
add_subdirectory(test/bench)
|
add_subdirectory(test/bench)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/3rd/gbench/include)
|
include_directories(${PROJECT_SOURCE_DIR}/3rd/gbench/include)
|
||||||
link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../3rd/gbench/lib)
|
link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../3rd/gbench/lib)
|
||||||
|
|
||||||
|
if (MEMSAN)
|
||||||
|
set(CXXLIBS_FOR_MEMORY_SANITIZER cxx cxxabi)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(
|
add_executable(
|
||||||
bench
|
bench
|
||||||
kyber.cc
|
kyber.cc)
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
bench
|
bench
|
||||||
@ -16,3 +20,6 @@ target_link_libraries(
|
|||||||
benchmark_main
|
benchmark_main
|
||||||
${CXXLIBS_FOR_MEMORY_SANITIZER})
|
${CXXLIBS_FOR_MEMORY_SANITIZER})
|
||||||
|
|
||||||
|
if (MEMSAN)
|
||||||
|
add_dependencies(bench ${CXXLIBS_FOR_MEMORY_SANITIZER})
|
||||||
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user