Skip to content

Commit

Permalink
Revert default export all symbols on Windows
Browse files Browse the repository at this point in the history
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
  • Loading branch information
oquenchil authored and copybara-github committed Apr 6, 2022
1 parent afa02a8 commit c49c45d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -96,6 +99,7 @@ cc_shared_library(
"-Wl,--script=$(location :additional_script.txt)",
],
"//conditions:default": []}),
features = ["windows_export_all_symbols"],
)

cc_library(
Expand Down Expand Up @@ -191,6 +195,7 @@ cc_shared_library(
],
"//conditions:default": [],
}),
features = ["windows_export_all_symbols"],
)

cc_library(
Expand Down Expand Up @@ -316,6 +321,7 @@ cc_shared_library(
roots = [
":direct_so_file_cc_lib",
],
features = ["windows_export_all_symbols"],
)

genrule(
Expand All @@ -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(
Expand Down

0 comments on commit c49c45d

Please sign in to comment.