Add objc_execution to all link actions

Copybara Import from https://github.com/bazelbuild/rules_cc/pull/359

BEGIN_PUBLIC
Add objc_execution to all link actions (#359)

Without this it's not possible to create a rules based toolchain that
supports linking top level binaries which are linked through the Apple
specific bazel APIs.

Closes #359
END_PUBLIC

COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_cc/pull/359 from keith:ks/add-objc_execution-to-all-link-actions 1904f39e568e10e25b88bfac2688590aec44a0f5
PiperOrigin-RevId: 733231767
Change-Id: Ib8976fc00586a40f017cd86df276797a34996665
diff --git a/cc/action_names.bzl b/cc/action_names.bzl
index bb6c85e..234e1cc 100644
--- a/cc/action_names.bzl
+++ b/cc/action_names.bzl
@@ -164,6 +164,7 @@
     ACTION_NAMES.lto_index_for_executable,
     ACTION_NAMES.lto_index_for_dynamic_library,
     ACTION_NAMES.lto_index_for_nodeps_dynamic_library,
+    ACTION_NAMES.objc_executable,
 ]
 
 # Names of actions that link entire programs.
@@ -193,6 +194,7 @@
     ACTION_NAMES.cpp_link_dynamic_library,
     ACTION_NAMES.lto_index_for_executable,
     ACTION_NAMES.lto_index_for_dynamic_library,
+    ACTION_NAMES.objc_executable,
 ]
 
 ACTION_NAME_GROUPS = struct(
diff --git a/cc/toolchains/actions/BUILD b/cc/toolchains/actions/BUILD
index 1c771ea..3dabfab 100644
--- a/cc/toolchains/actions/BUILD
+++ b/cc/toolchains/actions/BUILD
@@ -254,6 +254,7 @@
     actions = [
         ":cpp_link_executable",
         ":lto_index_for_executable",
+        ":objc_executable",
     ],
 )
 
@@ -281,6 +282,7 @@
         ":cpp_link_dynamic_library",
         ":lto_index_for_executable",
         ":lto_index_for_dynamic_library",
+        ":objc_executable",
     ],
 )
 
diff --git a/tests/rule_based_toolchain/legacy_features_as_args/goldens/macos/force_pic_flags.textproto b/tests/rule_based_toolchain/legacy_features_as_args/goldens/macos/force_pic_flags.textproto
index c18413b..eac77a6 100644
--- a/tests/rule_based_toolchain/legacy_features_as_args/goldens/macos/force_pic_flags.textproto
+++ b/tests/rule_based_toolchain/legacy_features_as_args/goldens/macos/force_pic_flags.textproto
@@ -2,6 +2,7 @@
 flag_sets {
   actions: "c++-link-executable"
   actions: "lto-index-for-executable"
+  actions: "objc-executable"
   flag_groups {
     expand_if_available: "force_pic"
     flags: "-Wl,-pie"
diff --git a/tests/rule_based_toolchain/legacy_features_as_args/goldens/macos/libraries_to_link.textproto b/tests/rule_based_toolchain/legacy_features_as_args/goldens/macos/libraries_to_link.textproto
index 7144d7f..95e4473 100644
--- a/tests/rule_based_toolchain/legacy_features_as_args/goldens/macos/libraries_to_link.textproto
+++ b/tests/rule_based_toolchain/legacy_features_as_args/goldens/macos/libraries_to_link.textproto
@@ -6,6 +6,7 @@
   actions: "lto-index-for-dynamic-library"
   actions: "lto-index-for-executable"
   actions: "lto-index-for-nodeps-dynamic-library"
+  actions: "objc-executable"
   flag_groups {
     flag_groups {
       expand_if_available: "thinlto_param_file"
diff --git a/tests/rule_based_toolchain/legacy_features_as_args/goldens/macos/runtime_library_search_directories.textproto b/tests/rule_based_toolchain/legacy_features_as_args/goldens/macos/runtime_library_search_directories.textproto
index 520de8e..4cfcc00 100644
--- a/tests/rule_based_toolchain/legacy_features_as_args/goldens/macos/runtime_library_search_directories.textproto
+++ b/tests/rule_based_toolchain/legacy_features_as_args/goldens/macos/runtime_library_search_directories.textproto
@@ -6,6 +6,7 @@
   actions: "lto-index-for-dynamic-library"
   actions: "lto-index-for-executable"
   actions: "lto-index-for-nodeps-dynamic-library"
+  actions: "objc-executable"
   flag_groups {
     expand_if_available: "runtime_library_search_directories"
     flag_groups {
@@ -37,6 +38,7 @@
   actions: "lto-index-for-dynamic-library"
   actions: "lto-index-for-executable"
   actions: "lto-index-for-nodeps-dynamic-library"
+  actions: "objc-executable"
   flag_groups {
     expand_if_available: "runtime_library_search_directories"
     flag_groups {
diff --git a/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/force_pic_flags.textproto b/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/force_pic_flags.textproto
index d8e2ebf..82e233f 100644
--- a/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/force_pic_flags.textproto
+++ b/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/force_pic_flags.textproto
@@ -2,6 +2,7 @@
 flag_sets {
   actions: "c++-link-executable"
   actions: "lto-index-for-executable"
+  actions: "objc-executable"
   flag_groups {
     expand_if_available: "force_pic"
     flags: "-pie"
diff --git a/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/libraries_to_link.textproto b/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/libraries_to_link.textproto
index 80f0562..0661a24 100644
--- a/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/libraries_to_link.textproto
+++ b/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/libraries_to_link.textproto
@@ -6,6 +6,7 @@
   actions: "lto-index-for-dynamic-library"
   actions: "lto-index-for-executable"
   actions: "lto-index-for-nodeps-dynamic-library"
+  actions: "objc-executable"
   flag_groups {
     flag_groups {
       expand_if_available: "thinlto_param_file"
diff --git a/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/linker_param_file.textproto b/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/linker_param_file.textproto
index d20b60b..84a71e0 100644
--- a/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/linker_param_file.textproto
+++ b/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/linker_param_file.textproto
@@ -7,6 +7,7 @@
   actions: "lto-index-for-dynamic-library"
   actions: "lto-index-for-executable"
   actions: "lto-index-for-nodeps-dynamic-library"
+  actions: "objc-executable"
   flag_groups {
     expand_if_available: "linker_param_file"
     flags: "@%{linker_param_file}"
diff --git a/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/runtime_library_search_directories.textproto b/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/runtime_library_search_directories.textproto
index 8618b47..fdaf296 100644
--- a/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/runtime_library_search_directories.textproto
+++ b/tests/rule_based_toolchain/legacy_features_as_args/goldens/unix/runtime_library_search_directories.textproto
@@ -6,6 +6,7 @@
   actions: "lto-index-for-dynamic-library"
   actions: "lto-index-for-executable"
   actions: "lto-index-for-nodeps-dynamic-library"
+  actions: "objc-executable"
   flag_groups {
     expand_if_available: "runtime_library_search_directories"
     flag_groups {
@@ -37,6 +38,7 @@
   actions: "lto-index-for-dynamic-library"
   actions: "lto-index-for-executable"
   actions: "lto-index-for-nodeps-dynamic-library"
+  actions: "objc-executable"
   flag_groups {
     expand_if_available: "runtime_library_search_directories"
     flag_groups {