diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-01-07 17:35:18 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-01-07 20:27:57 +0100 |
commit | 386248c9c2de669c211ba5a06afc8466f14c542b (patch) | |
tree | 460cfb689cb887d5a39bead8d4799c5907d8ff5e | |
parent | 8cd00ec92f291dd01e0eed27fc144785bed5e44e (diff) |
aarch64 r18 is reserved at least on Android
<https://github.com/ARM-software/software-standards/blob/master/abi/aapcs64/
aapcs64.rst> states: "The role of register r18 is platform specific. If a
platform ABI has need of a dedicated general purpose register to carry inter-
procedural state (for example, the thread context) then it should use this
register for that purpose. If the platform ABI has no such requirements, then
it should use r18 as an additional temporary register."
For a --host=aarch64-linux-android build, Clang warned
> bridges/source/cpp_uno/gcc3_linux_aarch64/callvirtualfunction.cxx:39:9: error: inline asm clobber list contains reserved registers: X18 [-Werror,-Winline-asm]
> "ldp x0, x1, [%[gpr_]]\n\t"
> ^
> <inline asm>:1:1: note: instantiated into assembly here
> ldp x0, x1, [x20]
> ^
> bridges/source/cpp_uno/gcc3_linux_aarch64/callvirtualfunction.cxx:39:9: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
> "ldp x0, x1, [%[gpr_]]\n\t"
> ^
> <inline asm>:1:1: note: instantiated into assembly here
> ldp x0, x1, [x20]
> ^
and <https://github.com/llvm/llvm-project/commit/
9c9c8b22d2ea150cc889232871b0c8303d3644d9> "Start reserving x18 by default on
Android targets" shows that at least LLVM/Clang claims that the Android ABI
reserves it (though it doesn't cite any sources for that).
(If this bridges/source/cpp_uno/ implementation is used for other non-Linux OS
like Fuchsia, we may need to extend the #if accordingly; see the above LLVM
commit for which platforms it claims reserve the register.)
Change-Id: I62a5210ddc4784eee2ab56ee134b9e195827b9dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86366
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_aarch64/callvirtualfunction.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_aarch64/callvirtualfunction.cxx b/bridges/source/cpp_uno/gcc3_linux_aarch64/callvirtualfunction.cxx index 2f7188ea4f99..ba5194d6f8c8 100644 --- a/bridges/source/cpp_uno/gcc3_linux_aarch64/callvirtualfunction.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_aarch64/callvirtualfunction.cxx @@ -54,8 +54,11 @@ void callVirtualFunction( [ret_]"m" (ret), "m" (stackargs) // dummy input to prevent optimizing the alloca away : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", - "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18"/*TODO?*/, "v0", - "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", + "r11", "r12", "r13", "r14", "r15", "r16", "r17", +#if !defined ANDROID + "r18"/*TODO?*/, +#endif + "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "memory" |