Skip to content

Commit 76e02b6

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-next
2 parents 9da051c + 9de4f60 commit 76e02b6

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

include/swift/SwiftRemoteMirror/SwiftRemoteMirror.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
extern "C" {
3838
#endif
3939

40-
SWIFT_REMOTE_MIRROR_LINKAGE
40+
SWIFT_REMOTE_MIRROR_LINKAGE __attribute__((__weak_import__))
4141
extern unsigned long long swift_reflection_classIsSwiftMask;
4242

4343
/// Get the metadata version supported by the Remote Mirror library.

stdlib/public/SwiftRemoteMirror/SwiftRemoteMirror.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
#define SWIFT_CLASS_IS_SWIFT_MASK swift_reflection_classIsSwiftMask
1616
extern "C" {
17-
SWIFT_REMOTE_MIRROR_LINKAGE
17+
SWIFT_REMOTE_MIRROR_LINKAGE __attribute__((__weak_import__))
1818
unsigned long long swift_reflection_classIsSwiftMask = 2;
1919
}
2020

stdlib/tools/swift-reflection-test/swift-reflection-test.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,10 @@ int main(int argc, char *argv[]) {
576576

577577
const char *BinaryFilename = argv[1];
578578

579-
swift_reflection_classIsSwiftMask = computeClassIsSwiftMask();
579+
// swift_reflection_classIsSwiftMask is weak linked so we can work
580+
// with older Remote Mirror dylibs.
581+
if (&swift_reflection_classIsSwiftMask != NULL)
582+
swift_reflection_classIsSwiftMask = computeClassIsSwiftMask();
580583

581584
uint16_t Version = swift_reflection_getSupportedMetadataVersion();
582585
printf("Metadata version: %u\n", Version);

utils/remote-run

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,19 @@ class CommandRunner(object):
9494
sys.exit(sftp_proc.returncode)
9595

9696
class RemoteCommandRunner(CommandRunner):
97-
def __init__(self, host, identity_path, ssh_options):
97+
def __init__(self, host, identity_path, ssh_options, config_file):
9898
if ':' in host:
9999
(self.remote_host, self.port) = host.rsplit(':', 1)
100100
else:
101101
self.remote_host = host
102102
self.port = None
103103
self.identity_path = identity_path
104104
self.ssh_options = ssh_options
105+
self.config_file = config_file
105106

106107
def common_options(self, port_flag):
107108
port_option = [port_flag, self.port] if self.port else []
109+
config_option = ['-F', self.config_file] if self.config_file else []
108110
identity_option = (
109111
['-i', self.identity_path] if self.identity_path else [])
110112
# Interleave '-o' with each custom option.
@@ -113,7 +115,7 @@ class RemoteCommandRunner(CommandRunner):
113115
# https://spapas.github.io/2016/04/27/python-nested-list-comprehensions/
114116
extra_options = [arg for option in self.ssh_options
115117
for arg in ["-o", option]]
116-
return port_option + identity_option + extra_options
118+
return port_option + identity_option + config_option + extra_options
117119

118120
def remote_invocation(self, command):
119121
return (['/usr/bin/ssh', '-n'] +
@@ -172,6 +174,8 @@ def main():
172174

173175
parser.add_argument('-i', '--identity', dest='identity', metavar='FILE',
174176
help='an SSH identity file (private key) to use')
177+
parser.add_argument('-F', '--config-file', dest='config_file', metavar='FILE',
178+
help='an SSH configuration file')
175179
parser.add_argument('-o', '--ssh-option', action='append', default=[],
176180
dest='ssh_options', metavar='OPTION',
177181
help='extra SSH config options (man ssh_config)')
@@ -192,7 +196,10 @@ def main():
192196
args.command.insert(0, args.host)
193197
del args.host
194198
else:
195-
runner = RemoteCommandRunner(args.host, args.identity, args.ssh_options)
199+
runner = RemoteCommandRunner(args.host,
200+
args.identity,
201+
args.ssh_options,
202+
args.config_file)
196203
runner.dry_run = args.dry_run
197204
runner.verbose = args.verbose or args.dry_run
198205

0 commit comments

Comments
 (0)