forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 353
🍒[llvm][dsymutil] Use the DW_AT_name of the uniqued DIE for insertion into .debug_names #11896
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
Merged
JDevlieghere
merged 2 commits into
swift/release/6.3
from
dsymutil/debug-names-insertion-to-6.3
Dec 3, 2025
Merged
🍒[llvm][dsymutil] Use the DW_AT_name of the uniqued DIE for insertion into .debug_names #11896
JDevlieghere
merged 2 commits into
swift/release/6.3
from
dsymutil/debug-names-insertion-to-6.3
Dec 3, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently the tests for LLVM targets `AArch64` and `ARM` were in the same directory. But if you only configured LLVM for one target (e.g., just `AArch64`, which is how I ran into this), then all tests under the ARM directory are marked `UNSUPPORTED`. This patch moves all the tests that are capable of running on `AArch64`-only targets into a dedicated `AArch64` directory. The tests that expected a plain `ARM` target were kept in the `ARM` directory. Drive-by: * Rename the `dummy-debug-map-amr64.map` to `dummy-debug-map-arm64.map` (note the typo in `amr64`) (cherry picked from commit f163081)
…into .debug_names (llvm#168513) Depends on: * llvm#168895 Note, the last commit is the one with the actual fix. The others are drive-by/test changes We've been seeing dsymutil verification failures like: ``` error: Name Index @ 0x0: Entry @ 0x11949d: mismatched Name of DIE @ 0x9c644c: index - apply<(lambda at /some/build/dir/lib/LLVMSupport/include/llvm/Support/Error.h:1070:35)>; debug_info - apply<(lambda at /some/build/dir/lib/LLVMCustom/include/llvm/Support/Error.h:1070:35)> apply, _ZN11custom_llvm18ErrorHandlerTraitsIRFvRNS_13ErrorInfoBaseEEE5applyIZNS_12consumeErrorENS_5ErrorEEUlRKS1_E_EES7_OT_NSt3__110unique_ptrIS1_NSD_14default_deleteIS1_EEEE. ``` Not how the name of the DIE has a different lambda path than the one that was used to insert the DIE into debug_names. The root cause of the issue is that we have a DW_AT_subprogram definition whose DW_AT_specification DIE got deduplicated. But the DW_AT_name of the original specification is different than the one it got uniqued to. That’s technically fine because dsymutil uniques by linkage name, which uniquely identifies any function with non-internal linkage. But we insert the definition DIE into the debug-names table using the DW_AT_name of the original specification (we call `getDIENames(InputDIE…)`). But what we really want to do is use the name of the adjusted `DW_AT_specifcation` (i.e., the `DW_AT_specification` of the output DIE). That’s not as simple as it sounds because we can’t just get ahold of the DIE in the output CU. We have to grab the ODR `DeclContext` of the input DIE’s specification. That is the only link back to the canonical specification DIE. For that to be of any use, we have to stash the `DW_AT_name` into `DeclContext` so we can use it in `getDIENames`. We have to account for the possibility of multiple levels of `DW_AT_specification`/`DW_AT_abstract_origin`. So my proposed solution is to recursively scan the referenced DIE’s, grab the canonical DIE for those and get the name from the `DeclContext` (if none exists then use the `DW_AT_name` of the DIE itself). One remaining question is whether we need to handle the case where a DIE has a `DW_AT_specification` *and* a `DW_AT_abstract_origin`? That complicates the way we locate `DW_AT_name`. We'd have to adjust `getCanonicalDIEName` to handle this. But it's not clear what a `DW_AT_name` would be for such cases. Worst case at the moment we take the wrong path up the specifications and don't find any `DW_AT_name`, and don't end up indexing that DIE. Something to keep an eye out for. rdar://149239553 (cherry picked from commit 0549aa1)
Author
|
@swift-ci test |
Author
|
@swift-ci test macOS |
Author
|
@swift-ci test windows |
Author
|
@swift-ci test |
JDevlieghere
approved these changes
Dec 1, 2025
JDevlieghere
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Reviewed by me upstream.
Author
|
@swift-ci test windows |
felipepiovezan
added a commit
to felipepiovezan/llvm-project
that referenced
this pull request
Dec 4, 2025
These tests were by accident [1] when cherry-picking a commit that was a splitting an upstream test directory into two. These tests existed upstream but not downstream, and should have been deleted during the cherry-pick. [1]: swiftlang#11896
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We've been seeing dsymutil verification failures like:
Not how the name of the DIE has a different lambda path than the one
that was used to insert the DIE into debug_names.
The root cause of the issue is that we have a DW_AT_subprogram
definition whose DW_AT_specification DIE got deduplicated. But the
DW_AT_name of the original specification is different than the one it
got uniqued to. That’s technically fine because dsymutil uniques by
linkage name, which uniquely identifies any function with non-internal
linkage.
But we insert the definition DIE into the debug-names table using the
DW_AT_name of the original specification (we call
getDIENames(InputDIE…)). But what we really want to do is use the nameof the adjusted
DW_AT_specifcation(i.e., theDW_AT_specificationofthe output DIE). That’s not as simple as it sounds because we can’t just
get ahold of the DIE in the output CU. We have to grab the ODR
DeclContextof the input DIE’s specification. That is the only linkback to the canonical specification DIE. For that to be of any use, we
have to stash the
DW_AT_nameintoDeclContextso we can use it ingetDIENames.We have to account for the possibility of multiple levels of
DW_AT_specification/DW_AT_abstract_origin. So my proposed solutionis to recursively scan the referenced DIE’s, grab the canonical DIE for
those and get the name from the
DeclContext(if none exists then usethe
DW_AT_nameof the DIE itself).One remaining question is whether we need to handle the case where a DIE
has a
DW_AT_specificationand aDW_AT_abstract_origin? Thatcomplicates the way we locate
DW_AT_name. We'd have to adjustgetCanonicalDIENameto handle this. But it's not clear what aDW_AT_namewould be for such cases. Worst case at the moment we takethe wrong path up the specifications and don't find any
DW_AT_name,and don't end up indexing that DIE. Something to keep an eye out for.
rdar://149239553
(cherry picked from commit 0549aa1)