Skip to content

Commit 3c331fc

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.
1 parent 8179221 commit 3c331fc

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,11 @@ remote::RemoteAbsolutePointer Image::getDynamicSymbol(uint64_t Addr) const {
333333
auto found = DynamicRelocations.find(Addr);
334334
if (found == DynamicRelocations.end())
335335
return nullptr;
336-
return remote::RemoteAbsolutePointer(
337-
found->second.Symbol, found->second.Offset, remote::RemoteAddress());
336+
if (!found->second.Symbol.empty())
337+
return remote::RemoteAbsolutePointer(
338+
found->second.Symbol, found->second.Offset, remote::RemoteAddress());
339+
return remote::RemoteAbsolutePointer(remote::RemoteAddress(
340+
found->second.Offset, remote::RemoteAddress::DefaultAddressSpace));
338341
}
339342

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

test/Reflection/conformance_descriptors.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +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
8-
// XFAIL: OS=linux-android
95

106
// rdar://100558042
117
// UNSUPPORTED: CPU=arm64e

test/Reflection/typeref_decoding.swift

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

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

11-
// FIXME: rdar://127796117
12-
// UNSUPPORTED: OS=linux-gnu && CPU=aarch64
13-
// XFAIL: OS=linux-android
14-
1511
// 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)
1612
// 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
1713

0 commit comments

Comments
 (0)