-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
--fission=yes
alone does not generate real .dwp
files
#109
Labels
Comments
rrbutani
added a commit
to fishcakez/bazel-toolchain
that referenced
this issue
Sep 28, 2021
This has some things we'll eventually want to remove; see bazel-contrib#109 for some context.
rrbutani
added a commit
to fishcakez/bazel-toolchain
that referenced
this issue
Sep 28, 2021
…ated with clang-12+ Issue bazel-contrib#109 and [this comment](bazel-contrib#108 (comment)) have some context; the short version is that `-gsplit-dwarf` no longer implies `-g2` which means under `-c fastbuild` (implies `-g0`) no `.dwo` files are created. There's a patch to `unix_cc_toolchain_config.bzl` but for now we'll just use `-c dbg` for this one target using a transition.
rrbutani
added a commit
that referenced
this issue
Sep 28, 2021
* Fix including symlink extra files in dwp/objcopy * Add strip filegroups to support strip inside sandbox * tests: add a `.stripped` test * tests: test that `.dwp` targets can be built This has some things we'll eventually want to remove; see #109 for some context. * tests: have `dwp_file` transition to `-c dbg` so .dwo files are generated with clang-12+ Issue #109 and [this comment](#108 (comment)) have some context; the short version is that `-gsplit-dwarf` no longer implies `-g2` which means under `-c fastbuild` (implies `-g0`) no `.dwo` files are created. There's a patch to `unix_cc_toolchain_config.bzl` but for now we'll just use `-c dbg` for this one target using a transition. * tests: migration fixes Co-authored-by: Rahul Butani <[email protected]>
I submitted bazelbuild/bazel#14777 which solves one of the concerns above |
Thanks for this write up! It was super useful when tracing back android fission support which I'm working on here bazelbuild/bazel#14765 |
siddharthab
added
bug
Something isn't working
help wanted
Extra attention is needed
labels
Mar 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My understanding is that
--fission
is supposed to be a cross-platform way to generate separate debug info files for C/C++ rules (this is definitely stretching it a bit; I think--fission
is intended to be.dwo
/.dwp
specific – that is, it's not supposed to generate.dSYM
s on macOS and.pdb
s on Windows).In practice,
--fission=yes
alone does not generate non-empty.dwp
files;--features=per_object_debug_info
must also be specified.This is because
unix_cc_toolchain_config.bzl
'scc_toolchain_config
does not enable theper_object_debug_info
feature by default.Passing in
--features=per_object_debug_info
to enable it manually (i.e. in a.bazelrc
) is sub-optimal because this breaks compilation on other platforms like macOS where-gsplit-dwarf
has different behavior and will not produce.dwo
files (on macOS debug info lives in the.o
files – as in there is no.dwo
equivalent – and running with-gsplit-dwarf
when producing a binary will produce a.dSYM
file, the.dwp
equivalent).It seems better to have the toolchain – which knows the platform it targets and has enough information to choose to enable this feature – handle this rather than to foist this onto users (afaik there isn't a create way to deal with this outside of the toolchain anyways; best I can come up with is
build:linux --features=per_object_debug_info
and then requiring--config=linux
when building for Linux, etc.).I think it's actually safe for us to enable the
per_object_debug_info
feature by default on Linux because it's effectively gated onfission
:per_object_debug_info
feature (which we cans see introduces the-gsplit-dwarf
flag) lives hereper_object_debug_info_file
per_object_debug_info_file
comes from here in Bazel and is ultimately set by this bit inCompileBuildVariables.setupSpecificVariables
when given a realdwoFile
CcCompilationHelper.setupCompileBuildVariables
which just threads through thedwoFile
it's called withCcCompilationHelper.createSourceAction
which provide adwoFile
to ^ if they are passedgenerateDwo = true
CcCompilationHelper.createCcCompileActions
which ultimately ask the currentccToolchain
(CcToolchainProvider.shouldCreatePerObjectDebugInfo
) if generating per object debug info is enabled for the current feature configurationCcToolchainProvider.shouldCreatePerObjectDebugInfo
returns true only iffission
is enabled and if theper_object_debug_info
feature is enabledsteps
While we're still using
unix_cc_toolchain_config.bzl
there's not much we can do about this. These are notes for what to do when we eventually vendor in a version ofunix_cc_toolchain_config.bzl
(and potentially macOS and Windows host counterparts as well).per_object_debug_info
by defaultper_object_debug_info
flag explicitly; passing in--fission=yes
should be sufficient--features=per_object_debug_info
sets the debug level high enough to generate.dwo
filesper_object_debug_info
for Clang 12 and GCC 11 bazelbuild/rules_cc#115 has a fixper_object_debug_info
for Clang 12 and GCC 11 bazelbuild/rules_cc#115 doesn't get merged we should do something like it when we switch to using our ownunix_cc_toolchain_config.bzl
-c dbg
transition workaround that was added in Include the symlinked dwp/objcopy/strip files in the toolchain #108 when we do thisIt's not clear yet whether this is doable/sensible but it'd be nice to have
--fission
(or some flag like it) causerules_cc
to generate split debug info for all the targets that support it. This would mean:dSYM
files on macOS (but only on the final link step)--features=apple_generate_dsym
) but I don't think that helpsrules_cc
to give us top-level exposed.dSYM
targetsgenerate_pdb_file
which seems to work similarly enough to.dwp
files except that it'soutput_group
based instead of a separate target (it'd have been nice to just have adebug_info
output group for all these files...) and the logic seems to live inside ofbazel
instead of in the toolchain featuresAll in all, probably not pursuing. We should do the first thing though.
open questions
cc_toolchain
actually do.per_object_debug_info
feature is not associated with the toolchainsunix_cc_toolchain_config.bzl
produces for macOS but if I enable the feature manually with--features=per_object_debug_info
I can see that feature's flags being added to the commands executed)cc_common.create_cc_toolchain_config_info
ultimately is backed byccToolchainConfigInfoFromStarlark
but other than getting stored here I haven't really been able to tell what the features that are passed in get used for. I'll look into this more later.The text was updated successfully, but these errors were encountered: