Remove unnecessary tests from rules_cc

They are now part of the bazelbuild/bazel repository.

Copies buildifier changes contributed by Keith in https://github.com/bazelbuild/rules_cc/pull/128

RELNOTES:none
PiperOrigin-RevId: 435312636
Change-Id: I4d5d2f58d90026c0cdfb5c0a90709de7c28c6ccd
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml
index 221d4dc..6f504f6 100644
--- a/.bazelci/presubmit.yml
+++ b/.bazelci/presubmit.yml
@@ -44,21 +44,3 @@
     <<: *common
   windows:
     <<: *common
-  examples:
-    platform: ubuntu1804
-    bazel: last_green
-    build_targets:
-    - "//examples/test_cc_shared_library/..."
-    - "//examples/test_cc_shared_library/diamond_inheritance/..."
-    build_flags:
-    - "--experimental_cc_shared_library"
-    - "--experimental_link_static_libraries_once"
-    - "--experimental_enable_target_export_check"
-    test_flags:
-    - "--test_timeout=120"
-    - "--experimental_cc_shared_library"
-    - "--experimental_link_static_libraries_once"
-    - "--experimental_enable_target_export_check"
-    test_targets:
-    - "//examples/test_cc_shared_library/..."
-    - "//examples/test_cc_shared_library/diamond_inheritance/..."
diff --git a/MODULE.bazel b/MODULE.bazel
index 49d39aa..08b0c51 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -1,12 +1,13 @@
 module(
     name = "rules_cc",
-    version = "0.0.1",
     compatibility_level = 1,
     toolchains_to_register = ["@local_config_cc_toolchains//:all"],
+    version = "0.0.1",
 )
 
 bazel_dep(name = "bazel_skylib", version = "1.0.3")
 bazel_dep(name = "platforms", version = "0.0.4")
 
 cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure")
+
 use_repo(cc_configure, "local_config_cc_toolchains")
diff --git a/cc/extensions.bzl b/cc/extensions.bzl
index dba2e2a..027036f 100644
--- a/cc/extensions.bzl
+++ b/cc/extensions.bzl
@@ -15,7 +15,7 @@
 
 load("//cc/private/toolchain:cc_configure.bzl", "cc_autoconf", "cc_autoconf_toolchains")
 
-def _cc_configure_impl(ctx):
+def _cc_configure_impl(_):
     cc_autoconf_toolchains(name = "local_config_cc_toolchains")
     cc_autoconf(name = "local_config_cc")
 
diff --git a/cc/private/toolchain/unix_cc_configure.bzl b/cc/private/toolchain/unix_cc_configure.bzl
index ba992fc..a9c1cd4 100644
--- a/cc/private/toolchain/unix_cc_configure.bzl
+++ b/cc/private/toolchain/unix_cc_configure.bzl
@@ -28,16 +28,6 @@
     "write_builtin_include_directory_paths",
 )
 
-def _field(name, value):
-    """Returns properly indented top level crosstool field."""
-    if type(value) == "list":
-        return "\n".join(["  " + name + ": '" + v + "'" for v in value])
-    elif type(value) == "string":
-        return "  " + name + ": '" + value + "'"
-    else:
-        auto_configure_fail("Unexpected field type: " + type(value))
-        return ""
-
 def _uniq(iterable):
     """Remove duplicates from a list."""
 
@@ -65,15 +55,6 @@
         return escape_string(path[len(repo_root):])
     return escape_string(path)
 
-def _get_value(it):
-    """Convert `it` in serialized protobuf format."""
-    if type(it) == "int":
-        return str(it)
-    elif type(it) == "bool":
-        return "true" if it else "false"
-    else:
-        return "\"%s\"" % it
-
 def _find_tool(repository_ctx, tool, overriden_tools):
     """Find a tool for repository, taking overriden tools into account."""
     if tool in overriden_tools:
diff --git a/cc/private/toolchain/unix_cc_toolchain_config.bzl b/cc/private/toolchain/unix_cc_toolchain_config.bzl
index fa15f22..4325a68 100644
--- a/cc/private/toolchain/unix_cc_toolchain_config.bzl
+++ b/cc/private/toolchain/unix_cc_toolchain_config.bzl
@@ -950,7 +950,6 @@
         ],
     )
 
-    dynamic_library_linker_tool_path = tool_paths
     dynamic_library_linker_tool_feature = feature(
         name = "dynamic_library_linker_tool",
         flag_sets = [
@@ -1114,6 +1113,8 @@
             strip_debug_symbols_feature,
             coverage_feature,
             supports_pic_feature,
+            gcc_coverage_map_format_feature,
+            llvm_coverage_map_format_feature,
         ] + (
             [
                 supports_start_end_lib_feature,
@@ -1150,6 +1151,8 @@
             user_compile_flags_feature,
             sysroot_feature,
             unfiltered_compile_flags_feature,
+            gcc_coverage_map_format_feature,
+            llvm_coverage_map_format_feature,
         ]
 
     return cc_common.create_cc_toolchain_config_info(
diff --git a/cc/private/toolchain/windows_cc_toolchain_config.bzl b/cc/private/toolchain/windows_cc_toolchain_config.bzl
index cff3fa3..7fa2978 100644
--- a/cc/private/toolchain/windows_cc_toolchain_config.bzl
+++ b/cc/private/toolchain/windows_cc_toolchain_config.bzl
@@ -1276,6 +1276,7 @@
                 copy_dynamic_libraries_to_binary_feature,
                 gcc_env_feature,
                 supports_pic_feature,
+                supports_start_end_lib_feature,
                 default_compile_flags_feature,
                 default_link_flags_feature,
                 fdo_optimize_feature,
diff --git a/examples/experimental_cc_shared_library.bzl b/examples/experimental_cc_shared_library.bzl
index 5a37eaa..e327bb8 100644
--- a/examples/experimental_cc_shared_library.bzl
+++ b/examples/experimental_cc_shared_library.bzl
@@ -46,32 +46,3 @@
 
 def cc_shared_library(**kwargs):
     native.cc_shared_library(**kwargs)
-
-# TODO(bazel-team): Everything below this line can be deleted when tests have
-# been moved under bazel repo
-def _check_if_target_under_path(value, pattern):
-    if pattern.workspace_name != value.workspace_name:
-        return False
-    if pattern.name == "__pkg__":
-        return pattern.package == value.package
-    if pattern.name == "__subpackages__":
-        return _same_package_or_above(pattern, value)
-
-    return pattern.package == value.package and pattern.name == value.name
-
-def _same_package_or_above(label_a, label_b):
-    if label_a.workspace_name != label_b.workspace_name:
-        return False
-    package_a_tokenized = label_a.package.split("/")
-    package_b_tokenized = label_b.package.split("/")
-    if len(package_b_tokenized) < len(package_a_tokenized):
-        return False
-
-    if package_a_tokenized[0] != "":
-        for i in range(len(package_a_tokenized)):
-            if package_a_tokenized[i] != package_b_tokenized[i]:
-                return False
-
-    return True
-
-for_testing_dont_use_check_if_target_under_path = _check_if_target_under_path
diff --git a/examples/test_cc_shared_library/BUILD.oss b/examples/test_cc_shared_library/BUILD.oss
deleted file mode 100644
index 3d76fb7..0000000
--- a/examples/test_cc_shared_library/BUILD.oss
+++ /dev/null
@@ -1,236 +0,0 @@
-load("//third_party/bazel_skylib:bzl_library.bzl", "bzl_library")
-load("//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
-load("//third_party/bazel_rules/rules_cc/examples:experimental_cc_shared_library.bzl", "LINKABLE_MORE_THAN_ONCE")
-load(":starlark_tests.bzl", "additional_inputs_test", "build_failure_test", "linking_suffix_test", "paths_test")
-
-package(
-    default_visibility = ["//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library:__subpackages__"],
-)
-
-cc_test(
-    name = "cc_test",
-    srcs = ["main.cc"],
-    dynamic_deps = ["foo_so"],
-    deps = ["foo"],
-)
-
-cc_binary(
-    name = "binary",
-    srcs = ["main.cc"],
-    dynamic_deps = ["foo_so"],
-    deps = ["foo"],
-)
-
-cc_binary(
-    name = "binary_with_bar_so_twice",
-    srcs = ["main.cc"],
-    dynamic_deps = [
-        "foo_so",
-        "bar_so",
-    ],
-    deps = ["foo"],
-)
-
-cc_shared_library(
-    name = "foo_so",
-    additional_linker_inputs = [
-        ":foo.lds",
-        ":additional_script.txt",
-    ],
-    dynamic_deps = ["bar_so"],
-    preloaded_deps = ["preloaded_dep"],
-    roots = [
-        "baz",
-        "foo",
-        "a_suffix",
-    ],
-    static_deps = [
-        "//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library:qux",
-        "//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library:qux2",
-    ],
-    user_link_flags = [
-        "-Wl,-rpath,kittens",
-        "-Wl,--version-script=$(location :foo.lds)",
-        "-Wl,--script=$(location :additional_script.txt)",
-    ],
-)
-
-cc_library(
-    name = "preloaded_dep",
-    srcs = ["preloaded_dep.cc"],
-    hdrs = ["preloaded_dep.h"],
-)
-
-cc_library(
-    name = "foo",
-    srcs = ["foo.cc"],
-    hdrs = ["foo.h"],
-    deps = [
-        "preloaded_dep",
-        "bar",
-        "baz",
-        # Not exported.
-        "qux",
-        "qux2",
-    ],
-)
-
-cc_library(
-    name = "a_suffix",
-    srcs = ["a_suffix.cc"],
-    hdrs = ["a_suffix.h"],
-)
-
-cc_library(
-    name = "baz",
-    srcs = ["baz.cc"],
-    hdrs = ["baz.h"],
-    deps = ["bar3"],
-)
-
-cc_library(
-    name = "qux",
-    srcs = ["qux.cc"],
-    hdrs = ["qux.h"],
-)
-
-cc_library(
-    name = "qux2",
-    srcs = ["qux2.cc"],
-    hdrs = ["qux2.h"],
-    tags = [LINKABLE_MORE_THAN_ONCE],
-)
-
-cc_shared_library(
-    name = "bar_so",
-    additional_linker_inputs = [
-        ":bar.lds",
-    ],
-    exports_filter = [
-        "bar3",  # Exported transitive dependency
-        "//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library3:bar",
-    ],
-    permissions = [
-        "//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library3:permissions",
-    ],
-    roots = [
-        "bar",
-        "bar2",
-        "@test_repo//:bar",
-    ],
-    static_deps = [
-        "//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library:barX",
-        "@test_repo//:bar",
-        "//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library:qux2",
-    ],
-    user_link_flags = [
-        "-Wl,--version-script=$(location :bar.lds)",
-    ],
-)
-
-cc_library(
-    name = "barX",
-    srcs = ["bar.cc"],
-    hdrs = ["bar.h"],
-    deps = [
-        "@test_repo//:bar",
-    ],
-)
-
-cc_library(
-    name = "bar",
-    srcs = ["bar.cc"],
-    hdrs = ["bar.h"],
-    deps = [
-        "barX",
-        "qux2",
-    ],
-)
-
-cc_library(
-    name = "bar2",
-    srcs = ["bar2.cc"],
-    hdrs = ["bar2.h"],
-    deps = ["bar3"],
-)
-
-cc_library(
-    name = "bar3",
-    srcs = ["bar3.cc"],
-    hdrs = ["bar3.h"],
-    deps = [
-        "//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library3:bar",
-    ],
-)
-
-sh_test(
-    name = "cc_shared_library_integration_test",
-    srcs = ["cc_shared_library_integration_test.sh"],
-    data = [
-        ":bar_so",
-        ":binary",
-        ":cc_test",
-        ":foo_so",
-    ],
-)
-
-linking_suffix_test(
-    name = "linking_action_test",
-    target_under_test = ":foo_so",
-)
-
-additional_inputs_test(
-    name = "additional_inputs_test",
-    target_under_test = ":foo_so",
-)
-
-build_failure_test(
-    name = "link_once_repeated_test",
-    message = "already linked statically in " +
-              "//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library:foo_so but not exported.",
-    target_under_test = "//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library/failing_targets:should_fail_binary",
-)
-
-paths_test(
-    name = "path_matching_test",
-)
-
-build_failure_test(
-    name = "export_without_permissions_test",
-    message = "doesn't have the necessary permissions",
-    target_under_test = "//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library/failing_targets:permissions_fail_so",
-)
-
-build_failure_test(
-    name = "forbidden_target_permissions_test",
-    message = "can only list targets that are in the same package or a sub-package",
-    target_under_test = "//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library/failing_targets:permissions_fail",
-)
-
-bzl_library(
-    name = "test_cc_shared_library_starlark_tests_bzl",
-    srcs = ["starlark_tests.bzl"],
-    visibility = ["//visibility:private"],
-)
-
-cc_shared_library_permissions(
-    name = "permissions",
-    targets = [
-        "//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library:a_suffix",
-        "//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library:qux",
-        "//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library:qux2",
-    ],
-    visibility = ["//third_party/bazel_rules/rules_cc/examples/test_cc_shared_library/diamond_inheritance:__pkg__"],
-)
-
-build_failure_test(
-    name = "two_dynamic_deps_same_export_in_so_test",
-    message = "Two shared libraries in dependencies export the same symbols",
-    target_under_test = "//examples/test_cc_shared_library/failing_targets:two_dynamic_deps_same_export_in_so",
-)
-
-build_failure_test(
-    name = "two_dynamic_deps_same_export_in_binary_test",
-    message = "Two shared libraries in dependencies export the same symbols",
-    target_under_test = "//examples/test_cc_shared_library/failing_targets:two_dynamic_deps_same_export_in_binary",
-)
diff --git a/examples/test_cc_shared_library/a_suffix.cc b/examples/test_cc_shared_library/a_suffix.cc
deleted file mode 100644
index df9ccd2..0000000
--- a/examples/test_cc_shared_library/a_suffix.cc
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "examples/test_cc_shared_library/a_suffix.h"
-
-int a_suffix() { return 42; }
diff --git a/examples/test_cc_shared_library/a_suffix.h b/examples/test_cc_shared_library/a_suffix.h
deleted file mode 100644
index 888be29..0000000
--- a/examples/test_cc_shared_library/a_suffix.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef EXAMPLES_TEST_CC_SHARED_LIBRARY_A_SUFFIX_H_
-#define EXAMPLES_TEST_CC_SHARED_LIBRARY_A_SUFFIX_H_
-
-int a_suffix();
-
-#endif  // EXAMPLES_TEST_CC_SHARED_LIBRARY_A_SUFFIX_H_
diff --git a/examples/test_cc_shared_library/additional_script.txt b/examples/test_cc_shared_library/additional_script.txt
deleted file mode 100644
index e69de29..0000000
--- a/examples/test_cc_shared_library/additional_script.txt
+++ /dev/null
diff --git a/examples/test_cc_shared_library/bar.cc b/examples/test_cc_shared_library/bar.cc
deleted file mode 100644
index dd2da99..0000000
--- a/examples/test_cc_shared_library/bar.cc
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "examples/test_cc_shared_library/bar.h"
-
-int bar() { return 42; }
diff --git a/examples/test_cc_shared_library/bar.h b/examples/test_cc_shared_library/bar.h
deleted file mode 100644
index 4a8fefe..0000000
--- a/examples/test_cc_shared_library/bar.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef EXAMPLES_TEST_CC_SHARED_LIBRARY_BAR_H_
-#define EXAMPLES_TEST_CC_SHARED_LIBRARY_BAR_H_
-
-int bar();
-
-#endif  // EXAMPLES_TEST_CC_SHARED_LIBRARY_BAR_H_
diff --git a/examples/test_cc_shared_library/bar.lds b/examples/test_cc_shared_library/bar.lds
deleted file mode 100644
index cfe541c..0000000
--- a/examples/test_cc_shared_library/bar.lds
+++ /dev/null
@@ -1,5 +0,0 @@
-VERS_1.1 {
-  global:
-    _Z3barv;
-  local: *;
-};
diff --git a/examples/test_cc_shared_library/bar2.cc b/examples/test_cc_shared_library/bar2.cc
deleted file mode 100644
index 21f8957..0000000
--- a/examples/test_cc_shared_library/bar2.cc
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "examples/test_cc_shared_library/bar2.h"
-
-int bar2() { return 42; }
diff --git a/examples/test_cc_shared_library/bar2.h b/examples/test_cc_shared_library/bar2.h
deleted file mode 100644
index 06f30f9..0000000
--- a/examples/test_cc_shared_library/bar2.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef EXAMPLES_TEST_CC_SHARED_LIBRARY_BAR_2_H_
-#define EXAMPLES_TEST_CC_SHARED_LIBRARY_BAR_2_H_
-
-int bar2();
-
-#endif  // EXAMPLES_TEST_CC_SHARED_LIBRARY_BAR_2_H_
diff --git a/examples/test_cc_shared_library/bar3.cc b/examples/test_cc_shared_library/bar3.cc
deleted file mode 100644
index e2c2f01..0000000
--- a/examples/test_cc_shared_library/bar3.cc
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "examples/test_cc_shared_library/bar3.h"
-
-int bar3() { return 42; }
diff --git a/examples/test_cc_shared_library/bar3.h b/examples/test_cc_shared_library/bar3.h
deleted file mode 100644
index a526b69..0000000
--- a/examples/test_cc_shared_library/bar3.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef EXAMPLES_TEST_CC_SHARED_LIBRARY_BAR_3_H_
-#define EXAMPLES_TEST_CC_SHARED_LIBRARY_BAR_3_H_
-
-int bar3();
-
-#endif  // EXAMPLES_TEST_CC_SHARED_LIBRARY_BAR_3_H_
diff --git a/examples/test_cc_shared_library/baz.cc b/examples/test_cc_shared_library/baz.cc
deleted file mode 100644
index 6e686e0..0000000
--- a/examples/test_cc_shared_library/baz.cc
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "examples/test_cc_shared_library/baz.h"
-
-int baz() { return 42; }
diff --git a/examples/test_cc_shared_library/baz.h b/examples/test_cc_shared_library/baz.h
deleted file mode 100644
index 0d368fa..0000000
--- a/examples/test_cc_shared_library/baz.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef EXAMPLES_TEST_CC_SHARED_LIBRARY_BAZ_H_
-#define EXAMPLES_TEST_CC_SHARED_LIBRARY_BAZ_H_
-
-int baz();
-
-#endif  // EXAMPLES_TEST_CC_SHARED_LIBRARY_BAZ_H_
diff --git a/examples/test_cc_shared_library/cc_shared_library_integration_test.sh b/examples/test_cc_shared_library/cc_shared_library_integration_test.sh
deleted file mode 100755
index 7e9b947..0000000
--- a/examples/test_cc_shared_library/cc_shared_library_integration_test.sh
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/bash
-
-# Copyright 2019 The Bazel Authors. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#    http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -euo pipefail
-
-function check_symbol_present() {
-  message="Should have seen '$2' but didn't."
-  echo "$1" | (grep -q "$2" || (echo "$message" && exit 1))
-}
-
-function check_symbol_absent() {
-  message="Shouldn't have seen '$2' but did."
-  if [ "$(echo $1 | grep -c $2)" -gt 0 ]; then
-    echo "$message"
-    exit 1
-  fi
-}
-
-function test_shared_library_symbols() {
-  foo_so=$(find . -name libfoo_so.so)
-  symbols=$(nm -D $foo_so)
-  check_symbol_present "$symbols" "U _Z3barv"
-  check_symbol_present "$symbols" "T _Z3bazv"
-  check_symbol_present "$symbols" "T _Z3foov"
-  # Check that the preloaded dep symbol is not present
-  check_symbol_present "$symbols" "U _Z13preloaded_depv"
-
-  check_symbol_absent "$symbols" "_Z3quxv"
-  check_symbol_absent "$symbols" "_Z4bar3v"
-  check_symbol_absent "$symbols" "_Z4bar4v"
-}
-
-function test_shared_library_user_link_flags() {
-  foo_so=$(find . -name libfoo_so.so)
-  objdump -x $foo_so | grep RUNPATH | grep "kittens" > /dev/null \
-      || (echo "Expected to have RUNPATH contain 'kittens' (set by user_link_flags)" \
-          && exit 1)
-}
-
-function do_test_binary() {
-  symbols=$(nm -D $1)
-  check_symbol_present "$symbols" "U _Z3foov"
-  $1 | (grep -q "hello 42" || (echo "Expected 'hello 42'" && exit 1))
-}
-
-function test_binary() {
-  binary=$(find . -name binary)
-  do_test_binary $binary
-  check_symbol_present "$symbols" "T _Z13preloaded_depv"
-}
-
-function test_cc_test() {
-  cc_test=$(find . -name cc_test)
-  do_test_binary $cc_test
-  check_symbol_absent "$symbols" "_Z13preloaded_depv"
-  ldd $cc_test | (grep -q "preloaded_Udep.so" || (echo "Expected '"preloaded_Udep.so"'" && exit 1))
-}
-
-test_shared_library_user_link_flags
-test_shared_library_symbols
-test_binary
-test_cc_test
diff --git a/examples/test_cc_shared_library/diamond_inheritance/BUILD.bazel b/examples/test_cc_shared_library/diamond_inheritance/BUILD.bazel
deleted file mode 100644
index 95699a3..0000000
--- a/examples/test_cc_shared_library/diamond_inheritance/BUILD.bazel
+++ /dev/null
@@ -1,39 +0,0 @@
-load("//cc:defs.bzl", "cc_binary")
-
-cc_shared_library(
-    name = "baz_so",
-    permissions = [
-        "//examples/test_cc_shared_library:permissions",
-    ],
-    roots = ["//examples/test_cc_shared_library:a_suffix"],
-)
-
-cc_shared_library(
-    name = "qux_so",
-    dynamic_deps = [":baz_so"],
-    permissions = [
-        "//examples/test_cc_shared_library:permissions",
-    ],
-    roots = ["//examples/test_cc_shared_library:qux"],
-)
-
-cc_shared_library(
-    name = "qux2_so",
-    dynamic_deps = [":baz_so"],
-    permissions = [
-        "//examples/test_cc_shared_library:permissions",
-    ],
-    roots = ["//examples/test_cc_shared_library:qux2"],
-)
-
-cc_binary(
-    name = "diamond_inheritance",
-    srcs = ["main.cc"],
-    dynamic_deps = [
-        ":qux_so",
-        ":qux2_so",
-    ],
-    deps = [
-        "//examples/test_cc_shared_library:a_suffix",
-    ],
-)
diff --git a/examples/test_cc_shared_library/diamond_inheritance/main.cc b/examples/test_cc_shared_library/diamond_inheritance/main.cc
deleted file mode 100644
index 18e4366..0000000
--- a/examples/test_cc_shared_library/diamond_inheritance/main.cc
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <iostream>
-
-#include "examples/test_cc_shared_library/a_suffix.h"
-
-int main() {
-  std::cout << "hello " << a_suffix() << std::endl;
-  return 0;
-}
diff --git a/examples/test_cc_shared_library/failing_targets/BUILD.oss b/examples/test_cc_shared_library/failing_targets/BUILD.oss
deleted file mode 100644
index f0bf796..0000000
--- a/examples/test_cc_shared_library/failing_targets/BUILD.oss
+++ /dev/null
@@ -1,90 +0,0 @@
-load("//cc:defs.bzl", "cc_binary", "cc_library")
-load("//examples:experimental_cc_shared_library.bzl", "cc_shared_library", "cc_shared_library_permissions")
-
-package(
-    default_visibility = ["//examples/test_cc_shared_library:__pkg__"],
-)
-
-TAGS = [
-    "manual",
-    "nobuilder",
-]
-
-cc_binary(
-    name = "should_fail_binary",
-    dynamic_deps = ["//examples/test_cc_shared_library:foo_so"],
-    tags = TAGS,
-    deps = [
-        "//examples/test_cc_shared_library:foo",
-        "//examples/test_cc_shared_library:qux",
-    ],
-)
-
-cc_shared_library(
-    name = "permissions_fail_so",
-    roots = [
-        "//examples/test_cc_shared_library3:bar",
-    ],
-    tags = TAGS,
-)
-
-cc_shared_library_permissions(
-    name = "permissions_fail",
-    tags = TAGS,
-    targets = [
-        "//examples/test_cc_shared_library:foo",
-    ],
-)
-
-cc_library(
-    name = "a",
-    srcs = ["a.cc"],
-)
-
-cc_library(
-    name = "b",
-    srcs = ["b.cc"],
-)
-
-cc_library(
-    name = "c",
-    srcs = ["c.cc"],
-)
-
-cc_shared_library(
-    name = "two_dynamic_deps_same_export_in_so",
-    dynamic_deps = [
-        ":b_so",
-        ":b2_so",
-    ],
-    roots = [
-        ":a",
-    ],
-    tags = TAGS,
-)
-
-cc_binary(
-    name = "two_dynamic_deps_same_export_in_binary",
-    srcs = ["main.cc"],
-    dynamic_deps = [
-        ":b_so",
-        ":b2_so",
-    ],
-    tags = TAGS,
-)
-
-cc_shared_library(
-    name = "b_so",
-    roots = [
-        ":b",
-    ],
-    tags = TAGS,
-)
-
-cc_shared_library(
-    name = "b2_so",
-    roots = [
-        ":b",
-    ],
-    tags = TAGS,
-)
diff --git a/examples/test_cc_shared_library/failing_targets/a.cc b/examples/test_cc_shared_library/failing_targets/a.cc
deleted file mode 100644
index e69de29..0000000
--- a/examples/test_cc_shared_library/failing_targets/a.cc
+++ /dev/null
diff --git a/examples/test_cc_shared_library/failing_targets/b.cc b/examples/test_cc_shared_library/failing_targets/b.cc
deleted file mode 100644
index e69de29..0000000
--- a/examples/test_cc_shared_library/failing_targets/b.cc
+++ /dev/null
diff --git a/examples/test_cc_shared_library/failing_targets/c.cc b/examples/test_cc_shared_library/failing_targets/c.cc
deleted file mode 100644
index e69de29..0000000
--- a/examples/test_cc_shared_library/failing_targets/c.cc
+++ /dev/null
diff --git a/examples/test_cc_shared_library/failing_targets/main.cc b/examples/test_cc_shared_library/failing_targets/main.cc
deleted file mode 100644
index e69de29..0000000
--- a/examples/test_cc_shared_library/failing_targets/main.cc
+++ /dev/null
diff --git a/examples/test_cc_shared_library/foo.cc b/examples/test_cc_shared_library/foo.cc
deleted file mode 100644
index ccbaef2..0000000
--- a/examples/test_cc_shared_library/foo.cc
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "examples/test_cc_shared_library/bar.h"
-#include "examples/test_cc_shared_library/baz.h"
-#include "examples/test_cc_shared_library/preloaded_dep.h"
-#include "examples/test_cc_shared_library/qux.h"
-
-int foo() {
-  bar();
-  baz();
-  qux();
-  preloaded_dep();
-  return 42;
-}
diff --git a/examples/test_cc_shared_library/foo.h b/examples/test_cc_shared_library/foo.h
deleted file mode 100644
index 167d992..0000000
--- a/examples/test_cc_shared_library/foo.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef EXAMPLES_TEST_CC_SHARED_LIBRARY_FOO_H_
-#define EXAMPLES_TEST_CC_SHARED_LIBRARY_FOO_H_
-
-int foo();
-
-#endif  // EXAMPLES_TEST_CC_SHARED_LIBRARY_FOO_H_
diff --git a/examples/test_cc_shared_library/foo.lds b/examples/test_cc_shared_library/foo.lds
deleted file mode 100644
index 54dbe17..0000000
--- a/examples/test_cc_shared_library/foo.lds
+++ /dev/null
@@ -1,6 +0,0 @@
-VERS_1.1 {
-  global:
-    _Z3foov;
-    _Z3bazv;
-  local: *;
-};
diff --git a/examples/test_cc_shared_library/main.cc b/examples/test_cc_shared_library/main.cc
deleted file mode 100644
index 283057f..0000000
--- a/examples/test_cc_shared_library/main.cc
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <iostream>
-
-#include "examples/test_cc_shared_library/foo.h"
-
-int main() {
-  std::cout << "hello " << foo() << std::endl;
-  return 0;
-}
diff --git a/examples/test_cc_shared_library/not_depended_on.cc b/examples/test_cc_shared_library/not_depended_on.cc
deleted file mode 100644
index adc1d7b..0000000
--- a/examples/test_cc_shared_library/not_depended_on.cc
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "examples/test_cc_shared_library/bar.h"
-
-int foo() {
-  bar();
-  return 42;
-}
diff --git a/examples/test_cc_shared_library/preloaded_dep.cc b/examples/test_cc_shared_library/preloaded_dep.cc
deleted file mode 100644
index bbd825c..0000000
--- a/examples/test_cc_shared_library/preloaded_dep.cc
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "examples/test_cc_shared_library/preloaded_dep.h"
-
-int preloaded_dep() { return 42; }
diff --git a/examples/test_cc_shared_library/preloaded_dep.h b/examples/test_cc_shared_library/preloaded_dep.h
deleted file mode 100644
index 7a356ac..0000000
--- a/examples/test_cc_shared_library/preloaded_dep.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef EXAMPLES_TEST_CC_SHARED_LIBRARY_PRELOADED_DEP_H_
-#define EXAMPLES_TEST_CC_SHARED_LIBRARY_PRELOADED_DEP_H_
-
-int preloaded_dep();
-
-#endif  // EXAMPLES_TEST_CC_SHARED_LIBRARY_PRELOADED_DEP_H_
diff --git a/examples/test_cc_shared_library/quux.cc b/examples/test_cc_shared_library/quux.cc
deleted file mode 100644
index b09c46e..0000000
--- a/examples/test_cc_shared_library/quux.cc
+++ /dev/null
@@ -1 +0,0 @@
-int quux() { return 42; }
diff --git a/examples/test_cc_shared_library/qux.cc b/examples/test_cc_shared_library/qux.cc
deleted file mode 100644
index 23d0312..0000000
--- a/examples/test_cc_shared_library/qux.cc
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "examples/test_cc_shared_library/qux.h"
-
-int qux() { return 42; }
diff --git a/examples/test_cc_shared_library/qux.h b/examples/test_cc_shared_library/qux.h
deleted file mode 100644
index f38f5a8..0000000
--- a/examples/test_cc_shared_library/qux.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef EXAMPLES_TEST_CC_SHARED_LIBRARY_QUX_H_
-#define EXAMPLES_TEST_CC_SHARED_LIBRARY_QUX_H_
-
-int qux();
-
-#endif  // EXAMPLES_TEST_CC_SHARED_LIBRARY_QUX_H_
diff --git a/examples/test_cc_shared_library/qux2.cc b/examples/test_cc_shared_library/qux2.cc
deleted file mode 100644
index 34a96dc..0000000
--- a/examples/test_cc_shared_library/qux2.cc
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "examples/test_cc_shared_library/qux2.h"
-
-int qux2() { return 42; }
diff --git a/examples/test_cc_shared_library/qux2.h b/examples/test_cc_shared_library/qux2.h
deleted file mode 100644
index 1246a11..0000000
--- a/examples/test_cc_shared_library/qux2.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef EXAMPLES_TEST_CC_SHARED_LIBRARY_QUX2_H_
-#define EXAMPLES_TEST_CC_SHARED_LIBRARY_QUX2_H_
-
-int qux2();
-
-#endif  // EXAMPLES_TEST_CC_SHARED_LIBRARY_QUX2_H_
diff --git a/examples/test_cc_shared_library/starlark_tests.bzl b/examples/test_cc_shared_library/starlark_tests.bzl
deleted file mode 100644
index c5d9fd4..0000000
--- a/examples/test_cc_shared_library/starlark_tests.bzl
+++ /dev/null
@@ -1,74 +0,0 @@
-"""Starlark tests for cc_shared_library"""
-
-load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts", "unittest")
-load("//examples:experimental_cc_shared_library.bzl", "for_testing_dont_use_check_if_target_under_path")
-
-def _linking_suffix_test_impl(ctx):
-    env = analysistest.begin(ctx)
-
-    target_under_test = analysistest.target_under_test(env)
-    actions = analysistest.target_actions(env)
-
-    for arg in reversed(actions[1].argv):
-        if (arg.find(".a") != -1 or arg.find("-l") != -1) and "/" in arg:
-            asserts.equals(env, "liba_suffix.a", arg[arg.rindex("/") + 1:])
-            break
-
-    return analysistest.end(env)
-
-linking_suffix_test = analysistest.make(_linking_suffix_test_impl)
-
-def _additional_inputs_test_impl(ctx):
-    env = analysistest.begin(ctx)
-
-    target_under_test = analysistest.target_under_test(env)
-    actions = analysistest.target_actions(env)
-
-    found = False
-    for arg in actions[1].argv:
-        if arg.find("-Wl,--script=") != -1:
-            asserts.equals(env, "examples/test_cc_shared_library/additional_script.txt", arg[13:])
-            found = True
-            break
-    asserts.true(env, found, "Should have seen option --script=")
-
-    return analysistest.end(env)
-
-additional_inputs_test = analysistest.make(_additional_inputs_test_impl)
-
-def _build_failure_test_impl(ctx):
-    env = analysistest.begin(ctx)
-
-    asserts.expect_failure(env, ctx.attr.message)
-
-    return analysistest.end(env)
-
-build_failure_test = analysistest.make(
-    _build_failure_test_impl,
-    expect_failure = True,
-    attrs = {"message": attr.string()},
-)
-
-def _paths_test_impl(ctx):
-    env = unittest.begin(ctx)
-
-    asserts.false(env, for_testing_dont_use_check_if_target_under_path(Label("//foo"), Label("//bar")))
-    asserts.false(env, for_testing_dont_use_check_if_target_under_path(Label("@foo//foo"), Label("@bar//bar")))
-    asserts.false(env, for_testing_dont_use_check_if_target_under_path(Label("//bar"), Label("@foo//bar")))
-    asserts.true(env, for_testing_dont_use_check_if_target_under_path(Label("@foo//bar"), Label("@foo//bar")))
-    asserts.true(env, for_testing_dont_use_check_if_target_under_path(Label("@foo//bar:bar"), Label("@foo//bar")))
-    asserts.true(env, for_testing_dont_use_check_if_target_under_path(Label("//bar:bar"), Label("//bar")))
-
-    asserts.false(env, for_testing_dont_use_check_if_target_under_path(Label("@foo//bar/baz"), Label("@foo//bar")))
-    asserts.false(env, for_testing_dont_use_check_if_target_under_path(Label("@foo//bar/baz"), Label("@foo//bar:__pkg__")))
-    asserts.true(env, for_testing_dont_use_check_if_target_under_path(Label("@foo//bar/baz"), Label("@foo//bar:__subpackages__")))
-    asserts.true(env, for_testing_dont_use_check_if_target_under_path(Label("@foo//bar:qux"), Label("@foo//bar:__pkg__")))
-
-    asserts.false(env, for_testing_dont_use_check_if_target_under_path(Label("@foo//bar"), Label("@foo//bar/baz:__subpackages__")))
-    asserts.false(env, for_testing_dont_use_check_if_target_under_path(Label("//bar"), Label("//bar/baz:__pkg__")))
-
-    asserts.true(env, for_testing_dont_use_check_if_target_under_path(Label("//foo/bar:baz"), Label("//:__subpackages__")))
-
-    return unittest.end(env)
-
-paths_test = unittest.make(_paths_test_impl)
diff --git a/examples/test_cc_shared_library2/BUILD.oss b/examples/test_cc_shared_library2/BUILD.oss
deleted file mode 100644
index 802d60f..0000000
--- a/examples/test_cc_shared_library2/BUILD.oss
+++ /dev/null
@@ -1,8 +0,0 @@
-load("@rules_cc//cc:defs.bzl", "cc_library")
-
-cc_library(
-    name = "bar",
-    srcs = ["bar.cc"],
-    hdrs = ["bar.h"],
-    visibility = ["//visibility:public"],
-)
diff --git a/examples/test_cc_shared_library2/WORKSPACE b/examples/test_cc_shared_library2/WORKSPACE
deleted file mode 100644
index 838ce12..0000000
--- a/examples/test_cc_shared_library2/WORKSPACE
+++ /dev/null
@@ -1 +0,0 @@
-workspace(name = "test_repo")
diff --git a/examples/test_cc_shared_library2/bar.cc b/examples/test_cc_shared_library2/bar.cc
deleted file mode 100644
index e69de29..0000000
--- a/examples/test_cc_shared_library2/bar.cc
+++ /dev/null
diff --git a/examples/test_cc_shared_library2/bar.h b/examples/test_cc_shared_library2/bar.h
deleted file mode 100644
index e69de29..0000000
--- a/examples/test_cc_shared_library2/bar.h
+++ /dev/null
diff --git a/examples/test_cc_shared_library3/BUILD.oss b/examples/test_cc_shared_library3/BUILD.oss
deleted file mode 100644
index 685071c..0000000
--- a/examples/test_cc_shared_library3/BUILD.oss
+++ /dev/null
@@ -1,17 +0,0 @@
-load("@rules_cc//cc:defs.bzl", "cc_library")
-load("//examples:experimental_cc_shared_library.bzl", "cc_shared_library_permissions")
-
-cc_library(
-    name = "bar",
-    srcs = ["bar.cc"],
-    hdrs = ["bar.h"],
-    visibility = ["//visibility:public"],
-)
-
-cc_shared_library_permissions(
-    name = "permissions",
-    targets = [
-        "//examples/test_cc_shared_library3:bar",
-    ],
-    visibility = ["//examples/test_cc_shared_library:__pkg__"],
-)
diff --git a/examples/test_cc_shared_library3/bar.cc b/examples/test_cc_shared_library3/bar.cc
deleted file mode 100644
index e69de29..0000000
--- a/examples/test_cc_shared_library3/bar.cc
+++ /dev/null
diff --git a/examples/test_cc_shared_library3/bar.h b/examples/test_cc_shared_library3/bar.h
deleted file mode 100644
index e69de29..0000000
--- a/examples/test_cc_shared_library3/bar.h
+++ /dev/null