From c49c45d8dac87d21cf2b6a176ddd07f2c9f63414 Mon Sep 17 00:00:00 2001 From: plf Date: Wed, 6 Apr 2022 07:21:53 -0700 Subject: [PATCH] Revert default export all symbols on Windows In cc_shared_library we changed the behavior with respect to cc_binary(linkshared=1) by enabling the feature windows_export_all_symbols. This was in order to keep consistency between Linux and Windows. After further consideration, we decide it's better to keep the inconsistency between the two platforms because this is what Windows users expect. RELNOTES:none PiperOrigin-RevId: 439832190 --- .../common/cc/experimental_cc_shared_library.bzl | 5 +---- .../test_cc_shared_library/BUILD.builtin_test | 7 +++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/starlark/builtins_bzl/common/cc/experimental_cc_shared_library.bzl b/src/main/starlark/builtins_bzl/common/cc/experimental_cc_shared_library.bzl index 47ec796efa9201..62f6c799d394ae 100644 --- a/src/main/starlark/builtins_bzl/common/cc/experimental_cc_shared_library.bzl +++ b/src/main/starlark/builtins_bzl/common/cc/experimental_cc_shared_library.bzl @@ -397,10 +397,7 @@ def _cc_shared_library_impl(ctx): feature_configuration = cc_common.configure_features( ctx = ctx, cc_toolchain = cc_toolchain, - # This features enables behavior which creates a def file automatically - # for exporting all the symbols in a shared libary on Windows. If a - # custom def file is passed, this behavior doesn't apply. - requested_features = ctx.features + ["windows_export_all_symbols"], + requested_features = ctx.features, unsupported_features = ctx.disabled_features, ) diff --git a/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD.builtin_test b/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD.builtin_test index 34e5515e7cc779..1492a8f5c8cb58 100644 --- a/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD.builtin_test +++ b/src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD.builtin_test @@ -42,18 +42,21 @@ cc_binary( cc_shared_library( name = "a_so", roots = [":a_suffix"], + features = ["windows_export_all_symbols"], ) cc_shared_library( name = "diamond_so", dynamic_deps = [":a_so"], roots = [":qux"], + features = ["windows_export_all_symbols"], ) cc_shared_library( name = "diamond2_so", dynamic_deps = [":a_so"], roots = [":qux2"], + features = ["windows_export_all_symbols"], ) cc_binary( @@ -96,6 +99,7 @@ cc_shared_library( "-Wl,--script=$(location :additional_script.txt)", ], "//conditions:default": []}), + features = ["windows_export_all_symbols"], ) cc_library( @@ -191,6 +195,7 @@ cc_shared_library( ], "//conditions:default": [], }), + features = ["windows_export_all_symbols"], ) cc_library( @@ -316,6 +321,7 @@ cc_shared_library( roots = [ ":direct_so_file_cc_lib", ], + features = ["windows_export_all_symbols"], ) genrule( @@ -337,6 +343,7 @@ cc_shared_library( ":direct_so_file_cc_lib2", ], shared_lib_name = "renamed_so_file.so", + features = ["windows_export_all_symbols"], ) cc_library(