Skip to content

Commit 421198e

Browse files
committed
aarch64, Darwin: Initial changes to libitm.
Just add Arm64 as a target and adjust the SjLj code to allow mach-o assembler.
1 parent f99a38d commit 421198e

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

libitm/config/aarch64/sjlj.S

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,19 @@
5757

5858
.text
5959
.align 2
60+
#if __ELF__
6061
.global _ITM_beginTransaction
6162
.type _ITM_beginTransaction, %function
6263

6364
_ITM_beginTransaction:
65+
66+
#elif __MACH__
67+
.global __ITM_beginTransaction
68+
69+
__ITM_beginTransaction:
70+
71+
#endif
72+
6473
cfi_startproc
6574
CFI_PAC_KEY
6675
PAC_AND_BTI
@@ -84,8 +93,13 @@ _ITM_beginTransaction:
8493

8594
/* Invoke GTM_begin_transaction with the struct we just built. */
8695
mov x1, sp
96+
#if __ELF__
8797
bl GTM_begin_transaction
88-
98+
#elif __MACH__
99+
bl _GTM_begin_transaction
100+
#else
101+
#error "unexpected object format"
102+
#endif
89103
/* Return; we don't need to restore any of the call-saved regs. */
90104
ldp x29, x30, [sp], 11*16
91105
cfi_adjust_cfa_offset(-11*16)
@@ -95,14 +109,23 @@ _ITM_beginTransaction:
95109
CFI_PAC_TOGGLE
96110
ret
97111
cfi_endproc
112+
#if __ELF__
98113
.size _ITM_beginTransaction, . - _ITM_beginTransaction
114+
#endif
99115

100116
.align 2
117+
#if __ELF__
101118
.global GTM_longjmp
102119
.hidden GTM_longjmp
103120
.type GTM_longjmp, %function
104121

105122
GTM_longjmp:
123+
124+
#elif __MACH__
125+
.private_extern _GTM_longjmp
126+
127+
_GTM_longjmp:
128+
#endif
106129
/* The first parameter becomes the return value (x0).
107130
The third parameter is ignored for now. */
108131
cfi_startproc
@@ -126,7 +149,9 @@ GTM_longjmp:
126149
CFI_PAC_TOGGLE
127150
br x30
128151
cfi_endproc
152+
#if __ELF__
129153
.size GTM_longjmp, . - GTM_longjmp
154+
#endif
130155

131156
/* GNU_PROPERTY_AARCH64_* macros from elf.h for use in asm code. */
132157
#define FEATURE_1_AND 0xc0000000

libitm/configure.tgt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fi
5050
# Map the target cpu to an ARCH sub-directory. At the same time,
5151
# work out any special compilation flags as necessary.
5252
case "${target_cpu}" in
53-
aarch64*) ARCH=aarch64 ;;
53+
aarch64* | arm64*) ARCH=aarch64 ;;
5454
alpha*) ARCH=alpha ;;
5555
rs6000 | powerpc*)
5656
XCFLAGS="${XCFLAGS} -mhtm"

0 commit comments

Comments
 (0)