Skip to content

[6.0][LLDB][ELF] Fix section unification to not just use names. #8669

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

Conversation

al45tair
Copy link

@al45tair al45tair commented May 1, 2024

Section unification cannot just use names, because it's valid for ELF binaries to have multiple sections with the same name. We should check other section properties too.

rdar://124467787

al45tair added 5 commits May 1, 2024 17:09
Section unification cannot just use names, because it's valid for ELF
binaries to have multiple sections with the same name.  We should check
other section properties too.

rdar://124467787
Fixed a couple of nits from review, and fixed up formatting.

Also added a test.

rdar://124467787
As pointed out by @labath, if you use `objcopy --only-keep-debug`, only
placeholder sections will be present so the file sizes won't match.

We already ignore file offsets when doing the comparison.

rdar://124467787
Rather than including a binary, use `yaml2obj` for the duplicate section
name test.

rdar://124467787
The section type can change when using `objcopy --only-keep-debug`,
apparently.

rdar://124467787
@al45tair
Copy link
Author

al45tair commented May 1, 2024

@swift-ci Please test

@al45tair al45tair requested review from JDevlieghere and etcwilde May 1, 2024 16:12
@al45tair
Copy link
Author

al45tair commented May 1, 2024

Explanation: This fixes an ELF-specific bug in LLDB where it can mis-resolve symbols in the presence of multiple sections that have the same name.
Original PR: llvm#90099
Risk: Low. This only affects ELF, and only then if someone is using an older version of gold.
Reviewed by: @JDevlieghere
Resolves: rdar://124467787
Tests: A test has been added to check that the fix works. It was run before the fix (and failed) and after the fix (and passes).

@al45tair al45tair changed the title [LLDB][ELF] Fix section unification to not just use names. [6.0][LLDB][ELF] Fix section unification to not just use names. May 3, 2024
Copy link

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

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

LGTM!

@JDevlieghere JDevlieghere merged commit 491ce66 into swiftlang:swift/release/6.0 May 3, 2024
3 checks passed
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