Skip to content

[🍒 stable/20240723] [DWARFVerifier] Allow overlapping ranges for ICF-merged functions (#117952) #9952

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

Conversation

JDevlieghere
Copy link

Cherrypick upstream changes to allow overlapping ranges for ICF-merged functions.

alx32 added 3 commits February 4, 2025 10:46
…vm#117952)

This patch modifies the DWARF verifier to handle a valid case where two
or more functions have identical address ranges due to being merged by
ICF (Identical Code Folding). Previously, the verifier would incorrectly
report these as errors, but functions merged via ICF (such as when using
LLD's --keep-icf-stabs option) can legitimately share the same address
range.

A new test case has been added to verify this behavior using YAML-based
DWARF data that simulates two DW_TAG_subprogram entries with identical
address ranges. The test ensures that the verifier correctly identifies
this as a valid case and doesn't emit any errors, while still
maintaining the existing verification for truly invalid overlapping
ranges in other scenarios. Before this change, the newly added test case
would have failed, with `llvm-dwarfdump` marking the overlapping address
ranges in the DWARF as an error.

We also modify the existing tests `llvm-dwarfutil/ELF/X86/verify.test` and
`llvm/test/tools/llvm-dwarfdump/X86/verify_parent_zero_length.yaml`
which rely on the existence of the error that we're trying to
suppress. We slightly change one offset so that the ranges don't
perfectly overlap and an error is still generated.

(cherry picked from commit ad32576)
…F/DWARFVerifier.h (llvm#120322)

Disabling and forward fixing later.

(cherry picked from commit bb4007e)
…no_overlap_error_icf.yaml (llvm#120330)

Fixing broken test - calling `sed` in a cross-platform compatible way.
Verified to pass on Mac (which uses BSD sed).

(cherry picked from commit 1808255)
@JDevlieghere JDevlieghere requested a review from a team as a code owner February 4, 2025 18:46
@JDevlieghere
Copy link
Author

@swift-ci test

@JDevlieghere JDevlieghere merged commit dbb0934 into stable/20240723 Feb 5, 2025
3 checks passed
@JDevlieghere JDevlieghere deleted the cherrypick-stable/20240723-ad32576cffc8-bb4007e56274-1808255a44e6 branch February 5, 2025 01:56
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