Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVM Build Fails with MemorySanitizer Instrumentation Due to Uninitialized Value Errors #1808

Open
JacobNowitsky opened this issue Oct 27, 2024 · 0 comments

Comments

@JacobNowitsky
Copy link

JacobNowitsky commented Oct 27, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant