Skip to content

Commit

Permalink
ARM64: Fix Android linker issues (#25)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
RalfKornmannEnvision authored Sep 14, 2020
1 parent 7a16568 commit 05adeaa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Native/Runtime/unix/unixasmmacrosarm64.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/Native/libunwind/src/Registers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 05adeaa

Please sign in to comment.