[compiler-rt] 3fb6416 - [ORC-RT][llvm-jitlink] Fix a buggy check in ORC-RT MachO TLV deregistration.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 12 10:36:38 PST 2021
Author: Lang Hames
Date: 2021-11-12T10:36:17-08:00
New Revision: 3fb641618f1a3b73c0bd661c567e8db32dcde491
URL: https://github.com/llvm/llvm-project/commit/3fb641618f1a3b73c0bd661c567e8db32dcde491
DIFF: https://github.com/llvm/llvm-project/commit/3fb641618f1a3b73c0bd661c567e8db32dcde491.diff
LOG: [ORC-RT][llvm-jitlink] Fix a buggy check in ORC-RT MachO TLV deregistration.
The check was failing because it was matching against the end of the range, not
the start.
This bug wasn't causing the ORC-RT MachO TLV regression test to fail because
we were only logging deallocation errors (including TLV deregistration errors)
and not actually returning a failure code. This commit updates llvm-jitlink to
report the errors properly.
Added:
Modified:
compiler-rt/lib/orc/macho_platform.cpp
llvm/tools/llvm-jitlink/llvm-jitlink.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/orc/macho_platform.cpp b/compiler-rt/lib/orc/macho_platform.cpp
index b36f9df1c3c24..d8f9d5b8ad923 100644
--- a/compiler-rt/lib/orc/macho_platform.cpp
+++ b/compiler-rt/lib/orc/macho_platform.cpp
@@ -308,7 +308,7 @@ Error MachOPlatformRuntimeState::registerThreadDataSection(
Error MachOPlatformRuntimeState::deregisterThreadDataSection(
span<const char> ThreadDataSection) {
std::lock_guard<std::mutex> Lock(ThreadDataSectionsMutex);
- auto I = ThreadDataSections.find(ThreadDataSection.end());
+ auto I = ThreadDataSections.find(ThreadDataSection.data());
if (I == ThreadDataSections.end())
return make_error<StringError>("Attempt to deregister unknown thread data "
"section");
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index b9faf3d249d45..f3486868c514a 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -1643,6 +1643,7 @@ int main(int argc, char *argv[]) {
}
// Destroy the session.
+ ExitOnErr(S->ES.endSession());
S.reset();
// If the executing code set a test result override then use that.
More information about the llvm-commits
mailing list