Description
Issue Description
I am attempting to build LLVM with MemorySanitizer (MemoryWithOrigins) as described in the MemorySanitizer libc++ guide, but I encounter persistent build failures and uninitialized value errors.
Build Configuration:
cmake -GNinja ../llvm \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi" \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_USE_SANITIZER=MemoryWithOrigins
Build Failure Output:
I am running ninja to build with the above configuration. The following error is typical of what I see:
#7 0x555f2def5c9c in llvm::RecordKeeper::addClass(std::unique_ptr<llvm::Record, std::default_deletellvm::Record >) /home/j/llvm-project/llvm/include/llvm/TableGen/Record.h:2027:24
...
SUMMARY: MemorySanitizer: use-of-uninitialized-value /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:1336:4 in _M_lower_bound_tr<llvm::StringRef, void>
The full build log can be found in my Stack Overflow question: LLVM error with libc++ instrumentation.
https://stackoverflow.com/questions/79131437/llvm-build-fails-with-memorysanitizer-enabled
Additional Steps Tried
While building without MemoryWithOrigins completes successfully, the instrumentation necessary to use MemorySanitizer with libc++ is missing, making it ineffective for my application.
Expected Behavior
The build should succeed with MemoryWithOrigins enabled, allowing the MemorySanitizer to instrument libc++ without throwing uninitialized value errors during the build process.
Questions
Is there a known workaround for these errors?
Are there additional flags or configuration options to enable a successful build with MemorySanitizer?
Any insights or further troubleshooting steps would be greatly appreciated.