Skip to content
Draft
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
18 changes: 13 additions & 5 deletions crosstool/cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1059,11 +1059,6 @@ please file an issue at https://github.com/bazelbuild/apple_support/issues/new
),
],
),
flag_set(
actions = _DYNAMIC_LINK_ACTIONS,
flag_groups = [flag_group(flags = ["-dead_strip"])],
with_features = [with_feature_set(features = ["opt"])],
),
],
)

Expand Down Expand Up @@ -2077,6 +2072,18 @@ please file an issue at https://github.com/bazelbuild/apple_support/issues/new
],
)

dead_strip_opt_feature = feature(
name = "dead_strip_opt",
enabled = True,
flag_sets = [
flag_set(
actions = _DYNAMIC_LINK_ACTIONS,
flag_groups = [flag_group(flags = ["-dead_strip"])],
with_features = [with_feature_set(features = ["opt"])],
),
],
)

oso_prefix_feature = feature(
name = "oso_prefix_is_pwd",
enabled = True,
Expand Down Expand Up @@ -2582,6 +2589,7 @@ please file an issue at https://github.com/bazelbuild/apple_support/issues/new
default_link_flags_feature,
no_deduplicate_feature,
dead_strip_feature,
dead_strip_opt_feature,
apply_implicit_frameworks_feature,
link_cocoa_feature,
apply_simulator_compiler_flags_feature,
Expand Down
26 changes: 26 additions & 0 deletions test/linking_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ opt_test = make_action_command_line_test_rule(
},
)

opt_dead_strip_disabled_test = make_action_command_line_test_rule(
config_settings = {
"//command_line_option:compilation_mode": "opt",
"//command_line_option:features": [
"-dead_strip_opt",
],
},
)

dead_strip_requested_test = make_action_command_line_test_rule(
config_settings = {
"//command_line_option:compilation_mode": "fastbuild",
Expand Down Expand Up @@ -76,6 +85,23 @@ def linking_test_suite(name):
target_under_test = "//test/test_data:macos_binary",
)

opt_dead_strip_disabled_test(
name = "{}_opt_dead_strip_disabled_test".format(name),
tags = [name],
expected_argv = [
"-Xlinker",
"-objc_abi_version",
"-Xlinker",
"2",
"-ObjC",
],
not_expected_argv = [
"-dead_strip",
],
mnemonic = "ObjcLink",
target_under_test = "//test/test_data:macos_binary",
)

dead_strip_requested_test(
name = "{}_dead_strip_requested_test".format(name),
tags = [name],
Expand Down