[haiku-commits] Change in buildtools[master]: Add initial 64-bit PowerPC support to buildtools.

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 23 May 2020 07:37:20 +0000

From tsundoku <me@xxxxxxxxxxxxxx>:

tsundoku has uploaded this change for review. ( 
https://review.haiku-os.org/c/buildtools/+/2784 ;)


Change subject: Add initial 64-bit PowerPC support to buildtools.
......................................................................

Add initial 64-bit PowerPC support to buildtools.

Add initial 64-bit PowerPC support.

- Add files and entries needed to generate cross tools
  for ppc64 or ppc64le Haiku targets
- Currently fails at libgcc with "unable to emulate 'TI'"
---
M binutils/bfd/config.bfd
M binutils/ld/Makefile.in
M binutils/ld/configure.tgt
A binutils/ld/emulparams/elf64lppchaiku.sh
A binutils/ld/emulparams/elf64ppchaiku.sh
M gcc/gcc/config.gcc
A gcc/gcc/config/rs6000/haiku64.h
A gcc/gcc/config/rs6000/haiku64le.h
M gcc/libgcc/config.host
9 files changed, 175 insertions(+), 0 deletions(-)



  git pull ssh://git.haiku-os.org:22/buildtools refs/changes/84/2784/1

diff --git a/binutils/bfd/config.bfd b/binutils/bfd/config.bfd
index 700310e..06b97b8 100644
--- a/binutils/bfd/config.bfd
+++ b/binutils/bfd/config.bfd
@@ -1135,6 +1135,11 @@
     targ_selvecs="powerpc_elf64_vec powerpc_elf32_vec powerpc_elf32_fbsd_vec 
powerpc_elf32_le_vec rs6000_xcoff_vec rs6000_xcoff64_vec rs6000_xcoff64_aix_vec"
     want64=true
     ;;
+  powerpc64*-haiku*)
+    targ_defvec=powerpc_elf64_vec
+    targ_selvecs="powerpc_elf64_le_vec powerpc_elf32_vec powerpc_elf32_le_vec 
rs6000_xcoff_vec rs6000_xcoff64_vec rs6000_xcoff64_aix_vec"
+    want64=true
+    ;;
   powerpc64-*-elf* | powerpc-*-elf64* | powerpc64-*-linux* | \
   powerpc64-*-*bsd*)
     targ_defvec=powerpc_elf64_vec
@@ -1147,6 +1152,11 @@
     targ_selvecs="powerpc_elf64_vec powerpc_elf32_le_vec powerpc_elf32_vec 
rs6000_xcoff_vec rs6000_xcoff64_vec rs6000_xcoff64_aix_vec"
     want64=true
     ;;
+  powerpc64le-*-haiku*)
+    targ_defvec=powerpc_elf64_le_vec
+    targ_selvecs="powerpc_elf64_vec powerpc_elf32_le_vec powerpc_elf32_vec 
rs6000_xcoff_vec rs6000_xcoff64_vec rs6000_xcoff64_aix_vec"
+    want64=true
+    ;;
 #endif
   powerpc-*-*freebsd*)
     targ_defvec=powerpc_elf32_fbsd_vec
diff --git a/binutils/ld/Makefile.in b/binutils/ld/Makefile.in
index 6806df1..b8f67e0 100644
--- a/binutils/ld/Makefile.in
+++ b/binutils/ld/Makefile.in
@@ -929,6 +929,7 @@
        eelf64btsmip_fbsd.c \
        eelf64hppa.c \
        eelf64lppc.c \
+       eelf64lppchaiku.c \
        eelf64lriscv.c \
        eelf64lriscv_lp64f.c \
        eelf64lriscv_lp64.c \
@@ -937,6 +938,7 @@
        eelf64mmix.c \
        eelf64ppc.c \
        eelf64ppc_fbsd.c \
+       eelf64ppchaiku.c \
        eelf64rdos.c \
        eelf64tilegx.c \
        eelf64tilegx_be.c \
@@ -1381,6 +1383,7 @@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/eelf64btsmip_fbsd.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64hppa.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppchaiku.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv.Po@am__quote@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/eelf64lriscv_lp64.Po@am__quote@
 @AMDEP_TRUE@@am__include@ 
@am__quote@./$(DEPDIR)/eelf64lriscv_lp64f.Po@am__quote@
@@ -1389,6 +1392,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64mmix.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ppc.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ppc_fbsd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ppchaiku.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64rdos.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64tilegx.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64tilegx_be.Po@am__quote@
@@ -3419,6 +3423,12 @@
   $(srcdir)/emultempl/ppc64elf.em ldemul-list.h \
   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}

+eelf64lppchaiku.c: $(srcdir)/emulparams/elf64lppchaiku.sh \
+  $(srcdir)/emulparams/elf64lppc.sh \
+  $(srcdir)/emultempl/ppc64elf.em $(ELF_DEPS) \
+  ldemul-list.h \
+  $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+
 eelf64lriscv.c: $(srcdir)/emulparams/elf64lriscv.sh \
   $(srcdir)/emulparams/elf64lriscv-defs.sh \
   $(srcdir)/emulparams/elf32lriscv-defs.sh $(ELF_DEPS) \
@@ -3462,6 +3472,12 @@
   $(srcdir)/emultempl/ppc64elf.em ldemul-list.h \
   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}

+eelf64ppchaiku.c: $(srcdir)/emulparams/elf64ppchaiku.sh \
+  $(srcdir)/emulparams/elf64ppc.sh \
+  $(srcdir)/emultempl/ppc64elf.em $(ELF_DEPS) \
+  ldemul-list.h \
+  $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+
 eelf64rdos.c: $(srcdir)/emulparams/elf64rdos.sh \
   $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}

diff --git a/binutils/ld/configure.tgt b/binutils/ld/configure.tgt
index 30cb9c0..80efd0a 100644
--- a/binutils/ld/configure.tgt
+++ b/binutils/ld/configure.tgt
@@ -641,6 +641,8 @@
 powerpc-*-aix*)                targ_emul=aixppc ;;
 powerpc-*-beos*)       targ_emul=aixppc ;;
 powerpc-*-haiku*)      targ_emul=elf32ppchaiku ;;
+powerpc64-*-haiku*)    targ_emul=elf64ppchaiku ;;
+powerpc64le-*-haiku*)  targ_emul=elf64lppchaiku ;;
 powerpc-*-windiss*)    targ_emul=elf32ppcwindiss ;;
 powerpc-*-lynxos*)     targ_emul=ppclynx ;;
 pru*-*-*)              targ_emul=pruelf ;;
diff --git a/binutils/ld/emulparams/elf64lppchaiku.sh 
b/binutils/ld/emulparams/elf64lppchaiku.sh
new file mode 100644
index 0000000..0226531
--- /dev/null
+++ b/binutils/ld/emulparams/elf64lppchaiku.sh
@@ -0,0 +1,7 @@
+. ${srcdir}/emulparams/elf64lppc.sh
+. ${srcdir}/emulparams/elf_haiku.sh
+TEXT_START_ADDR=0x200000
+MAXPAGESIZE=0x1000
+GENERATE_SHLIB_SCRIPT=yes
+BSS_PLT=
+LIBPATH_SUFFIX=
diff --git a/binutils/ld/emulparams/elf64ppchaiku.sh 
b/binutils/ld/emulparams/elf64ppchaiku.sh
new file mode 100644
index 0000000..a4a2fea
--- /dev/null
+++ b/binutils/ld/emulparams/elf64ppchaiku.sh
@@ -0,0 +1,7 @@
+. ${srcdir}/emulparams/elf64ppc.sh
+. ${srcdir}/emulparams/elf_haiku.sh
+TEXT_START_ADDR=0x200000
+MAXPAGESIZE=0x1000
+GENERATE_SHLIB_SCRIPT=yes
+BSS_PLT=
+LIBPATH_SUFFIX=
diff --git a/gcc/gcc/config.gcc b/gcc/gcc/config.gcc
index 33f7bba..31cf8d9 100644
--- a/gcc/gcc/config.gcc
+++ b/gcc/gcc/config.gcc
@@ -2528,6 +2528,16 @@
        tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h 
haiku.h rs6000/haiku.h haiku-stdint.h"
        extra_options="${extra_options} rs6000/sysv4.opt"
        ;;
+powerpc64-*-haiku*)
+       tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-ppcos 
rs6000/t-ppccomm t-haiku"
+       tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h 
haiku.h rs6000/haiku64.h haiku-stdint.h"
+       extra_options="${extra_options} rs6000/sysv4.opt"
+       ;;
+powerpc64le-*-haiku*)
+       tmake_file="${tmake_file} t-haiku"
+       tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h rs6000/sysv4.h 
haiku.h rs6000/haiku64le.h haiku-stdint.h"
+       extra_options="${extra_options} rs6000/sysv4.opt"
+       ;;
 powerpc-*-rtems*spe*)
        tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h newlib-stdint.h 
powerpcspe/sysv4.h powerpcspe/eabi.h powerpcspe/e500.h powerpcspe/rtems.h 
rtems.h"
        extra_options="${extra_options} powerpcspe/sysv4.opt"
diff --git a/gcc/gcc/config/rs6000/haiku64.h b/gcc/gcc/config/rs6000/haiku64.h
new file mode 100644
index 0000000..d4a7791
--- /dev/null
+++ b/gcc/gcc/config/rs6000/haiku64.h
@@ -0,0 +1,58 @@
+/* Definitions for 64-bit PowerPC running Haiku
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005
+   Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+
+/* long double is 128 bits wide; the documentation claims
+   LIBGCC2_LONG_DOUBLE_TYPE_SIZE to default to LONG_DOUBLE_TYPE_SIZE, but
+   it apparently does not */
+/*#undef LONG_DOUBLE_TYPE_SIZE
+#define LONG_DOUBLE_TYPE_SIZE 128
+#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
+#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128*/
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS()                                       \
+  do                                                                   \
+    {                                                                  \
+       builtin_define ("__HAIKU__");                                   \
+       builtin_define ("__POWERPC__");                                 \
+       builtin_define ("__powerpc__");                                 \
+       builtin_define ("__PPC64__");                                   \
+       builtin_define ("__powerpc64__");                                       
\
+       builtin_define ("__stdcall=__attribute__((__stdcall__))");      \
+       builtin_define ("__cdecl=__attribute__((__cdecl__))");          \
+    builtin_define ("__STDC_ISO_10646__=201103L"); \
+       builtin_assert ("system=haiku");                                        
\
+       builtin_assert ("cpu=powerpc64");                                       
\
+       builtin_assert ("machine=powerpc64");                                   
\
+       TARGET_OS_SYSV_CPP_BUILTINS ();                                 \
+    }                                                                  \
+  while (0)
+
+/* Provide a LINK_SPEC appropriate for Haiku.  Here we provide support
+   for the special GCC options -static and -shared, which allow us to
+   link things in one of these three modes by applying the appropriate
+   combinations of options at link-time.  */
+
+/* If ELF is the default format, we should not use /lib/elf.  */
+
+#undef LINK_SPEC
+#define LINK_SPEC "%{!o*:-o %b} -m elf64ppchaiku %{!r:-shared} %{nostart:-e 0} 
%{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}"
diff --git a/gcc/gcc/config/rs6000/haiku64le.h 
b/gcc/gcc/config/rs6000/haiku64le.h
new file mode 100644
index 0000000..f06b427
--- /dev/null
+++ b/gcc/gcc/config/rs6000/haiku64le.h
@@ -0,0 +1,61 @@
+/* Definitions for 64-bit PowerPC running Haiku
+   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005
+   Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+
+/* long double is 128 bits wide; the documentation claims
+   LIBGCC2_LONG_DOUBLE_TYPE_SIZE to default to LONG_DOUBLE_TYPE_SIZE, but
+   it apparently does not */
+/*#undef LONG_DOUBLE_TYPE_SIZE
+#define LONG_DOUBLE_TYPE_SIZE 128
+#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
+#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 128 */
+
+#undef TARGET_ARCH64
+#define TARGET_ARCH64 1
+
+#undef TARGET_OS_CPP_BUILTINS
+#define TARGET_OS_CPP_BUILTINS()                                       \
+  do                                                                   \
+    {                                                                  \
+       builtin_define ("__HAIKU__");                                   \
+       builtin_define ("__POWERPC__");                                 \
+       builtin_define ("__powerpc__");                                 \
+       builtin_define ("__PPC64__");                                   \
+       builtin_define ("__powerpc64__");                                       
\
+       builtin_define ("__stdcall=__attribute__((__stdcall__))");      \
+       builtin_define ("__cdecl=__attribute__((__cdecl__))");          \
+    builtin_define ("__STDC_ISO_10646__=201103L"); \
+       builtin_assert ("system=haiku");                                        
\
+       builtin_assert ("cpu=powerpc64le");                                     
\
+       builtin_assert ("machine=powerpc64le");                                 
\
+       TARGET_OS_SYSV_CPP_BUILTINS ();                                 \
+    }                                                                  \
+  while (0)
+
+/* Provide a LINK_SPEC appropriate for Haiku.  Here we provide support
+   for the special GCC options -static and -shared, which allow us to
+   link things in one of these three modes by applying the appropriate
+   combinations of options at link-time.  */
+
+/* If ELF is the default format, we should not use /lib/elf.  */
+
+#undef LINK_SPEC
+#define LINK_SPEC "%{!o*:-o %b} -m elf64lppchaiku %{!r:-shared} %{nostart:-e 
0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}"
diff --git a/gcc/libgcc/config.host b/gcc/libgcc/config.host
index 0c8d424..30c1856 100644
--- a/gcc/libgcc/config.host
+++ b/gcc/libgcc/config.host
@@ -1063,6 +1063,10 @@
        ;;
 powerpc-*-haiku*)
        ;;
+powerpc64-*-haiku*)
+       ;;
+powerpc64le-*-haiku*)
+       ;;
 powerpc-*-netbsd*)
        tmake_file="$tmake_file rs6000/t-netbsd rs6000/t-crtstuff"
        ;;

--
To view, visit https://review.haiku-os.org/c/buildtools/+/2784
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: buildtools
Gerrit-Branch: master
Gerrit-Change-Id: I64b4c8a1e3c92c635a66ea8ca41dad244da33d9a
Gerrit-Change-Number: 2784
Gerrit-PatchSet: 1
Gerrit-Owner: tsundoku <me@xxxxxxxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in buildtools[master]: Add initial 64-bit PowerPC support to buildtools. - Gerrit