-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
BOLT: clang segfault after instrumenting libclang-cpp.so or libLLVM.so when built with -DLLVM_LINK_{CLANG,LLVM}_DYLIB=ON #111530
Labels
Comments
bughunter
|
bisected to 0053cb8 partial revert of 0053cb8 fixes clang segfaulting after libclang/libLLVM has been instrumented diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index 32ec7abe8b66..f7f63b2ea956 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -5068,11 +5068,9 @@ void RewriteInstance::patchELFAllocatableRelrSection(
const uint8_t PSize = BC->AsmInfo->getCodePointerSize();
const uint64_t MaxDelta = ((CHAR_BIT * DynamicRelrEntrySize) - 1) * PSize;
- auto FixAddend = [&](const BinarySection &Section, const Relocation &Rel,
- uint64_t FileOffset) {
+ auto FixAddend = [&](const BinarySection &Section, const Relocation &Rel) {
// Fix relocation symbol value in place if no static relocation found
- // on the same address. We won't check the BF relocations here since it
- // is rare case and no optimization is required.
+ // on the same address
if (Section.getRelocationAt(Rel.Offset))
return;
@@ -5081,6 +5079,10 @@ void RewriteInstance::patchELFAllocatableRelrSection(
if (!Addend)
return;
+ uint64_t FileOffset = Section.getOutputFileOffset();
+ if (!FileOffset)
+ FileOffset = Section.getInputFileOffset();
+ FileOffset += Rel.Offset;
OS.pwrite(reinterpret_cast<const char *>(&Addend), PSize, FileOffset);
};
@@ -5102,7 +5104,7 @@ void RewriteInstance::patchELFAllocatableRelrSection(
RelOffset = RelOffset == 0 ? SectionAddress + Rel.Offset : RelOffset;
assert((RelOffset & 1) == 0 && "Wrong relocation offset");
RelOffsets.emplace(RelOffset);
- FixAddend(Section, Rel, RelOffset);
+ FixAddend(Section, Rel);
}
}
-- @yota9 hopefully you don't mind the ping |
joebonrichie
added a commit
to getsolus/packages
that referenced
this issue
Oct 16, 2024
**Summary** - llvm/llvm-project#111530 - This looks like a AArch64 specific fix and i'm assuming for now it's fine on X86.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested as of db1a762, the last worked was with llvm-17
Repro:
backstrace
Lemme know if I can provide any more details.
The text was updated successfully, but these errors were encountered: