Skip to content

Commit

Permalink
Fix a bug where during dwp file creation the extension was stripped.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 417632479
  • Loading branch information
Googler authored and copybara-github committed Dec 21, 2021
1 parent 58ea4dd commit da29398
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/starlark/builtins_bzl/common/cc/cc_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ def _new_dwp_action(ctx, cc_toolchain, dwp_tools):
def _get_intermediate_dwp_file(ctx, dwp_output, order_number):
output_path = dwp_output.short_path
intermediate_path = output_path + "-" + str(order_number)
if dwp_output.extension != "":
intermediate_path = output_path.split(".")[0] + "-" + str(order_number) + "." + dwp_output.extension

return ctx.actions.declare_file("_dwp/" + intermediate_path)
return ctx.actions.declare_file("_dwps/" + intermediate_path)

def _create_intermediate_dwp_packagers(ctx, dwp_output, cc_toolchain, dwp_files, dwo_files, intermediate_dwp_count):
intermediate_outputs = dwo_files
Expand Down Expand Up @@ -577,14 +575,15 @@ def _create_transitive_linking_actions(
additional_inputs = additional_linker_inputs,
linking_contexts = [cc_linking_context],
name = ctx.label.name,
use_test_only_flags = cc_helper.is_test_target(ctx),
use_test_only_flags = ctx.label.name.endswith("_test"),
# Note: Current Starlark API supports either dynamic or static linking modes,
# even though there are more(LEGACY_FULL_STATIC, LEGACY_MOSTLY_STATIC_LIBRARIES) cc_binary
# only uses dynamic or static modes. So instead of adding more native footprint
# we can use what is already supported.
# It is highly unlikely that cc_binary will start using legacy modes,
# but if in case it does, code needs to be modified to support it.
link_deps_statically = link_deps_statically,
test_only_target = cc_helper.is_test_target(ctx) or ctx.label.name.endswith("_test"),
output_type = link_target_type,
main_output = binary,
never_link = True,
Expand Down

0 comments on commit da29398

Please sign in to comment.