From cc2d27806d9a7c0042fb6f60203cf12374c37673 Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sun, 16 Aug 2020 12:11:37 +0100 Subject: [PATCH] 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 --- libgcc/config.host | 10 +++++++++- libgcc/config/aarch64/lse.S | 28 ++++++++++++++++++++++++++++ libgcc/config/aarch64/t-darwin | 7 +++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 libgcc/config/aarch64/t-darwin diff --git libgcc/config.host libgcc/config.host index 66d7b37b0d6..dfaf5594d56 100644 --- libgcc/config.host +++ libgcc/config.host @@ -82,7 +82,7 @@ m32c*-*-*) cpu_type=m32c tmake_file=t-fdpbit ;; -aarch64*-*-*) +aarch64*-*-* | arm64*-*-*) cpu_type=aarch64 ;; alpha*-*-*) @@ -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" diff --git libgcc/config/aarch64/lse.S libgcc/config/aarch64/lse.S index 67a1108786f..2c6f7db6eb7 100644 --- libgcc/config/aarch64/lse.S +++ libgcc/config/aarch64/lse.S @@ -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 @@ -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 @@ -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) diff --git libgcc/config/aarch64/t-darwin libgcc/config/aarch64/t-darwin new file mode 100644 index 00000000000..a319bac7077 --- /dev/null +++ libgcc/config/aarch64/t-darwin @@ -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 -- 2.42.1