From 61b51cfd89fcf770bf57c2776bef32a7ef08ab7c Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sun, 16 Aug 2020 12:11:37 +0100 Subject: [PATCH] libgcc, aarch64, Darwin: Initial libgcc boiler-plate changes. Initial changes to build libgcc for aarch64 Darwin (declare the port, handle Mach-O assembler syntax and arrange for building the main extra pieces). --- 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 a/libgcc/config.host b/libgcc/config.host index 298a4e96f42c..d673488346bb 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -82,7 +82,7 @@ m32c*-*-*) cpu_type=m32c tmake_file=t-fdpbit ;; -aarch64*-*-*) +aarch64*-*-* | arm64*-*-*) cpu_type=aarch64 ;; alpha*-*-*) @@ -407,6 +407,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 a/libgcc/config/aarch64/lse.S b/libgcc/config/aarch64/lse.S index c353ec2215bd..4fb6309396fb 100644 --- a/libgcc/config/aarch64/lse.S +++ b/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 @@ -139,6 +143,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 @@ -162,6 +167,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 a/libgcc/config/aarch64/t-darwin b/libgcc/config/aarch64/t-darwin new file mode 100644 index 000000000000..fd21f0b37b02 --- /dev/null +++ b/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 + +BUILD_LIBGCCS1 =