Skip to content

Commit 932a615

Browse files
committed
[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. (cherry picked from commit 3c331fc)
1 parent bfb026c commit 932a615

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

include/swift/StaticMirror/ObjectFileContext.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ class Image {
3939
uint64_t HeaderAddress;
4040
std::vector<Segment> Segments;
4141
struct DynamicRelocation {
42+
/// The symbol name that the pointer refers to. Empty if only an absolute
43+
/// address is available.
4244
StringRef Symbol;
45+
// The offset (if the symbol is available), or the resolved remote address
46+
// if the symbol is empty.
4347
uint64_t Offset;
4448
};
4549
llvm::DenseMap<uint64_t, DynamicRelocation> DynamicRelocations;

lib/StaticMirror/ObjectFileContext.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,11 @@ remote::RemoteAbsolutePointer Image::getDynamicSymbol(uint64_t Addr) const {
332332
auto found = DynamicRelocations.find(Addr);
333333
if (found == DynamicRelocations.end())
334334
return nullptr;
335-
return remote::RemoteAbsolutePointer(found->second.Symbol,
336-
found->second.Offset,
337-
remote::RemoteAddress((uint64_t)0));
335+
if (!found->second.Symbol.empty())
336+
return remote::RemoteAbsolutePointer(
337+
found->second.Symbol, found->second.Offset, remote::RemoteAddress());
338+
return remote::RemoteAbsolutePointer(remote::RemoteAddress(
339+
found->second.Offset, remote::RemoteAddress::DefaultAddressSpace));
338340
}
339341

340342
std::pair<const Image *, uint64_t>

test/Reflection/conformance_descriptors.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
//
33
// LC_DYLD_CHAINED_FIXUPS decode not currently supported (default on visionOS)
44
// UNSUPPORTED: OS=xros
5-
//
6-
// Temporarily disable on AArch64 Linux (rdar://88451721)
7-
// UNSUPPORTED: OS=linux-gnu && CPU=aarch64
85

96
// rdar://100558042
107
// UNSUPPORTED: CPU=arm64e

test/Reflection/typeref_decoding.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
// RUN: %empty-directory(%t)
1010

11-
// FIXME: rdar://127796117
12-
// UNSUPPORTED: OS=linux-gnu && CPU=aarch64
13-
1411
// RUN: %target-build-swift -target %target-swift-5.2-abi-triple -Xfrontend -enable-anonymous-context-mangled-names %S/Inputs/ConcreteTypes.swift %S/Inputs/GenericTypes.swift %S/Inputs/Protocols.swift %S/Inputs/Extensions.swift %S/Inputs/Closures.swift -parse-as-library -emit-module -emit-library %no-fixup-chains -module-name TypesToReflect -o %t/%target-library-name(TypesToReflect)
1512
// RUN: %target-build-swift -target %target-swift-5.2-abi-triple -Xfrontend -enable-anonymous-context-mangled-names %S/Inputs/ConcreteTypes.swift %S/Inputs/GenericTypes.swift %S/Inputs/Protocols.swift %S/Inputs/Extensions.swift %S/Inputs/Closures.swift %S/Inputs/main.swift -emit-module -emit-executable %no-fixup-chains -module-name TypesToReflect -o %t/TypesToReflect
1613

0 commit comments

Comments
 (0)