Skip to content

Commit 17bb478

Browse files
Merge pull request #5329 from swiftwasm/release/5.8
[pull] swiftwasm-release/5.8 from release/5.8
2 parents c49fe19 + c4a0c8e commit 17bb478

File tree

7 files changed

+22
-117
lines changed

7 files changed

+22
-117
lines changed

include/swift/AST/DiagnosticsDriver.def

+3
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ ERROR(cannot_find_migration_script, none,
162162
ERROR(error_darwin_static_stdlib_not_supported, none,
163163
"-static-stdlib is no longer supported on Apple platforms", ())
164164

165+
WARNING(warn_darwin_link_objc_deprecated, none,
166+
"-link-objc-runtime is no longer supported on Apple platforms", ())
167+
165168
ERROR(error_darwin_only_supports_libcxx, none,
166169
"The only C++ standard library supported on Apple platforms is libc++",
167170
())

include/swift/Option/Options.td

+5-2
Original file line numberDiff line numberDiff line change
@@ -805,11 +805,14 @@ def L_EQ : Joined<["-"], "L=">, Group<linker_option_Group>,
805805
Flags<[FrontendOption, DoesNotAffectIncrementalBuild, ArgumentIsPath]>,
806806
Alias<L>;
807807

808+
// Accept but ignore these flags. They were once used to control
809+
// linking of arclite, which is no longer used on Darwin.
808810
def link_objc_runtime : Flag<["-"], "link-objc-runtime">,
809-
Flags<[DoesNotAffectIncrementalBuild]>;
811+
Flags<[DoesNotAffectIncrementalBuild]>,
812+
HelpText<"Deprecated">;
810813
def no_link_objc_runtime : Flag<["-"], "no-link-objc-runtime">,
811814
Flags<[HelpHidden, DoesNotAffectIncrementalBuild]>,
812-
HelpText<"Don't link in additions to the Objective-C runtime">;
815+
HelpText<"Deprecated">;
813816

814817
def static_stdlib: Flag<["-"], "static-stdlib">,
815818
Flags<[DoesNotAffectIncrementalBuild]>,

lib/Driver/DarwinToolChains.cpp

+6-91
Original file line numberDiff line numberDiff line change
@@ -221,27 +221,6 @@ static void addVersionString(const ArgList &inputArgs, ArgStringList &arguments,
221221
arguments.push_back(inputArgs.MakeArgString(os.str()));
222222
}
223223

224-
/// Returns true if the compiler depends on features provided by the ObjC
225-
/// runtime that are not present on the deployment target indicated by
226-
/// \p triple.
227-
static bool wantsObjCRuntime(const llvm::Triple &triple) {
228-
assert((!triple.isTvOS() || triple.isiOS()) &&
229-
"tvOS is considered a kind of iOS");
230-
231-
// When updating the versions listed here, please record the most recent
232-
// feature being depended on and when it was introduced:
233-
//
234-
// - Make assigning 'nil' to an NSMutableDictionary subscript delete the
235-
// entry, like it does for Swift.Dictionary, rather than trap.
236-
if (triple.isiOS())
237-
return triple.isOSVersionLT(9);
238-
if (triple.isMacOSX())
239-
return triple.isMacOSXVersionLT(10, 11);
240-
if (triple.isWatchOS())
241-
return false;
242-
llvm_unreachable("unknown Darwin OS");
243-
}
244-
245224
void
246225
toolchains::Darwin::addLinkerInputArgs(InvocationInfo &II,
247226
const JobContext &context) const {
@@ -278,48 +257,6 @@ toolchains::Darwin::addLinkerInputArgs(InvocationInfo &II,
278257
file_types::TY_SwiftModuleFile, "-add_ast_path");
279258
}
280259

281-
static void findARCLiteLibPath(const toolchains::Darwin &TC,
282-
llvm::SmallVectorImpl<char> &ARCLiteLib) {
283-
auto& D = TC.getDriver();
284-
llvm::sys::path::append(ARCLiteLib, D.getSwiftProgramPath());
285-
286-
llvm::sys::path::remove_filename(ARCLiteLib); // 'swift'
287-
llvm::sys::path::remove_filename(ARCLiteLib); // 'bin'
288-
llvm::sys::path::append(ARCLiteLib, "lib", "arc");
289-
290-
if (!llvm::sys::fs::is_directory(ARCLiteLib)) {
291-
// If we don't have a 'lib/arc/' directory, find the "arclite" library
292-
// relative to the Clang in the active Xcode.
293-
ARCLiteLib.clear();
294-
findXcodeClangLibPath("arc", ARCLiteLib);
295-
}
296-
}
297-
298-
void
299-
toolchains::Darwin::addArgsToLinkARCLite(ArgStringList &Arguments,
300-
const JobContext &context) const {
301-
if (!context.Args.hasFlag(options::OPT_link_objc_runtime,
302-
options::OPT_no_link_objc_runtime,
303-
/*Default=*/wantsObjCRuntime(getTriple())))
304-
return;
305-
306-
llvm::SmallString<128> ARCLiteLib;
307-
findARCLiteLibPath(*this, ARCLiteLib);
308-
309-
if (!ARCLiteLib.empty()) {
310-
llvm::sys::path::append(ARCLiteLib, "libarclite_");
311-
ARCLiteLib += getPlatformNameForTriple(getTriple());
312-
ARCLiteLib += ".a";
313-
314-
Arguments.push_back("-force_load");
315-
Arguments.push_back(context.Args.MakeArgString(ARCLiteLib));
316-
317-
// Arclite depends on CoreFoundation.
318-
Arguments.push_back("-framework");
319-
Arguments.push_back("CoreFoundation");
320-
}
321-
}
322-
323260
void toolchains::Darwin::addLTOLibArgs(ArgStringList &Arguments,
324261
const JobContext &context) const {
325262
if (!context.OI.LibLTOPath.empty()) {
@@ -741,8 +678,6 @@ toolchains::Darwin::constructInvocation(const DynamicLinkJobAction &job,
741678
if (llvm::sys::fs::exists(CompilerRTPath))
742679
Arguments.push_back(context.Args.MakeArgString(CompilerRTPath));
743680

744-
addArgsToLinkARCLite(Arguments, context);
745-
746681
if (job.shouldPerformLTO()) {
747682
addLTOLibArgs(Arguments, context);
748683
}
@@ -857,23 +792,6 @@ std::string toolchains::Darwin::getGlobalDebugPathRemapping() const {
857792
return {};
858793
}
859794

860-
static void validateLinkObjcRuntimeARCLiteLib(const toolchains::Darwin &TC,
861-
DiagnosticEngine &diags,
862-
const llvm::opt::ArgList &args) {
863-
auto Triple = TC.getTriple();
864-
if (args.hasFlag(options::OPT_link_objc_runtime,
865-
options::OPT_no_link_objc_runtime,
866-
/*Default=*/wantsObjCRuntime(Triple))) {
867-
llvm::SmallString<128> ARCLiteLib;
868-
findARCLiteLibPath(TC, ARCLiteLib);
869-
870-
if (ARCLiteLib.empty()) {
871-
diags.diagnose(SourceLoc(),
872-
diag::warn_arclite_not_found_when_link_objc_runtime);
873-
}
874-
}
875-
}
876-
877795
static void validateDeploymentTarget(const toolchains::Darwin &TC,
878796
DiagnosticEngine &diags,
879797
const llvm::opt::ArgList &args) {
@@ -927,15 +845,6 @@ void
927845
toolchains::Darwin::validateArguments(DiagnosticEngine &diags,
928846
const llvm::opt::ArgList &args,
929847
StringRef defaultTarget) const {
930-
if (!getDriver().isDummyDriverForFrontendInvocation()) {
931-
// Validating arclite library path when link-objc-runtime.
932-
// If the driver is just set up to retrieve the swift-frontend invocation,
933-
// we don't care about link-time, so we can skip this step, which may be
934-
// expensive since it might call to `xcrun` to find `clang` and `arclite`
935-
// relative to `clang`.
936-
validateLinkObjcRuntimeARCLiteLib(*this, diags, args);
937-
}
938-
939848
// Validating apple platforms deployment targets.
940849
validateDeploymentTarget(*this, diags, args);
941850
validateTargetVariant(*this, diags, args, defaultTarget);
@@ -945,6 +854,12 @@ toolchains::Darwin::validateArguments(DiagnosticEngine &diags,
945854
diags.diagnose(SourceLoc(), diag::error_darwin_static_stdlib_not_supported);
946855
}
947856

857+
// Validating darwin deprecated -link-objc-runtime.
858+
if (args.hasArg(options::OPT_link_objc_runtime,
859+
options::OPT_no_link_objc_runtime)) {
860+
diags.diagnose(SourceLoc(), diag::warn_darwin_link_objc_deprecated);
861+
}
862+
948863
// If a C++ standard library is specified, it has to be libc++.
949864
if (auto arg = args.getLastArg(options::OPT_experimental_cxx_stdlib)) {
950865
if (StringRef(arg->getValue()) != "libc++") {

lib/Driver/ToolChains.h

-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ class LLVM_LIBRARY_VISIBILITY Darwin : public ToolChain {
3131
void addLinkerInputArgs(InvocationInfo &II,
3232
const JobContext &context) const;
3333

34-
void addArgsToLinkARCLite(llvm::opt::ArgStringList &Arguments,
35-
const JobContext &context) const;
36-
3734
void addSanitizerArgs(llvm::opt::ArgStringList &Arguments,
3835
const DynamicLinkJobAction &job,
3936
const JobContext &context) const;

test/Driver/linker-arclite.swift

+2-19
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,14 @@
22
// Note: This is really about the /host/ environment, but since there are RUN
33
// lines for multiple targets anyway it doesn't make a huge difference.
44

5-
// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.9 %S/../Inputs/empty.swift | %FileCheck %s
6-
7-
// CHECK: bin/ld{{"? }}
8-
// CHECK-SAME: -force_load {{[^ ]+/lib/arc/libarclite_macosx.a}} -framework CoreFoundation
9-
// CHECK-SAME: -o {{[^ ]+}}
10-
11-
12-
// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-ios8.0-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix IOS_ARCLITE %s
13-
14-
// IOS_ARCLITE: bin/ld{{"? }}
15-
// IOS_ARCLITE: -force_load {{[^ ]+/lib/arc/libarclite_iphonesimulator.a}}
16-
// IOS_ARCLITE: -o {{[^ ]+}}
17-
5+
// The libarclite library is no longer used for any Darwin platform, so this now just verifies that we never request it
186

197
// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.11 %S/../Inputs/empty.swift | %FileCheck -check-prefix NO_ARCLITE %s
20-
// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-macosx10.10 %S/../Inputs/empty.swift | %FileCheck -check-prefix ANY_ARCLITE %s
218
// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-ios9-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix NO_ARCLITE %s
22-
// RUN: %swiftc_driver -driver-print-jobs -target x86_64-apple-ios8-simulator %S/../Inputs/empty.swift | %FileCheck -check-prefix ANY_ARCLITE %s
239
// RUN: %swiftc_driver -driver-print-jobs -target arm64-apple-tvos9 %S/../Inputs/empty.swift | %FileCheck -check-prefix NO_ARCLITE %s
2410
// RUN: %swiftc_driver -driver-print-jobs -target armv7k-apple-watchos2 %S/../Inputs/empty.swift | %FileCheck -check-prefix NO_ARCLITE %s
2511

2612
// NO_ARCLITE: bin/ld{{"? }}
2713
// NO_ARCLITE-NOT: arclite
14+
// NO_ARCLITE-NOT: CoreFoundation
2815
// NO_ARCLITE: -o {{[^ ]+}}
29-
30-
// ANY_ARCLITE: bin/ld{{"? }}
31-
// ANY_ARCLITE: -force_load {{[^ ]+}}/lib/arc/libarclite_{{.+}}.a
32-
// ANY_ARCLITE: -o {{[^ ]+}}

test/Driver/options-apple.swift

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// REQUIRES: swift_interpreter
2+
// REQUIRES: OS=macosx
3+
4+
// RUN: %swift_driver -link-objc-runtime %s 2>&1 | %FileCheck -check-prefix LINK_OBJC_RUNTIME_WARNING %s
5+
// RUN: %swift_driver -no-link-objc-runtime %s 2>&1 | %FileCheck -check-prefix LINK_OBJC_RUNTIME_WARNING %s
6+
// LINK_OBJC_RUNTIME_WARNING: warning: -link-objc-runtime is no longer supported on Apple platforms

test/Driver/options-interpreter.swift

-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
// CHECK-L2: # DYLD_LIBRARY_PATH={{/foo/:/bar/:[^:]+/lib/swift/macosx$}}
2929

3030
// RUN: env DYLD_LIBRARY_PATH=/abc/ SDKROOT=/sdkroot %swift_driver_plain -### -target x86_64-apple-macosx10.9 -L/foo/ -L/bar/ %s 2>&1 | %FileCheck -check-prefix=CHECK-L2-ENV %s
31-
// CHECK-L2-ENV: warning: unable to find Objective-C runtime support library 'arclite'; pass '-no-link-objc-runtime' to silence this warning
3231
// CHECK-L2-ENV: # DYLD_LIBRARY_PATH={{/foo/:/bar/:[^:]+/lib/swift/macosx:/sdkroot/usr/lib/swift:/abc/$}}
3332

3433
// RUN: %swift_driver_plain -### -target x86_64-apple-macosx10.9 %s | %FileCheck -check-prefix=CHECK-NO-FRAMEWORKS %s
@@ -53,7 +52,6 @@
5352
// CHECK-F2-ENV: DYLD_FRAMEWORK_PATH=/foo/:/bar/:/abc/{{$}}
5453

5554
// RUN: env DYLD_FRAMEWORK_PATH=/abc/ SDKROOT=/sdkroot %swift_driver_plain -### -target x86_64-apple-macosx10.9 -F/foo/ -F/bar/ -L/foo2/ -L/bar2/ %s 2>&1 | %FileCheck -check-prefix=CHECK-COMPLEX %s
56-
// CHECK-COMPLEX: warning: unable to find Objective-C runtime support library 'arclite'; pass '-no-link-objc-runtime' to silence this warning
5755
// CHECK-COMPLEX: -F /foo/
5856
// CHECK-COMPLEX: -F /bar/
5957
// CHECK-COMPLEX: #

0 commit comments

Comments
 (0)