Skip to content

Commit c49c45d

Browse files
oquenchilcopybara-github
authored andcommitted
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
1 parent afa02a8 commit c49c45d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/main/starlark/builtins_bzl/common/cc/experimental_cc_shared_library.bzl

+1-4
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,7 @@ def _cc_shared_library_impl(ctx):
397397
feature_configuration = cc_common.configure_features(
398398
ctx = ctx,
399399
cc_toolchain = cc_toolchain,
400-
# This features enables behavior which creates a def file automatically
401-
# for exporting all the symbols in a shared libary on Windows. If a
402-
# custom def file is passed, this behavior doesn't apply.
403-
requested_features = ctx.features + ["windows_export_all_symbols"],
400+
requested_features = ctx.features,
404401
unsupported_features = ctx.disabled_features,
405402
)
406403

src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD.builtin_test

+7
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,21 @@ cc_binary(
4242
cc_shared_library(
4343
name = "a_so",
4444
roots = [":a_suffix"],
45+
features = ["windows_export_all_symbols"],
4546
)
4647

4748
cc_shared_library(
4849
name = "diamond_so",
4950
dynamic_deps = [":a_so"],
5051
roots = [":qux"],
52+
features = ["windows_export_all_symbols"],
5153
)
5254

5355
cc_shared_library(
5456
name = "diamond2_so",
5557
dynamic_deps = [":a_so"],
5658
roots = [":qux2"],
59+
features = ["windows_export_all_symbols"],
5760
)
5861

5962
cc_binary(
@@ -96,6 +99,7 @@ cc_shared_library(
9699
"-Wl,--script=$(location :additional_script.txt)",
97100
],
98101
"//conditions:default": []}),
102+
features = ["windows_export_all_symbols"],
99103
)
100104

101105
cc_library(
@@ -191,6 +195,7 @@ cc_shared_library(
191195
],
192196
"//conditions:default": [],
193197
}),
198+
features = ["windows_export_all_symbols"],
194199
)
195200

196201
cc_library(
@@ -316,6 +321,7 @@ cc_shared_library(
316321
roots = [
317322
":direct_so_file_cc_lib",
318323
],
324+
features = ["windows_export_all_symbols"],
319325
)
320326

321327
genrule(
@@ -337,6 +343,7 @@ cc_shared_library(
337343
":direct_so_file_cc_lib2",
338344
],
339345
shared_lib_name = "renamed_so_file.so",
346+
features = ["windows_export_all_symbols"],
340347
)
341348

342349
cc_library(

0 commit comments

Comments
 (0)