From 2dfab60ad1c3d0fe0241b5e2503fb3f8d33e4c22 Mon Sep 17 00:00:00 2001 From: RalfKornmannEnvision Date: Mon, 14 Sep 2020 20:57:04 +0200 Subject: [PATCH] ARM64: Fix Android linker issues (#8326) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add implementation for unused function in libunwind that is not removed by the Android linker - Fix the data type for the pointer to return address macro as the android linker did not relocate the full address with the wrong type - Make all assembler functions hidden. This way they are not added to the GOT. This forces the linker to resolve all calls to the functions itself instead of using the PLT. Using the PLT will trash X16&X17. Some of the functions implemented in assembler require that these two register are not changed. Beside of this using the PLT adds more overhead. --- src/Native/Runtime/unix/unixasmmacrosarm64.inc | 6 +++++- src/Native/libunwind/src/Registers.hpp | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Native/Runtime/unix/unixasmmacrosarm64.inc b/src/Native/Runtime/unix/unixasmmacrosarm64.inc index 123768cb953..66574a6b544 100644 --- a/src/Native/Runtime/unix/unixasmmacrosarm64.inc +++ b/src/Native/Runtime/unix/unixasmmacrosarm64.inc @@ -21,16 +21,19 @@ C_FUNC(\Name): .macro ALTERNATE_ENTRY Name .global C_FUNC(\Name) + .hidden C_FUNC(\Name) C_FUNC(\Name): .endm .macro LABELED_RETURN_ADDRESS Name .global C_FUNC(\Name) + .hidden C_FUNC(\Name) C_FUNC(\Name): .endm .macro LEAF_ENTRY Name, Section .global C_FUNC(\Name) + .hidden C_FUNC(\Name) .type \Name, %function C_FUNC(\Name): .cfi_startproc @@ -271,8 +274,9 @@ C_FUNC(\Name): .data .align 8 C_FUNC(\Name): - .word 1b + .quad 1b .global C_FUNC(\Name) + .hidden C_FUNC(\Name) .text .endm diff --git a/src/Native/libunwind/src/Registers.hpp b/src/Native/libunwind/src/Registers.hpp index 9f82d5c6766..e2f05fb0990 100644 --- a/src/Native/libunwind/src/Registers.hpp +++ b/src/Native/libunwind/src/Registers.hpp @@ -2174,6 +2174,8 @@ inline const char *Registers_arm64::getRegisterName(int regNum) { } } +inline void Registers_arm64::jumpto() {} + inline bool Registers_arm64::validFloatRegister(int regNum) const { if (regNum < UNW_ARM64_D0) return false;