Skip to content

[RemoteMirrors] Fix losing the remote address on StaticMirror #82981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion include/swift/StaticMirror/ObjectFileContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ class Image {
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;

Expand Down
7 changes: 6 additions & 1 deletion lib/StaticMirror/ObjectFileContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,13 @@ remote::RemoteAbsolutePointer Image::getDynamicSymbol(uint64_t Addr) const {
auto found = DynamicRelocations.find(Addr);
if (found == DynamicRelocations.end())
return nullptr;
if (!found->second.Symbol.empty())
return remote::RemoteAbsolutePointer(found->second.Symbol,
found->second.OffsetOrAddress,
remote::RemoteAddress());
return remote::RemoteAbsolutePointer(
found->second.Symbol, found->second.Offset, remote::RemoteAddress());
remote::RemoteAddress(found->second.OffsetOrAddress,
remote::RemoteAddress::DefaultAddressSpace));
}

std::pair<const Image *, uint64_t>
Expand Down
1 change: 0 additions & 1 deletion test/Reflection/conformance_descriptors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//
// Temporarily disable on AArch64 Linux (rdar://88451721)
// UNSUPPORTED: OS=linux-gnu && CPU=aarch64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this marked as unsupported on Linux?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That one seems unrelated to this change.

Copy link
Member

@finagolfin finagolfin Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// XFAIL: OS=linux-android

// rdar://100558042
// UNSUPPORTED: CPU=arm64e
Expand Down
1 change: 0 additions & 1 deletion test/Reflection/typeref_decoding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

// FIXME: rdar://127796117
// UNSUPPORTED: OS=linux-gnu && CPU=aarch64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this marked as unsupported on Linux?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same passing claim as above, can probably be checked by enabling them and running the linux AArch64 CI on this pull.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I removed it, lets see if it works

// XFAIL: OS=linux-android

// 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)
// 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
Expand Down