mirror of https://github.com/MariaDB/server
Browse Source
When MSAN adds the -fsantize=memory this significantly affects compile and link tests. Whether this is a compile/run/or looking for a symbol in a library these cmake tests require the same flags be set. Ideally the minimum invocation of cmake to create a MSAN build as investigated in MDBF-793 should be: -DWITH_MSAN=ON \ -DCMAKE_{EXE,MODULE}_LINKER_FLAGS="-L${MSAN_LIBDIR} -Wl,-rpath=${MSAN_LIBDIR}" On the assumption that the compiler supports msan and the instrumented libraries are in MSAN_LIBDIR (maybe later can be made a cmake option). Without cmake policy below, the checking of everything from libc++ to libfmt will not have the supplied linker flags or the compile options that WITH_MSAN=ON invokes. Many try_compile and CMake functions that wrapped this and headers failed to be recognised due to missing msan symbols when linking. Also without the -L path, they where applying a link test to the default path libraries rather than the MSAN instrumented ones. The CMake policy enabled is CMP0056, added CMake 3.2, applies CMAKE_EXE_LINKER_FLAGS to try_compile. With this change the MY_CHECK_AND_SET_COMPILER_FLAG remove explict build types resulting in just CMAKE_{C,CXX}_FLAGS being set rather than CMAKE_{C,CXX}_FLAGS_{DEBUG,RELWITHDEBINFO}. These are needed for the default CMP0066 policy to be correctly applied and the msan flags of -fsanitizer=memory are applied to all compile checks. Likewise with MY_CHECK_AND_SET_LINKER_FLAG for CMAKE_{EXE,MODULE,SHARED}_LINKER_FLAGS for those check that involve full linking and CHECK_CXX_SOURCE_RUNS for example.bb-10.6-merge
committed by
Sergei Golubchik
1 changed files with 3 additions and 3 deletions
Loading…
Reference in new issue