-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Mach-O check for improperly nested .cfi_* regions doesn't take .alt_entry into account #97116
Comments
The intent, AFAIU, is to allow this, but I'll defer to Maskray on the The problematic case is when you have multiple independent functions that span a single cfi region when |
I agree that the example should be supported. The bug resides in our |
Patch: #97479 |
Thanks! |
The current `setAtom` is inaccurate: a `.alt_entry` label can also be recognized as an atom. This is mostly benign, but might cause two locations only separated by an `.alt_entry` to have different atoms. https://reviews.llvm.org/D153167 changed a `evaluateKnownAbsolute` to `evaluateAsAbsolute` and would not fold `A-B` even if they are only separated by a `.alt_entry` label, leading to a spurious error `invalid CFI advance_loc expression`. The fix is similar to llvm#82268: add a special case for `.alt_entry`. Fix llvm#97116 Pull Request: llvm#97479
The current `setAtom` is inaccurate: a `.alt_entry` label can also be recognized as an atom. This is mostly benign, but might cause two locations only separated by an `.alt_entry` to have different atoms. https://reviews.llvm.org/D153167 changed a `evaluateKnownAbsolute` to `evaluateAsAbsolute` and would not fold `A-B` even if they are only separated by a `.alt_entry` label, leading to a spurious error `invalid CFI advance_loc expression`. The fix is similar to llvm#82268: add a special case for `.alt_entry`. Fix llvm#97116 Pull Request: llvm#97479
This is a similar case to #82261 where an exception was added to for
.alt_entry
to thenon-private labels cannot appear between .cfi_startproc / .cfi_endproc pairs
check.Commit 0b06727 introduced the
invalid CFI advance_loc expression
error with seemingly similar intentions.Now, let's look at this example code:
My assumption is that
.alt_entry
should be exempt from the "advance_loc" check just like it's exempt from the "cfi_startproc/cfi_endproc" check. Feel free to correct my expectations if they are wrong.As for the real world use case, this came up as an issue in the Microsoft .NET Runtime. There are some functions written in assembly that may trigger an AV at specified code points. The intention of the labels inside those functions is to mark the address of the instruction that triggers the AV so a signal handler can process it appropriately. It's not a callable entrypoint, just a way to get address of a given instruction.
The text was updated successfully, but these errors were encountered: