From a6e926d153ed9141f4ffc980fcd9de5f1dbaf099 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Tue, 18 Aug 2020 21:50:49 +0100 Subject: [PATCH] Darwin, Arm64 : Initial changes to libitm. Just add Arm64 as a target and adjust the SjLj code to allow mach-o assembler. (cherry picked from commit 8f9f06d1dfa4245a18260ade19829c933350e4c2) Signed-off-by: Kirill A. Korinsky --- libitm/config/aarch64/sjlj.S | 27 ++++++++++++++++++++++++++- libitm/configure.tgt | 2 +- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git libitm/config/aarch64/sjlj.S libitm/config/aarch64/sjlj.S index e2093ca1a97..0435d6d9286 100644 --- libitm/config/aarch64/sjlj.S +++ libitm/config/aarch64/sjlj.S @@ -28,10 +28,19 @@ .text .align 2 +#if __ELF__ .global _ITM_beginTransaction .type _ITM_beginTransaction, %function _ITM_beginTransaction: + +#elif __MACH__ + .global __ITM_beginTransaction + +__ITM_beginTransaction: + +#endif + cfi_startproc BTI_C mov x1, sp @@ -53,8 +62,13 @@ _ITM_beginTransaction: /* Invoke GTM_begin_transaction with the struct we just built. */ mov x1, sp +#if __ELF__ bl GTM_begin_transaction - +#elif __MACH__ + bl _GTM_begin_transaction +#else +#error "unexpected object format" +#endif /* Return; we don't need to restore any of the call-saved regs. */ ldp x29, x30, [sp], 11*16 cfi_adjust_cfa_offset(-11*16) @@ -62,14 +76,23 @@ _ITM_beginTransaction: cfi_restore(x30) ret cfi_endproc +#if __ELF__ .size _ITM_beginTransaction, . - _ITM_beginTransaction +#endif .align 2 +#if __ELF__ .global GTM_longjmp .hidden GTM_longjmp .type GTM_longjmp, %function GTM_longjmp: + +#elif __MACH__ + .private_extern _GTM_longjmp + +_GTM_longjmp: +#endif /* The first parameter becomes the return value (x0). The third parameter is ignored for now. */ cfi_startproc @@ -89,7 +112,9 @@ GTM_longjmp: mov sp, x3 br x30 cfi_endproc +#if __ELF__ .size GTM_longjmp, . - GTM_longjmp +#endif /* GNU_PROPERTY_AARCH64_* macros from elf.h for use in asm code. */ #define FEATURE_1_AND 0xc0000000 diff --git libitm/configure.tgt libitm/configure.tgt index d1beb5c9ec8..e0c952b6431 100644 --- libitm/configure.tgt +++ libitm/configure.tgt @@ -50,7 +50,7 @@ fi # Map the target cpu to an ARCH sub-directory. At the same time, # work out any special compilation flags as necessary. case "${target_cpu}" in - aarch64*) ARCH=aarch64 ;; + aarch64* | arm64*) ARCH=aarch64 ;; alpha*) ARCH=alpha ;; rs6000 | powerpc*) XCFLAGS="${XCFLAGS} -mhtm" -- 2.42.1