diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 534dbea43887..9609d164c2e0 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -28901,7 +28901,7 @@ aarch64_libgcc_floating_mode_supported_p /* The architecture reserves bits 0 and 1 so use bit 2 for descriptors. */ #undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS -#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 4 +#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS AARCH64_CUSTOM_FUNCTION_TEST #undef TARGET_HARD_REGNO_NREGS #define TARGET_HARD_REGNO_NREGS aarch64_hard_regno_nregs diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index 15ab8338ebf2..c916b605190f 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -146,6 +146,12 @@ /* Heap alignment (same as BIGGEST_ALIGNMENT and STACK_BOUNDARY). */ #define MALLOC_ABI_ALIGNMENT 128 +/* We will and with this value to test if a custom function descriptor needs + a static chain. The function boundary must the adjusted so that the bit + this represents is no longer part of the address. 0 Disables the custom + function descriptors. */ +#define AARCH64_CUSTOM_FUNCTION_TEST 4 + /* Defined by the ABI */ #define WCHAR_TYPE "unsigned int" #define WCHAR_TYPE_SIZE 32 diff --git a/gcc/config/aarch64/darwin.h b/gcc/config/aarch64/darwin.h index 4a3608014b86..5609c569dc12 100644 --- a/gcc/config/aarch64/darwin.h +++ b/gcc/config/aarch64/darwin.h @@ -54,6 +54,10 @@ along with GCC; see the file COPYING3. If not see #undef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE 64 +/* Disable custom function descriptors on Darwin, it breaks ABI. */ +#undef AARCH64_CUSTOM_FUNCTION_TEST +#define AARCH64_CUSTOM_FUNCTION_TEST 0 + /* Non-PIE executables are forbidden by the aarch64-darwin security model; remove the option from link-lines since they just produce a warning from ld64 and are then ignored anyway. */ @@ -268,3 +272,8 @@ along with GCC; see the file COPYING3. If not see #define SYMBOL_FLAG_SUBT_DEP (SYMBOL_FLAG_MACH_DEP) #undef ASM_OUTPUT_DEF_FROM_DECLS + +#undef CLEAR_INSN_CACHE +#define CLEAR_INSN_CACHE(beg, end) \ + extern void sys_icache_invalidate(void *start, size_t len); \ + sys_icache_invalidate ((beg), (size_t)((end)-(beg))) diff --git a/libgcc/config.host b/libgcc/config.host index d1db17d4e606..82b69716d37d 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*-*-*) @@ -272,7 +272,7 @@ case ${host} in if test "x$enable_darwin_at_rpath" = "xyes"; then tmake_file="$tmake_file t-darwin-rpath " fi - extra_parts="crt3.o libd10-uwfef.a crttms.o crttme.o libemutls_w.a" + extra_parts="crt3.o crttms.o crttme.o libemutls_w.a " ;; *-*-dragonfly*) tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip" @@ -416,6 +416,16 @@ aarch64*-*-elf | aarch64*-*-rtems*) tmake_file="${tmake_file} t-dfprules" md_unwind_header=aarch64/aarch64-unwind.h ;; +aarch64*-*-darwin*) + extra_parts="$extra_parts crtfastmath.o" + 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 + if test x$off_stack_trampolines = xyes; then + tmake_file="${tmake_file} ${cpu_type}/t-heap-trampoline" + fi + ;; aarch64*-*-freebsd*) extra_parts="$extra_parts crtfastmath.o" tmake_file="${tmake_file} ${cpu_type}/t-aarch64" @@ -715,11 +725,13 @@ hppa*-*-netbsd*) i[34567]86-*-darwin*) tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-msabi" tm_file="$tm_file i386/darwin-lib.h" + extra_parts="$extra_parts libd10-uwfef.a " extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" ;; x86_64-*-darwin*) tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-msabi" tm_file="$tm_file i386/darwin-lib.h" + extra_parts="$extra_parts libd10-uwfef.a " extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" if test x$off_stack_trampolines = xyes; then tmake_file="${tmake_file} i386/t-heap-trampoline" @@ -1201,12 +1213,14 @@ powerpc-*-darwin*) # We build the darwin10 EH shim for Rosetta (running on x86 machines). tm_file="$tm_file i386/darwin-lib.h" tmake_file="$tmake_file rs6000/t-ppc64-fp rs6000/t-ibm-ldouble" + extra_parts="$extra_parts libd10-uwfef.a " extra_parts="$extra_parts crt2.o crt3_2.o libef_ppc.a dw_ppc.o" ;; powerpc64-*-darwin*) # We build the darwin10 EH shim for Rosetta (running on x86 machines). tm_file="$tm_file i386/darwin-lib.h" tmake_file="$tmake_file rs6000/t-darwin64 rs6000/t-ibm-ldouble" + extra_parts="$extra_parts libd10-uwfef.a " extra_parts="$extra_parts crt2.o crt3_2.o libef_ppc.a dw_ppc.o" ;; powerpc*-*-freebsd*) diff --git a/libgcc/config/aarch64/lse.S b/libgcc/config/aarch64/lse.S index dde3a28e07b1..87ee33bc52a5 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 @@ -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 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 =