linux/arm/raw_syscall.h: avoid r7 specified register variables with Thumb
If Thumb code is being generated and frame pointers are enabled, the
Thumb frame pointer in r7 clashes with any local variable which may
need to be assigned to r7 (e.g. the syscall NR when making a raw
syscall).
With gcc, the double use of r7 results in a build error, e.g.
strace-4.22/tests/inject-nf.c:86:1: error: r7 cannot be used in asm here
With clang, the double use of r7 can result in the compiler silently
generating broken code which crashes at run time due to frame pointer
corruption:
https://bugs.llvm.org/show_bug.cgi?id=34165
In most cases the problem isn't visible as frame pointers will be
disabled automatically due to optimisation level. However to handle
cases where frame pointers are enabled (e.g. when CFLAGS etc are set
to support a debug build, etc) provide a version of raw_syscall_0
which manually saves and restores the frame pointer value in r7
to a temporary register before setting up the syscall NR in r7
and invoking the syscall.
* linux/arm/raw_syscall.h (raw_syscall_0) [__thumb__]: Provide
an alternative version.
Signed-off-by: Andre McCurdy <armccurdy@gmail.com>