Skip to content

Commit 10539ec

Browse files
aarzilliavl-llvm
authored andcommitted
[dsymutil] fix accidental 32bit truncation in patchFrameInfoForObject
patchFrameInfoForObject accidentally truncates FDE addresses to the least significant 32bits, which causes the Go bug: golang/go#25841. Patch by Alessandro Arzilli Differential Revision: https://reviews.llvm.org/D138763
1 parent 09c5aab commit 10539ec

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

llvm/include/llvm/DWARFLinker/DWARFLinker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ class DwarfEmitter {
153153
virtual void emitCIE(StringRef CIEBytes) = 0;
154154

155155
/// Emit an FDE with data \p Bytes.
156-
virtual void emitFDE(uint32_t CIEOffset, uint32_t AddreSize, uint32_t Address,
156+
virtual void emitFDE(uint32_t CIEOffset, uint32_t AddreSize, uint64_t Address,
157157
StringRef Bytes) = 0;
158158

159159
/// Emit the .debug_loc contribution for \p Unit by copying the entries from

llvm/include/llvm/DWARFLinker/DWARFStreamer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class DwarfStreamer : public DwarfEmitter {
137137
void emitCIE(StringRef CIEBytes) override;
138138

139139
/// Emit an FDE with data \p Bytes.
140-
void emitFDE(uint32_t CIEOffset, uint32_t AddreSize, uint32_t Address,
140+
void emitFDE(uint32_t CIEOffset, uint32_t AddreSize, uint64_t Address,
141141
StringRef Bytes) override;
142142

143143
/// Emit DWARF debug names.

llvm/lib/DWARFLinker/DWARFLinker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,7 @@ void DWARFLinker::patchFrameInfoForObject(const DWARFFile &File,
18951895
continue;
18961896
}
18971897

1898-
uint32_t Loc = Data.getUnsigned(&InputOffset, AddrSize);
1898+
uint64_t Loc = Data.getUnsigned(&InputOffset, AddrSize);
18991899

19001900
// Some compilers seem to emit frame info that doesn't start at
19011901
// the function entry point, thus we can't just lookup the address

llvm/lib/DWARFLinker/DWARFStreamer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ void DwarfStreamer::emitCIE(StringRef CIEBytes) {
796796
/// contains the FDE data without the length, CIE offset and address
797797
/// which will be replaced with the parameter values.
798798
void DwarfStreamer::emitFDE(uint32_t CIEOffset, uint32_t AddrSize,
799-
uint32_t Address, StringRef FDEBytes) {
799+
uint64_t Address, StringRef FDEBytes) {
800800
MS->switchSection(MC->getObjectFileInfo()->getDwarfFrameSection());
801801

802802
MS->emitIntValue(FDEBytes.size() + 4 + AddrSize, 4);

0 commit comments

Comments
 (0)