mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[RemoteMirrors] Fix losing the remote address on StaticMirror
The Offset field of a DynamicRelocation is either an offset or a remote address, but was being treated only as a remote address on getDynamicSymbol.
This commit is contained in:
@@ -39,8 +39,12 @@ private:
|
||||
uint64_t HeaderAddress;
|
||||
std::vector<Segment> Segments;
|
||||
struct DynamicRelocation {
|
||||
/// The symbol name that the pointer refers to. Empty if only an absolute
|
||||
/// address is available.
|
||||
StringRef Symbol;
|
||||
uint64_t Offset;
|
||||
// The offset (if the symbol is available), or the resolved remote address
|
||||
// if the symbol is empty.
|
||||
uint64_t OffsetOrAddress;
|
||||
};
|
||||
llvm::DenseMap<uint64_t, DynamicRelocation> DynamicRelocations;
|
||||
|
||||
|
||||
@@ -332,9 +332,13 @@ remote::RemoteAbsolutePointer Image::getDynamicSymbol(uint64_t Addr) const {
|
||||
auto found = DynamicRelocations.find(Addr);
|
||||
if (found == DynamicRelocations.end())
|
||||
return nullptr;
|
||||
return remote::RemoteAbsolutePointer(found->second.Symbol,
|
||||
found->second.Offset,
|
||||
remote::RemoteAddress((uint64_t)0));
|
||||
if (!found->second.Symbol.empty())
|
||||
return remote::RemoteAbsolutePointer(found->second.Symbol,
|
||||
found->second.OffsetOrAddress,
|
||||
remote::RemoteAddress());
|
||||
return remote::RemoteAbsolutePointer(
|
||||
remote::RemoteAddress(found->second.OffsetOrAddress,
|
||||
remote::RemoteAddress::DefaultAddressSpace));
|
||||
}
|
||||
|
||||
std::pair<const Image *, uint64_t>
|
||||
|
||||
Reference in New Issue
Block a user