Skip to content

[JITLink] Allow multiple relocations at same offset in EHFrameEdgeFixer #68252

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
merged 1 commit into from
Oct 22, 2023

Conversation

hahnjo
Copy link
Member

@hahnjo hahnjo commented Oct 4, 2023

The pass only requires that it can determine a uniquely identified target at some offsets. Multiple relocations at the same offset are fine otherwise and will be required when adding exception handling support for RISC-V.


This PR depends on #66707; only the top-most commit should be reviewed here.

@lhames
Copy link
Contributor

lhames commented Oct 5, 2023

Would disabling the assertion that there's a single edge in the EH-frame fixer fix the issue for now?

As a temporary fix I prefer commenting out the assertion. We could land this too, but I suspect we'll want to revert in the future and move to a design where edges support more than one target instead. I think we're gong to want to be able to say "what is the edge at this offset", then inspect the result, rather than parsing a sequence of edges at an offset to understand what's going on. We really need a proper discussion about this though.

@hahnjo
Copy link
Member Author

hahnjo commented Oct 5, 2023

Would disabling the assertion that there's a single edge in the EH-frame fixer fix the issue for now?

Of course, that is what https://reviews.llvm.org/D157802 originally proposed to do almost two months ago.

As a temporary fix I prefer commenting out the assertion. We could land this too, but I suspect we'll want to revert in the future and move to a design where edges support more than one target instead. I think we're gong to want to be able to say "what is the edge at this offset", then inspect the result, rather than parsing a sequence of edges at an offset to understand what's going on. We really need a proper discussion about this though.

And I personally don't like committing "temporary fixes" aka hacks. During the discussion, it became clear to me that https://reviews.llvm.org/D157802 is nothing more than a hack because the code relies on finding a uniquely identified target and the code should really check that this is possible. How would this work if a) there are multiple edges at that offset, or b) in the future there are edges with multiple targets?

@lhames
Copy link
Contributor

lhames commented Oct 6, 2023

And I personally don't like committing "temporary fixes" aka hacks.

If, as I suspect, we're going to enforce the single edge invariant in the future then this is also a temporary fix, though I'll grant you it's less of a hack. ;)

Are you happy to land this as a temporary fix for now on the understanding that it may need to be reverted, and the solution redesigned, once we come up with a long term design for LinkGraph edges?

@hahnjo
Copy link
Member Author

hahnjo commented Oct 12, 2023

Are you happy to land this as a temporary fix for now on the understanding that it may need to be reverted, and the solution redesigned, once we come up with a long term design for LinkGraph edges?

Yes absolutely, evolving design always needs to make sure the code is consistent. With the current design, I think the approach attempted in this PR is the most consistent we can do.

@lhames
Copy link
Contributor

lhames commented Oct 13, 2023

Perfect. In that case everything looks good to me — thanks for your patience with the review.

The pass only requires that it can determine a uniquely identified
target at some offsets. Multiple relocations at the same offset are
fine otherwise and will be required when adding exception handling
support for RISC-V.
@hahnjo hahnjo force-pushed the EHFrameSupport-multiple branch from a9d5110 to f143329 Compare October 14, 2023 21:09
@hahnjo
Copy link
Member Author

hahnjo commented Oct 14, 2023

FWIW after 0d0f219 this PR now needs a second change to make sure there aren't already two edges for the CIE pointer field...

@hahnjo hahnjo merged commit 508a697 into llvm:main Oct 22, 2023
@hahnjo hahnjo deleted the EHFrameSupport-multiple branch October 22, 2023 21:32
Guzhu-AMD pushed a commit to GPUOpen-Drivers/llvm-project that referenced this pull request Oct 26, 2023
Local branch amd-gfx 57bd898 Merged main:747e0d9f0aad into amd-gfx:fdf184dabd64
Remote branch main 508a697 [JITLink] Allow multiple relocations at same offset in EHFrameEdgeFixer (llvm#68252)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants