From 2a4183234a45ba28db5ce16cf3ccdd70cdef3b7c Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Wed, 16 Dec 2020 22:26:18 +0000 Subject: [PATCH] rs6000: Add support for powerpc64le-unknown-freebsd This implements support for powerpc64le architecture on FreeBSD. Since we don't have powerpcle (32-bit), I did not add support for powerpcle here. This remains to be changed if there is powerpcle support in the future. 2020-12-15 Piotr Kubaj gcc/ * config.gcc (powerpc*le-*-freebsd*): Add. * configure.ac (powerpc*le-*-freebsd*): Ditto. * configure: Regenerate. * config/rs6000/freebsd64.h (ASM_SPEC_COMMON): Use ENDIAN_SELECT. (DEFAULT_ASM_ENDIAN): Add little endian support. (LINK_OS_FREEBSD_SPEC64): Ditto. --- gcc/config.gcc | 4 ++++ gcc/config/rs6000/freebsd64.h | 12 +++++++++--- gcc/configure | 3 +++ gcc/configure.ac | 3 +++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index 81b552383fb..70ecc51c1cf 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2865,6 +2865,10 @@ powerpc*-*-freebsd*) tm_file="${tm_file} dbxelf.h elfos.h gnu-user.h ${fbsd_tm_file} rs6000/sysv4.h" extra_options="${extra_options} rs6000/sysv4.opt" tmake_file="rs6000/t-fprules rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" + case ${target} in + powerpc*le-*-*) + tm_file="${tm_file} rs6000/sysv4le.h" ;; + esac case ${target} in powerpc64*) tm_file="${tm_file} rs6000/default64.h rs6000/freebsd64.h" diff --git a/gcc/config/rs6000/freebsd64.h b/gcc/config/rs6000/freebsd64.h index 4b2da571c4a..390bc4b73e6 100644 --- a/gcc/config/rs6000/freebsd64.h +++ b/gcc/config/rs6000/freebsd64.h @@ -99,8 +99,8 @@ extern int dot_symbols; #define ASM_SPEC64 "-a64" #define ASM_SPEC_COMMON "%(asm_cpu) \ -%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \ -%{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian}" +%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \ + ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN) #undef SUBSUBTARGET_EXTRA_SPECS #define SUBSUBTARGET_EXTRA_SPECS \ @@ -122,9 +122,15 @@ extern int dot_symbols; %{static:-Bstatic}} \ %{symbolic:-Bsymbolic}" +#undef DEFAULT_ASM_ENDIAN #define LINK_OS_FREEBSD_SPEC32 "-melf32ppc_fbsd " LINK_OS_FREEBSD_SPEC_DEF - +#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN) +#define DEFAULT_ASM_ENDIAN " -mlittle" +#define LINK_OS_FREEBSD_SPEC64 "-melf64lppc_fbsd " LINK_OS_FREEBSD_SPEC_DEF +#else +#define DEFAULT_ASM_ENDIAN " -mbig" #define LINK_OS_FREEBSD_SPEC64 "-melf64ppc_fbsd " LINK_OS_FREEBSD_SPEC_DEF +#endif #undef MULTILIB_DEFAULTS #define MULTILIB_DEFAULTS { "m64" } diff --git a/gcc/configure b/gcc/configure index 9a27e459f14..eedd8626cfd 100755 --- a/gcc/configure +++ b/gcc/configure @@ -30185,6 +30185,9 @@ case "$target:$tm_file" in *-*-linux*) emul_name="-melf64ppc" ;; + *le-*-freebsd*) + emul_name="-melf64lppc_fbsd" + ;; *-*-freebsd*) emul_name="-melf64ppc_fbsd" ;; diff --git a/gcc/configure.ac b/gcc/configure.ac index 062f57fa12b..ee982bee867 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -6274,6 +6274,9 @@ case "$target:$tm_file" in *-*-linux*) emul_name="-melf64ppc" ;; + *le-*-freebsd*) + emul_name="-melf64lppc_fbsd" + ;; *-*-freebsd*) emul_name="-melf64ppc_fbsd" ;;