[compiler-rt] beb3d48 - [ORC-RT] Fix objc selector corruption
Ben Langmuir via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 27 16:03:02 PDT 2021
Author: Ben Langmuir
Date: 2021-10-27T16:02:52-07:00
New Revision: beb3d48262bc541755d2f829b83b5f1e26d6d0b1
URL: https://github.com/llvm/llvm-project/commit/beb3d48262bc541755d2f829b83b5f1e26d6d0b1
DIFF: https://github.com/llvm/llvm-project/commit/beb3d48262bc541755d2f829b83b5f1e26d6d0b1.diff
LOG: [ORC-RT] Fix objc selector corruption
We were writing a pointer to a selector string into the contents of a
string instead of overwriting the pointer to the string, leading to
corruption. This was causing non-deterministic failures of the
'trivial-objc-methods' test case.
Differential Revision: https://reviews.llvm.org/D112671
Added:
Modified:
compiler-rt/lib/orc/macho_platform.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/orc/macho_platform.cpp b/compiler-rt/lib/orc/macho_platform.cpp
index fac9918da5893..e25b2a9568180 100644
--- a/compiler-rt/lib/orc/macho_platform.cpp
+++ b/compiler-rt/lib/orc/macho_platform.cpp
@@ -112,10 +112,10 @@ Error registerObjCSelectors(
if (auto Err = validatePointerSectionExtent("__objc_selrefs", ObjCSelRefs))
return Err;
- for (uintptr_t SelEntry : ObjCSelRefs.toSpan<uintptr_t>()) {
+ for (uintptr_t &SelEntry : ObjCSelRefs.toSpan<uintptr_t>()) {
const char *SelName = reinterpret_cast<const char *>(SelEntry);
auto Sel = sel_registerName(SelName);
- *reinterpret_cast<SEL *>(SelEntry) = Sel;
+ *reinterpret_cast<SEL *>(&SelEntry) = Sel;
}
}
More information about the llvm-commits
mailing list