-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[DebugInfo] Init DwarfVersion of MCOptions like the other. #146666
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
Sockke
wants to merge
5
commits into
llvm:main
Choose a base branch
from
Sockke:init-mc-dwarf-version
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+19
−0
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1a402b0
Init DwarfVersion of MCOptions like the other.
Sockke a0946b8
Init DwarfVersion of MCOptions like the other.
Sockke 3e6b1a9
added test
Sockke f4ae4d2
Merge branch 'init-mc-dwarf-version' of https://github.com/Sockke/llv…
Sockke 17d6e57
Merge branch 'main' into init-mc-dwarf-version
Sockke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
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.
Is this actually the behavior we want? Normally, I'd expect bitcode files to already have a version specified; when clang generates LLVM IR, it generates the DWARF version as metadata. This patch explicitly overrides that version in favor of whatever is specified on the command-line when the bitcode is lowered to asm.
Overriding the version won't really work right, anyway: clang generates different debug info depending on the version it's targeting.
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.
The effective value of DwarfVersion was designed to let MCOptions override the metadata, including Dwarf64. However, unlike other options, DwarfVersion was not initialized by CodeGenOpts.
Sorry, could you please explain in detail why it's not working properly?
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.
(Thanks for the test case)
(I'd like to hear more of @efriedma-quic's perspective/understanding to be sure)
Though I think for LTO - I believe the metadata already gets min/maxed (whichever way we do that - ah, it's "Max" - so if you have IR bitcode that's DWARFv4 and some that's DWARFv5 and you IR link it, you get DWARFv5 across the board) - so DWARF metadata emitted for 4 can end up emitted as 5 at least... going backwards might be less well/not at all tested, though...
Not sure what the right direction is here, then.
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.
clang CodeGen has checks for the target DWARF version. If clang generates v5 DWARF and you override it to v4, you won't get the same result you would if you originally generated v5. Which could mean debuggers get confused by the resulting DWARF.