Skip to content

Commit 212042c

Browse files
iainscatap
authored andcommitted
Darwin, Arm64 : Initial libgcc boiler-plate changes.
Initial changes to build libgcc for aarch64 Darwin (declare the port, and handle Mach-O assembler syntax). (cherry picked from commit d18d071c65d85610515ffc8b8db59805700c48f2) Signed-off-by: Kirill A. Korinsky <[email protected]>
1 parent 80d6f3b commit 212042c

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*-*-*)
@@ -419,6 +419,14 @@ aarch64*-*-elf | aarch64*-*-rtems*)
419419
tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
420420
md_unwind_header=aarch64/aarch64-unwind.h
421421
;;
422+
aarch64*-*darwin* | arm64*-*darwin* )
423+
extra_parts="$extra_parts crtfastmath.o"
424+
tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
425+
tmake_file="${tmake_file} ${cpu_type}/t-lse "
426+
tmake_file="${tmake_file} t-crtfm"
427+
# No soft float for now because our long double is DF not TF.
428+
md_unwind_header=aarch64/aarch64-unwind.h
429+
;;
422430
aarch64*-*-freebsd*)
423431
extra_parts="$extra_parts crtfastmath.o"
424432
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
@@ -164,6 +168,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
164168
#define BTI_C hint 34
165169

166170
/* Start and end a function. */
171+
#if __ELF__
167172
.macro STARTFN name
168173
.text
169174
.balign 16
@@ -187,6 +192,29 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
187192
cbz w(tmp0), \label
188193
.endm
189194

195+
#else
196+
.macro STARTFN name
197+
.text
198+
.balign 16
199+
.private_extern _\name
200+
.cfi_startproc
201+
_\name:
202+
BTI_C
203+
.endm
204+
205+
.macro ENDFN name
206+
.cfi_endproc
207+
.endm
208+
209+
/* Branch to LABEL if LSE is disabled. */
210+
.macro JUMP_IF_NOT_LSE label
211+
adrp x(tmp0), ___aarch64_have_lse_atomics@PAGE
212+
ldrb w(tmp0), [x(tmp0), ___aarch64_have_lse_atomics@PAGEOFF]
213+
cbz w(tmp0), \label
214+
.endm
215+
216+
#endif
217+
190218
#ifdef L_cas
191219

192220
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)