[llvm] 10539ec - [dsymutil] fix accidental 32bit truncation in patchFrameInfoForObject
Alexey Lapshin via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 17 06:27:49 PST 2022
Author: Alessandro Arzilli
Date: 2022-12-17T15:26:32+01:00
New Revision: 10539ec2cf69fa8433840c9ddd6a56b8e2735e7a
URL: https://github.com/llvm/llvm-project/commit/10539ec2cf69fa8433840c9ddd6a56b8e2735e7a
DIFF: https://github.com/llvm/llvm-project/commit/10539ec2cf69fa8433840c9ddd6a56b8e2735e7a.diff
LOG: [dsymutil] fix accidental 32bit truncation in patchFrameInfoForObject
patchFrameInfoForObject accidentally truncates FDE addresses
to the least significant 32bits, which causes the Go bug: https://github.com/golang/go/issues/25841.
Patch by Alessandro Arzilli
Differential Revision: https://reviews.llvm.org/D138763
Added:
Modified:
llvm/include/llvm/DWARFLinker/DWARFLinker.h
llvm/include/llvm/DWARFLinker/DWARFStreamer.h
llvm/lib/DWARFLinker/DWARFLinker.cpp
llvm/lib/DWARFLinker/DWARFStreamer.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/DWARFLinker/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
index 8125adda78b0e..6b0f4574999d2 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
@@ -153,7 +153,7 @@ class DwarfEmitter {
virtual void emitCIE(StringRef CIEBytes) = 0;
/// Emit an FDE with data \p Bytes.
- virtual void emitFDE(uint32_t CIEOffset, uint32_t AddreSize, uint32_t Address,
+ virtual void emitFDE(uint32_t CIEOffset, uint32_t AddreSize, uint64_t Address,
StringRef Bytes) = 0;
/// Emit the .debug_loc contribution for \p Unit by copying the entries from
diff --git a/llvm/include/llvm/DWARFLinker/DWARFStreamer.h b/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
index 3bc3f454361e5..3ff5fdac3b7a0 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
@@ -137,7 +137,7 @@ class DwarfStreamer : public DwarfEmitter {
void emitCIE(StringRef CIEBytes) override;
/// Emit an FDE with data \p Bytes.
- void emitFDE(uint32_t CIEOffset, uint32_t AddreSize, uint32_t Address,
+ void emitFDE(uint32_t CIEOffset, uint32_t AddreSize, uint64_t Address,
StringRef Bytes) override;
/// Emit DWARF debug names.
diff --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp
index 0261b8fc3beb5..ee70690476b33 100644
--- a/llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -1895,7 +1895,7 @@ void DWARFLinker::patchFrameInfoForObject(const DWARFFile &File,
continue;
}
- uint32_t Loc = Data.getUnsigned(&InputOffset, AddrSize);
+ uint64_t Loc = Data.getUnsigned(&InputOffset, AddrSize);
// Some compilers seem to emit frame info that doesn't start at
// the function entry point, thus we can't just lookup the address
diff --git a/llvm/lib/DWARFLinker/DWARFStreamer.cpp b/llvm/lib/DWARFLinker/DWARFStreamer.cpp
index 2a11d311cf642..9d66c847ed25f 100644
--- a/llvm/lib/DWARFLinker/DWARFStreamer.cpp
+++ b/llvm/lib/DWARFLinker/DWARFStreamer.cpp
@@ -796,7 +796,7 @@ void DwarfStreamer::emitCIE(StringRef CIEBytes) {
/// contains the FDE data without the length, CIE offset and address
/// which will be replaced with the parameter values.
void DwarfStreamer::emitFDE(uint32_t CIEOffset, uint32_t AddrSize,
- uint32_t Address, StringRef FDEBytes) {
+ uint64_t Address, StringRef FDEBytes) {
MS->switchSection(MC->getObjectFileInfo()->getDwarfFrameSection());
MS->emitIntValue(FDEBytes.size() + 4 + AddrSize, 4);
More information about the llvm-commits
mailing list