Skip to content

Commit b7575bf

Browse files
committed
Darwin, Arm64 : Initial libgcc boiler-plate changes.
Initial changes to build libgcc for aarch64 Darwin (declare the port, and handle Mach-O assembler syntax).
1 parent 45a4a0f commit b7575bf

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

libgcc/config.host

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ m32c*-*-*)
8282
cpu_type=m32c
8383
tmake_file=t-fdpbit
8484
;;
85-
aarch64*-*-*)
85+
aarch64*-*-* | arm64*-*-*)
8686
cpu_type=aarch64
8787
;;
8888
alpha*-*-*)
@@ -408,6 +408,14 @@ aarch64*-*-elf | aarch64*-*-rtems*)
408408
tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
409409
md_unwind_header=aarch64/aarch64-unwind.h
410410
;;
411+
aarch64*-*darwin* | arm64*-*darwin* )
412+
extra_parts="$extra_parts crtfastmath.o"
413+
tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
414+
tmake_file="${tmake_file} ${cpu_type}/t-lse "
415+
tmake_file="${tmake_file} t-crtfm"
416+
# No soft float for now because our long double is DF not TF.
417+
md_unwind_header=aarch64/aarch64-unwind.h
418+
;;
411419
aarch64*-*-freebsd*)
412420
extra_parts="$extra_parts crtfastmath.o"
413421
tmake_file="${tmake_file} ${cpu_type}/t-aarch64"

libgcc/config/aarch64/lse.S

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
5858
#endif
5959

6060
/* Declare the symbol gating the LSE implementations. */
61+
#if __ELF__
6162
.hidden __aarch64_have_lse_atomics
63+
#else
64+
.private_extern __aarch64_have_lse_atomics
65+
#endif
6266

6367
/* Turn size and memory model defines into mnemonic fragments. */
6468
#if SIZE == 1
@@ -139,6 +143,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
139143
#define BTI_C hint 34
140144

141145
/* Start and end a function. */
146+
#if __ELF__
142147
.macro STARTFN name
143148
.text
144149
.balign 16
@@ -162,6 +167,29 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
162167
cbz w(tmp0), \label
163168
.endm
164169

170+
#else
171+
.macro STARTFN name
172+
.text
173+
.balign 16
174+
.private_extern _\name
175+
.cfi_startproc
176+
_\name:
177+
BTI_C
178+
.endm
179+
180+
.macro ENDFN name
181+
.cfi_endproc
182+
.endm
183+
184+
/* Branch to LABEL if LSE is disabled. */
185+
.macro JUMP_IF_NOT_LSE label
186+
adrp x(tmp0), ___aarch64_have_lse_atomics@PAGE
187+
ldrb w(tmp0), [x(tmp0), ___aarch64_have_lse_atomics@PAGEOFF]
188+
cbz w(tmp0), \label
189+
.endm
190+
191+
#endif
192+
165193
#ifdef L_cas
166194

167195
STARTFN NAME(cas)

libgcc/config/aarch64/t-darwin

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# FIXME: decide what we need here, or delete this file.
2+
3+
HOST_LIBGCC2_CFLAGS += -mmacosx-version-min=11.0
4+
5+
LIB2_SIDITI_CONV_FUNCS = yes
6+
7+
# LIB2FUNCS_EXCLUDE = _fixtfdi _fixunstfdi _floatditf _floatunditf

0 commit comments

Comments
 (0)