Skip to content

cc_binary: support .dSYM generation #402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

benjivos
Copy link

@benjivos benjivos commented Apr 17, 2025

Add support for generating a .dSYM file if this is requested using --apple_generate_dsym. This change contains the following patches:

  • Add DSYM_HINT flags to be picked up by wrapped_clang to generate .dSYM bundles on request.
  • In wrapped_clang.cc make sure the linked binary is stripped after generating the .dSYM bundle first to make the .dSYM bundle contain useful information.

Adopts changes in bazel to support .dSYM files (as part of fixing bazelbuild/bazel#16893).

Copy link
Member

@keith keith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test similar to

dsym_test(
name = "{}_generate_dsym_test".format(name),
tags = [name],
expected_argv = [
"-g",
"DSYM_HINT_LINKED_BINARY",
],
mnemonic = "ObjcLink",
target_under_test = "//test/test_data:macos_binary",
)
for this? I think it will have to be disabled until your bazel change lands but at least that would be useful to verify locally too.

nit: please run pre-commit to format the code with clang-format

I think the test failure here is related to this change, not 100% sure

Add support for generating a .dSYM file if this is requested using `--apple_generate_dsym`. This change contains the following patches:

* Add `-fdebug-prefix-map` and `-oso_prefix` compiler and linker flags as in more recent Xcode versions (16E140) it would cause sandbox paths leaking into the linked binaries.
* Add `DSYM_HINT` flags to be picked up by `wrapped_clang` to generate .dSYM bundles on request.
* In `wrapped_clang.cc` make sure the linked binary is stripped after generating the .dSYM bundle first to make the .dSYM bundle contain useful information.

Adopts recent changes in bazel to support .dSYM files (as part of fixing bazelbuild/bazel#16893).
@keith
Copy link
Member

keith commented Apr 24, 2025

i think this looks good but we need to wait for the bazel change to make sure this is the right path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants