-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add back uses of
-disable-autolink-framework
for static frameworks (#…
…941) This was removed a while back because it appeared to be unused. Since then this rules_apple change: bazelbuild/rules_apple@8d84134 causes it to be slightly necessary again. The situation is that we compile Swift files with the framework search paths, but then we now link by passing the static framework binary directly to the linker, as opposed to using `-F` / `-framework`, which means any `LC_LINKER_OPTION` `-framework` uses pointing to these static frameworks are invalid. Invalid `LC_LINKER_OPTION`s are ignored by ld64 _unless_ the entire link fails, but lld and mold do not implement this workaround, so it fails the link. This also potentially helps with cases of including undeclared dependencies. Ideally we could disable autolinking all together to ensure dependencies were strict, but that requires us to manually link the various Swift support dylibs. This discovers framework names based on their search paths similar to how bazel did before the rules_apple change https://github.com/bazelbuild/bazel/blob/8bd2d97fd143b4b8a6fc96ce300820e6e422c03a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcProvider.java#L689-L697 We cannot revert the rules_apple change since theoretically that field or provider will be removed entirely in the future. This reverts commit b37a717.
- Loading branch information
Showing
5 changed files
with
80 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""Tests for validating linking behavior""" | ||
|
||
load( | ||
"@build_bazel_rules_swift//test/rules:action_command_line_test.bzl", | ||
"action_command_line_test", | ||
) | ||
|
||
def imported_framework_test_suite(name): | ||
action_command_line_test( | ||
name = "{}_disable_autolink_framework_test".format(name), | ||
expected_argv = [ | ||
"-Xfrontend -disable-autolink-framework -Xfrontend framework1", | ||
"-Xfrontend -disable-autolink-framework -Xfrontend framework2", | ||
], | ||
mnemonic = "SwiftCompile", | ||
tags = [name], | ||
target_under_test = "@build_bazel_rules_swift//test/fixtures/linking:bin", | ||
) | ||
|
||
action_command_line_test( | ||
name = "{}_duplicate_linking_args".format(name), | ||
expected_argv = [ | ||
"-framework framework1", | ||
"-framework framework2", | ||
], | ||
mnemonic = "CppLink", | ||
tags = [name], | ||
target_under_test = "@build_bazel_rules_swift//test/fixtures/linking:bin", | ||
) | ||
|
||
native.test_suite( | ||
name = name, | ||
tags = [name], | ||
) |
This file was deleted.
Oops, something went wrong.