aarch64 r18 is reserved at least on Android

Desktop / LibreOffice - Stephan Bergmann [redhat.com] - 7 January 2020 19:27 EST

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" > ^ > :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" > ^ > :1:1: note: instantiated into assembly here > ldp x0, x1, [x20] > ^

and "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

386248c9c2de aarch64 r18 is reserved at least on Android
bridges/source/cpp_uno/gcc3_linux_aarch64/callvirtualfunction.cxx | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Upstream: cgit.freedesktop.org


  • Share