[all-commits] [llvm/llvm-project] 588a6d: [clang][ARM] Fix warning for using VFP from interr...
Chris Copeland via All-commits
all-commits at lists.llvm.org
Wed Jul 10 08:33:09 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 588a6d7de612bd19dc262563978711233b74e783
https://github.com/llvm/llvm-project/commit/588a6d7de612bd19dc262563978711233b74e783
Author: Chris Copeland <chris at chrisnc.net>
Date: 2024-07-10 (Wed, 10 Jul 2024)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/lib/Sema/SemaARM.cpp
M clang/lib/Sema/SemaExpr.cpp
M clang/test/Sema/arm-interrupt-attr.c
Log Message:
-----------
[clang][ARM] Fix warning for using VFP from interrupts. (#91870)
[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 #34876.
[clang][ARM] Emit an error when an interrupt handler is called.
Closes #95359.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list