Skip to content
Snippets Groups Projects
Commit e05fcbe9 authored by Florian Schmaus's avatar Florian Schmaus
Browse files

wip

parent d3899d86
No related branches found
No related tags found
No related merge requests found
Pipeline #75594 failed
......@@ -21,11 +21,12 @@
using emper::io::GlobalIoContext;
static const long NanosInAMinute = 60L * 1000 * 1000 * 1000;
//static const long NanosInAMinute = 60L * 1000 * 1000 * 1000;
namespace emper::log {
static void add_timestamp_to(std::ostringstream& logMessage) {
static void add_timestamp_to(UNUSED_ARG std::ostringstream& logMessage) {
#if 0
auto now = std::chrono::high_resolution_clock::now();
auto now_time_t = std::chrono::high_resolution_clock::to_time_t(now);
......@@ -53,6 +54,7 @@ static void add_timestamp_to(std::ostringstream& logMessage) {
long remaining_nanos = time_since_epoch_long % NanosInAMinute;
logMessage << remaining_nanos;
#endif
}
static std::mutex log_mutex;
......
msan 0 → 100644
#!/usr/bin/env bash
set -euo pipefail
readonly INSTRUMENTED_LIBCXX_DIR="/home/flo/repos/llvm-13.0.0/build"
readonly INSTRUMENTED_LIBCXX_LIB_DIR="${INSTRUMENTED_LIBCXX_DIR}/lib"
readonly INSTRUMENTED_LIBCXX_INC_DIR="${INSTRUMENTED_LIBCXX_DIR}/include"
# export CC="clang -stdlib=libc++ -L${INSTRUMENTED_LIBCXX_LIB_DIR} -I${INSTRUMENTED_LIBCXX_INC_DIR} -I${INSTRUMENTED_LIBCXX_INC_DIR}c++/v1"
# export CXX="clang++ -stdlib=libc++ -lc++abi -L${INSTRUMENTED_LIBCXX_LIB_DIR} -I${INSTRUMENTED_LIBCXX_INC_DIR} -I${INSTRUMENTED_LIBCXX_INC_DIR}/c++/v1"
export CC="clang"
export CXX="clang++"
# source: https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo
# MSAN_CFLAGS="-fsanitize=memory -stdlib=libc++ -L/path/to/libcxx_msan/lib -lc++abi -I/path/to/libcxx_msan/include -I/path/to/libcxx_msan/include/c++/v1"
# Note that meson automatically passes -stblib=libc++ if clang is used
# TODO: why -lc++abi ?
MSAN_FLAGS=(
# -stdlib=libc++
-L${INSTRUMENTED_LIBCXX_LIB_DIR}
# -lc++abi
-I${INSTRUMENTED_LIBCXX_INC_DIR}/include
-I${INSTRUMENTED_LIBCXX_INC_DIR}/include/c++/v1
)
printf -v MESON_MSAN_CPP_ARGS "%s," "${MSAN_FLAGS[@]}"
# Meson's c_stdlib flag may only work for cross builds "--native-file foo.ini"
# -Dcpp_args="${MESON_MSAN_CPP_ARGS}" \
meson \
--buildtype=debug \
--fatal-meson-warnings \
-Db_sanitize=memory \
-Db_lundef=false \
-Dcpp_args='-stdlib=libc++' \
-Dcpp_args=-I${INSTRUMENTED_LIBCXX_INC_DIR} \
-Dcpp_args=-I${INSTRUMENTED_LIBCXX_INC_DIR}/c++/v1 \
-Dcpp_link_args=-L${INSTRUMENTED_LIBCXX_LIB_DIR} \
build-msan
# It appears that meson is filtering -stdlib=libc++ and always selects
# the compilers default. Which is for clang often libstdc++, i.e., GCC
# C++ standard library.
# NOTE: We could potentially place a complete LLVM/Clang toolchain in
# the CI container, that has the sanitizers enabled.
sed --in-place \
s/clang++/clang++ -stdlib=libc++/ \
build-msan/build.ninja
ninja
export LD_LIBRARY_PATH="${INSTRUMENTED_LIBCXX_LIB_DIR}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment