rs6000: Add support for powerpc64le-unknown-freebsd
authorPiotr Kubaj <pkubaj@FreeBSD.org>
Wed, 16 Dec 2020 22:26:18 +0000 (22:26 +0000)
committerSegher Boessenkool <segher@kernel.crashing.org>
Wed, 16 Dec 2020 22:54:51 +0000 (22:54 +0000)
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  <pkubaj@FreeBSD.org>

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
gcc/config/rs6000/freebsd64.h
gcc/configure
gcc/configure.ac

index 81b552383fba523d780afd43b9e9074bdc6adc7c..70ecc51c1cfe9dffd428e4e68c6cdae8df7e5a91 100644 (file)
@@ -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"
index 4b2da571c4adbc6ac048ed69ca469ba05895d2d2..390bc4b73e67d03fa1cbac87a3c9f0f15c0d4795 100644 (file)
@@ -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" }
index 9a27e459f14f5a99d5516c778ec8abd557fb59d0..eedd8626cfdf0604453d3c4956727fe430d89075 100755 (executable)
@@ -30185,6 +30185,9 @@ case "$target:$tm_file" in
      *-*-linux*)
      emul_name="-melf64ppc"
       ;;
+     *le-*-freebsd*)
+     emul_name="-melf64lppc_fbsd"
+      ;;
      *-*-freebsd*)
      emul_name="-melf64ppc_fbsd"
       ;;
index 062f57fa12b78eabbf07fb21e22bf4380bbf06af..ee982bee8676597dcb84026982d8aa341c589b91 100644 (file)
@@ -6274,6 +6274,9 @@ case "$target:$tm_file" in
      *-*-linux*)
      emul_name="-melf64ppc"
       ;;
+     *le-*-freebsd*)
+     emul_name="-melf64lppc_fbsd"
+      ;;
      *-*-freebsd*)
      emul_name="-melf64ppc_fbsd"
       ;;