Mirror von
https://github.com/henrydcase/pqc.git
synchronisiert 2024-11-25 08:51:26 +00:00
Memory Sanitizer build
Dieser Commit ist enthalten in:
Ursprung
2ce8a28e41
Commit
bb3fe16bd5
@ -13,7 +13,7 @@ ExternalProject_Add(
|
||||
GIT_REPOSITORY https://github.com/llvm/llvm-project.git
|
||||
GIT_TAG llvmorg-12.0.0
|
||||
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
|
||||
INSTALL_COMMAND DESTDIR=${PREFIX} make install-cxx-headers install-cxx install-cxxabi
|
||||
COMMENT "Building memcheck instrumented libc++ and libc++abi"
|
||||
@ -37,4 +37,6 @@ set_target_properties(
|
||||
set_target_properties(
|
||||
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
|
||||
unzip kat.zip
|
||||
cargo run --release -- --katdir KAT
|
||||
# MEMSAN:
|
||||
# name: Memory Sanitizer build
|
||||
# runs-on: [ubuntu-20.04]
|
||||
# steps:
|
||||
# - uses: actions/checkout@v1
|
||||
# with:
|
||||
# submodules: true
|
||||
# - name: build
|
||||
# run: |
|
||||
# mkdir -p build
|
||||
# cd build
|
||||
# CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release -DMEMSAN=1 ..
|
||||
# make
|
||||
# - name: run tests
|
||||
# run: |
|
||||
# cd build && ./ut --gtest_filter="NONE"
|
||||
MEMSAN:
|
||||
name: Memory Sanitizer build
|
||||
runs-on: [ubuntu-20.04]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: true
|
||||
- name: build
|
||||
run: |
|
||||
mkdir -p build
|
||||
cd build
|
||||
CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release -DMEMSAN=1 ..
|
||||
make
|
||||
- name: run tests
|
||||
run: |
|
||||
cd build && ./ut --gtest_filter="NONE"
|
||||
|
@ -53,7 +53,6 @@ FetchContent_Declare(
|
||||
SOURCE_DIR ${PROJECT_SOURCE_DIR}/3rd/gbench
|
||||
GIT_REPOSITORY https://github.com/kriskwiatkowski/benchmark.git
|
||||
GIT_TAG 49862ab56b6b7c3afd87b80bd5d787ed78ce3b96
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
FetchContent_Populate(gbench)
|
||||
|
||||
@ -62,7 +61,6 @@ FetchContent_Declare(
|
||||
SOURCE_DIR ${PROJECT_SOURCE_DIR}/3rd/cpu_features
|
||||
GIT_REPOSITORY https://github.com/google/cpu_features.git
|
||||
GIT_TAG bc2846e78faeb26b8a46c17df369d4e5f1f9e2bb
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
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)
|
||||
#endif()
|
||||
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_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(test/bench)
|
||||
endif()
|
||||
|
@ -1,12 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR}/3rd/gbench/include)
|
||||
link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../3rd/gbench/lib)
|
||||
|
||||
if (MEMSAN)
|
||||
set(CXXLIBS_FOR_MEMORY_SANITIZER cxx cxxabi)
|
||||
endif()
|
||||
|
||||
add_executable(
|
||||
bench
|
||||
kyber.cc
|
||||
)
|
||||
kyber.cc)
|
||||
|
||||
target_link_libraries(
|
||||
bench
|
||||
@ -16,3 +20,6 @@ target_link_libraries(
|
||||
benchmark_main
|
||||
${CXXLIBS_FOR_MEMORY_SANITIZER})
|
||||
|
||||
if (MEMSAN)
|
||||
add_dependencies(bench ${CXXLIBS_FOR_MEMORY_SANITIZER})
|
||||
endif()
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren