Skip to content

Commit 8ae1520

Browse files
authored
Fix windows_export_all_symbols in cc_shared_library (bazelbuild#15190)
1 parent ffa2a0b commit 8ae1520

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
@@ -388,10 +388,7 @@ def _cc_shared_library_impl(ctx):
388388
feature_configuration = cc_common.configure_features(
389389
ctx = ctx,
390390
cc_toolchain = cc_toolchain,
391-
# This features enables behavior which creates a def file automatically
392-
# for exporting all the symbols in a shared libary on Windows. If a
393-
# custom def file is passed, this behavior doesn't apply.
394-
requested_features = ctx.features + ["windows_export_all_symbols"],
391+
requested_features = ctx.features,
395392
unsupported_features = ctx.disabled_features,
396393
)
397394

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
@@ -36,18 +36,21 @@ cc_binary(
3636
cc_shared_library(
3737
name = "a_so",
3838
roots = [":a_suffix"],
39+
features = ["windows_export_all_symbols"],
3940
)
4041

4142
cc_shared_library(
4243
name = "diamond_so",
4344
dynamic_deps = [":a_so"],
4445
roots = [":qux"],
46+
features = ["windows_export_all_symbols"],
4547
)
4648

4749
cc_shared_library(
4850
name = "diamond2_so",
4951
dynamic_deps = [":a_so"],
5052
roots = [":qux2"],
53+
features = ["windows_export_all_symbols"],
5154
)
5255

5356
cc_binary(
@@ -90,6 +93,7 @@ cc_shared_library(
9093
"-Wl,--script=$(location :additional_script.txt)",
9194
],
9295
"//conditions:default": []}),
96+
features = ["windows_export_all_symbols"],
9397
)
9498

9599
cc_library(
@@ -184,6 +188,7 @@ cc_shared_library(
184188
],
185189
"//conditions:default": [],
186190
}),
191+
features = ["windows_export_all_symbols"],
187192
)
188193

189194
cc_library(
@@ -309,6 +314,7 @@ cc_shared_library(
309314
roots = [
310315
":direct_so_file_cc_lib",
311316
],
317+
features = ["windows_export_all_symbols"],
312318
)
313319

314320
genrule(
@@ -330,6 +336,7 @@ cc_shared_library(
330336
":direct_so_file_cc_lib2",
331337
],
332338
shared_lib_name = "renamed_so_file.so",
339+
features = ["windows_export_all_symbols"],
333340
)
334341

335342
cc_library(

0 commit comments

Comments
 (0)