PDB file generation now matches native version.
@@ -39,6 +39,11 @@ _TVOS_DEVICE_TARGET_CPUS = ["tvos_arm64"]
_CATALYST_TARGET_CPUS = ["catalyst_x86_64"]
_MACOS_TARGET_CPUS = ["darwin_x86_64", "darwin_arm64", "darwin_arm64e", "darwin"]
+def _strip_extension(file):
+ if file.extension == "":
+ return file.basename
+ return file.basename[:-(1 + len(file.extension))]
+
def _grep_includes_executable(grep_includes):
if grep_includes == None:
return None
@@ -800,10 +805,7 @@ def cc_binary_impl(ctx, additional_linkopts):
# then a pdb file will be built along with the executable.
pdb_file = None
if cc_common.is_enabled(feature_configuration = feature_configuration, feature_name = "generate_pdb_file"):
- pdb_file_name = target_name
- if "." in pdb_file_name:
- pdb_file_name = pdb_file_name[:pdb_file_name.rfind(".")]
- pdb_file = ctx.actions.declare_file(pdb_file_name + ".pdb")
+ pdb_file = ctx.actions.declare_file(_strip_extension(binary) + ".pdb", sibling = binary)
extra_link_time_libraries = deps_cc_linking_context.extra_link_time_libraries()
linker_inputs_extra = depset()
