-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[clang][ARM] Add a warning for calling an __attribute__((interrupt))
function
#95359
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
Labels
clang:diagnostics
New/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Comments
__attribute__((interrupt))
function
__attribute__((interrupt))
function__attribute__((interrupt))
function
chrisnc
added a commit
to chrisnc/llvm-project
that referenced
this issue
Jun 14, 2024
chrisnc
added a commit
to chrisnc/llvm-project
that referenced
this issue
Jun 23, 2024
chrisnc
added a commit
to chrisnc/llvm-project
that referenced
this issue
Jun 28, 2024
chrisnc
added a commit
to chrisnc/llvm-project
that referenced
this issue
Jul 2, 2024
chrisnc
added a commit
to chrisnc/llvm-project
that referenced
this issue
Jul 9, 2024
chrisnc
added a commit
to chrisnc/llvm-project
that referenced
this issue
Jul 10, 2024
chrisnc
added a commit
to chrisnc/llvm-project
that referenced
this issue
Jul 10, 2024
aaryanshukla
pushed a commit
to aaryanshukla/llvm-project
that referenced
this issue
Jul 14, 2024
[clang][ARM] Fix warning for using VFP from interrupts. This warning has three issues: - The interrupt attribute causes the function to return using an exception return instruction. This warning allows calls from one function with the interrupt attribute to another, and the diagnostic text suggests that not having the attribute on the callee is a problem. Actually making such a call will lead to a double exception return, which is unpredictable according to the ARM architecture manual section B9.1.1, "Restrictions on exception return instructions". Even on machines where an exception return from user/system mode is tolerated, if the callee's interrupt type is anything other than a supervisor call or secure monitor call, it will also return to a different address than a normal function would. For example, returning from an "IRQ" handler will return to lr - 4, which will generally result in calling the same function again. - The interrupt attribute currently does not cause caller-saved VFP registers to be saved and restored if they are used, so putting __attribute__((interrupt)) on a called function doesn't prevent it from clobbering VFP state. - It is part of the -Wextra diagnostic group and can't be individually disabled when using -Wextra, which also means the diagnostic text of this specific warning appears in the documentation of -Wextra. This change addresses all three issues by instead generating a warning for any interrupt handler where the vfp feature is enabled. The warning is also given its own diagnostic group. Closes llvm#34876. [clang][ARM] Emit an error when an interrupt handler is called. Closes llvm#95359.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:diagnostics
New/improved warning or error message in Clang, but not in clang-tidy or static analyzer
Uh oh!
There was an error while loading. Please reload this page.
#91870 fixes a warning that's existed for a while for bare-metal Arm targets which encourages calling interrupt handlers from other interrupt handlers. Doing this leads to unpredictable behavior and/or infinite loops due to how Arm exception returns are defined: #91870 (comment).
clang
should instead warn when you try to call an interrupt handler from anywhere.The text was updated successfully, but these errors were encountered: