-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Enable MSAN support again #46348
Enable MSAN support again #46348
Conversation
I believe JITLink has support for TLS relocation so we might get that for free when we enable it soon ™️ https://groups.google.com/g/llvm-dev/c/iTAdTFQ-ql8 |
Analogous to (and dependent on) #46336, but for msan. The biggest change is a workaround for LLVM's lack for TLS relocation support (I had a fix for that about 7 years ago at https://reviews.llvm.org/D8815, but that was x86_64-linux-gnu only, while this workaround works everywhere - though we should consider resurrecting my patch for performance at some point). The rest is mostly build fixes and plumbing to get the sanitizer flags through to the dependencies.
@@ -856,8 +856,11 @@ uint8_t *RTDyldMemoryManagerJL::allocateCodeSection(uintptr_t Size, | |||
StringRef SectionName) | |||
{ | |||
// allocating more than one code section can confuse libunwind. | |||
#if defined(_COMPILER_MSAN_ENABLED_) | |||
// TODO: Figure out why msan needs this. | |||
assert(!code_allocated); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this assert now only used when MSAN is present? The memory manager can't handle recursive allocations anyways, so the assert guards against that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this was a typo. Obviously the condition should be inverted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even so, I'm surprised that simply disabling the assert works for MSAN at all. Whenever I've disabled that assert the memory manager dies later on with a deeper error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know - I haven't looked into it further. You're welcome to it ;)
@@ -5,7 +5,7 @@ OPENBLAS_GIT_URL := https://github.com/xianyi/OpenBLAS.git | |||
OPENBLAS_TAR_URL = https://api.github.com/repos/xianyi/OpenBLAS/tarball/$1 | |||
$(eval $(call git-external,openblas,OPENBLAS,,,$(BUILDDIR))) | |||
|
|||
OPENBLAS_BUILD_OPTS := CC="$(CC)" FC="$(FC)" LD="$(LD)" RANLIB="$(RANLIB)" TARGET=$(OPENBLAS_TARGET_ARCH) BINARY=$(BINARY) | |||
OPENBLAS_BUILD_OPTS := CC="$(CC) $(SANITIZE_OPTS)" FC="$(FC) $(SANITIZE_OPTS) -L/home/keno/julia-msan/usr/lib" LD="$(LD) $(SANITIZE_LDFLAGS)" RANLIB="$(RANLIB)" BINARY=$(BINARY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-L/home/keno/julia-msan/usr/lib
Is that supposed to be something else?
This commit breaks build from source of suite-sparse on macOS because system linker (Apple's ld) does not recognise the |
Analogous to (and dependent on) #46336, but for msan. The biggest
change is a workaround for LLVM's lack for TLS relocation support
(I had a fix for that about 7 years ago at https://reviews.llvm.org/D8815,
but that was x86_64-linux-gnu only, while this workaround works
everywhere - though we should consider resurrecting my patch for
performance at some point). The rest is mostly build fixes and
plumbing to get the sanitizer flags through to the dependencies.