Skip to content

Commit

Permalink
Darwin, Arm64 : Initial libgcc boiler-plate changes.
Browse files Browse the repository at this point in the history
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 <kirill@korins.ky>
  • Loading branch information
iains authored and catap committed Nov 14, 2023
1 parent a2982a4 commit cc2d278
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
10 changes: 9 additions & 1 deletion libgcc/config.host
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ m32c*-*-*)
cpu_type=m32c
tmake_file=t-fdpbit
;;
aarch64*-*-*)
aarch64*-*-* | arm64*-*-*)
cpu_type=aarch64
;;
alpha*-*-*)
Expand Down Expand Up @@ -419,6 +419,14 @@ aarch64*-*-elf | aarch64*-*-rtems*)
tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp t-crtfm"
md_unwind_header=aarch64/aarch64-unwind.h
;;
aarch64*-*darwin* | arm64*-*darwin* )
extra_parts="$extra_parts crtfastmath.o"
tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
tmake_file="${tmake_file} ${cpu_type}/t-lse "
tmake_file="${tmake_file} t-crtfm"
# No soft float for now because our long double is DF not TF.
md_unwind_header=aarch64/aarch64-unwind.h
;;
aarch64*-*-freebsd*)
extra_parts="$extra_parts crtfastmath.o"
tmake_file="${tmake_file} ${cpu_type}/t-aarch64"
Expand Down
28 changes: 28 additions & 0 deletions libgcc/config/aarch64/lse.S
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#endif

/* Declare the symbol gating the LSE implementations. */
#if __ELF__
.hidden __aarch64_have_lse_atomics
#else
.private_extern __aarch64_have_lse_atomics
#endif

/* Turn size and memory model defines into mnemonic fragments. */
#if SIZE == 1
Expand Down Expand Up @@ -164,6 +168,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define BTI_C hint 34

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

#else
.macro STARTFN name
.text
.balign 16
.private_extern _\name
.cfi_startproc
_\name:
BTI_C
.endm

.macro ENDFN name
.cfi_endproc
.endm

/* Branch to LABEL if LSE is disabled. */
.macro JUMP_IF_NOT_LSE label
adrp x(tmp0), ___aarch64_have_lse_atomics@PAGE
ldrb w(tmp0), [x(tmp0), ___aarch64_have_lse_atomics@PAGEOFF]
cbz w(tmp0), \label
.endm

#endif

#ifdef L_cas

STARTFN NAME(cas)
Expand Down
7 changes: 7 additions & 0 deletions libgcc/config/aarch64/t-darwin
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# FIXME: decide what we need here, or delete this file.

HOST_LIBGCC2_CFLAGS += -mmacosx-version-min=11.0

LIB2_SIDITI_CONV_FUNCS = yes

# LIB2FUNCS_EXCLUDE = _fixtfdi _fixunstfdi _floatditf _floatunditf

0 comments on commit cc2d278

Please sign in to comment.