Skip to content

Commit

Permalink
Darwin, Arm64 : Initial changes to libitm.
Browse files Browse the repository at this point in the history
Just add Arm64 as a target and adjust the SjLj code to allow mach-o
assembler.
  • Loading branch information
iains committed Dec 5, 2020
1 parent cb63c18 commit f335f73
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
27 changes: 26 additions & 1 deletion libitm/config/aarch64/sjlj.S
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,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
CFI_PAC_KEY
PAC_AND_BTI
Expand All @@ -84,8 +93,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)
Expand All @@ -95,14 +109,23 @@ _ITM_beginTransaction:
CFI_PAC_TOGGLE
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
Expand All @@ -126,7 +149,9 @@ GTM_longjmp:
CFI_PAC_TOGGLE
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
Expand Down
2 changes: 1 addition & 1 deletion libitm/configure.tgt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit f335f73

Please # to comment.