From 8c840510db6ccd6912567edac55fb4450048b716 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 6 Dec 2005 22:39:47 +0000 Subject: [PATCH] Added support for machine powerpc-*-haiku. Reorganized things a bit: The i386-pc-haiku no longer uses the BeOS BFD target emulation, but its own. A few things are shared for both *-*-haiku machines now. The PowerPC Haiku binutils and gcc build, but I wouldn't expect them to really produce usable output yet. We'll see... git-svn-id: file:///srv/svn/repos/haiku/buildtools/trunk@15381 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- binutils/bfd/config.bfd | 3 + binutils/ld/Makefile.am | 8 ++ binutils/ld/Makefile.in | 8 ++ binutils/ld/configure.tgt | 3 +- binutils/ld/emulparams/elf_i386_haiku.sh | 11 ++ binutils/ld/emulparams/elf_ppc_haiku.sh | 11 ++ gcc/configure | 12 +-- gcc/configure.in | 8 +- gcc/gcc/config.gcc | 9 +- gcc/gcc/config/{i386/haiku-elf.h => haiku.h} | 92 ++--------------- gcc/gcc/config/i386/haiku.h | 101 +++++++++++++++++++ gcc/gcc/config/rs6000/haiku-ppc.h | 67 ++++++++++++ gcc/gcc/config/{i386 => }/t-haiku | 0 13 files changed, 236 insertions(+), 97 deletions(-) create mode 100644 binutils/ld/emulparams/elf_i386_haiku.sh create mode 100644 binutils/ld/emulparams/elf_ppc_haiku.sh rename gcc/gcc/config/{i386/haiku-elf.h => haiku.h} (69%) create mode 100644 gcc/gcc/config/i386/haiku.h create mode 100644 gcc/gcc/config/rs6000/haiku-ppc.h rename gcc/gcc/config/{i386 => }/t-haiku (100%) diff --git a/binutils/bfd/config.bfd b/binutils/bfd/config.bfd index 775d5d6366..d8e119b156 100644 --- a/binutils/bfd/config.bfd +++ b/binutils/bfd/config.bfd @@ -1024,6 +1024,9 @@ case "${targ}" in targ_selvecs="mach_o_be_vec mach_o_le_vec mach_o_fat_vec pef_vec pef_xlib_vec sym_vec" targ_archs="bfd_powerpc_arch bfd_rs6000_arch bfd_i386_arch" ;; + powerpc-*-haiku*) + targ_defvec=bfd_elf32_powerpc_vec + ;; powerpc-*-macos*) targ_defvec=pmac_xcoff_vec ;; diff --git a/binutils/ld/Makefile.am b/binutils/ld/Makefile.am index 4f6f58c790..cec3c5953a 100644 --- a/binutils/ld/Makefile.am +++ b/binutils/ld/Makefile.am @@ -189,7 +189,9 @@ ALL_EMULATIONS = \ eelf_i386_be.o \ eelf_i386_chaos.o \ eelf_i386_fbsd.o \ + eelf_i386_haiku.o \ eelf_i386_ldso.o \ + eelf_ppc_haiku.o \ eelf_s390.o \ egld960.o \ egld960coff.o \ @@ -861,9 +863,15 @@ eelf_i386_fbsd.c: $(srcdir)/emulparams/elf_i386_fbsd.sh \ $(srcdir)/emulparams/elf_i386.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf_i386_fbsd "$(tdir_elf_i386_fbsd)" +eelf_i386_haiku.c: $(srcdir)/emulparams/elf_i386_haiku.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf_i386_haiku "$(tdir_elf_i386_haiku)" eelf_i386_ldso.c: $(srcdir)/emulparams/elf_i386_ldso.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf_i386_ldso "$(tdir_elf_i386_ldso)" +eelf_ppc_haiku.c: $(srcdir)/emulparams/elf_ppc_haiku.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf_ppc_haiku "$(tdir_elf_ppc_haiku)" eelf_s390.c: $(srcdir)/emulparams/elf_s390.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf_s390 "$(tdir_elf_s390)" diff --git a/binutils/ld/Makefile.in b/binutils/ld/Makefile.in index 25f21e0f8b..9b1f07a8f7 100644 --- a/binutils/ld/Makefile.in +++ b/binutils/ld/Makefile.in @@ -314,7 +314,9 @@ ALL_EMULATIONS = \ eelf_i386_be.o \ eelf_i386_chaos.o \ eelf_i386_fbsd.o \ + eelf_i386_haiku.o \ eelf_i386_ldso.o \ + eelf_ppc_haiku.o \ eelf_s390.o \ egld960.o \ egld960coff.o \ @@ -1598,9 +1600,15 @@ eelf_i386_fbsd.c: $(srcdir)/emulparams/elf_i386_fbsd.sh \ $(srcdir)/emulparams/elf_i386.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf_i386_fbsd "$(tdir_elf_i386_fbsd)" +eelf_i386_haiku.c: $(srcdir)/emulparams/elf_i386_haiku.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf_i386_haiku "$(tdir_elf_i386_haiku)" eelf_i386_ldso.c: $(srcdir)/emulparams/elf_i386_ldso.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf_i386_ldso "$(tdir_elf_i386_ldso)" +eelf_ppc_haiku.c: $(srcdir)/emulparams/elf_ppc_haiku.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf_ppc_haiku "$(tdir_elf_ppc_haiku)" eelf_s390.c: $(srcdir)/emulparams/elf_s390.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf_s390 "$(tdir_elf_s390)" diff --git a/binutils/ld/configure.tgt b/binutils/ld/configure.tgt index e633de6f73..d72f4e90c1 100644 --- a/binutils/ld/configure.tgt +++ b/binutils/ld/configure.tgt @@ -233,7 +233,7 @@ i[3-7]86-*-interix*) targ_emul=i386pe_posix; targ_extra_ofiles="deffilep.o pe-dll.o" ;; i[3-7]86-*-beospe*) targ_emul=i386beos ;; i[3-7]86-*-beos*) targ_emul=elf_i386_be ;; -i[3-7]86-*-haiku*) targ_emul=elf_i386_be ;; +i[3-7]86-*-haiku*) targ_emul=elf_i386_haiku ;; i[3-7]86-*-vxworks*) targ_emul=elf_i386 ;; i[3-7]86-*-chaos) targ_emul=elf_i386_chaos ;; m8*-*-*) targ_emul=m88kbcs ;; @@ -542,6 +542,7 @@ powerpcle-*-cygwin*) targ_emul=ppcpe ;; powerpc-*-aix5*) targ_emul=aix5ppc ;; powerpc-*-aix*) targ_emul=aixppc ;; powerpc-*-beos*) targ_emul=aixppc ;; +powerpc-*-haiku*) targ_emul=elf_ppc_haiku ;; powerpc-*-windiss*) targ_emul=elf32ppcwindiss ;; powerpc-*-lynxos*) targ_emul=ppclynx ;; rs6000-*-aix5*) targ_emul=aix5rs6 ;; diff --git a/binutils/ld/emulparams/elf_i386_haiku.sh b/binutils/ld/emulparams/elf_i386_haiku.sh new file mode 100644 index 0000000000..25ca6bcdb9 --- /dev/null +++ b/binutils/ld/emulparams/elf_i386_haiku.sh @@ -0,0 +1,11 @@ +SCRIPT_NAME=elf +OUTPUT_FORMAT="elf32-i386" +TEXT_START_ADDR=0x200000 +NONPAGED_TEXT_START_ADDR=0x200000 +MAXPAGESIZE=0x1000 +ARCH=i386 +MACHINE= +NOP=0x90909090 +TEMPLATE_NAME=elf32 +GENERATE_SHLIB_SCRIPT=yes +NO_SMALL_DATA=yes diff --git a/binutils/ld/emulparams/elf_ppc_haiku.sh b/binutils/ld/emulparams/elf_ppc_haiku.sh new file mode 100644 index 0000000000..c18267f92a --- /dev/null +++ b/binutils/ld/emulparams/elf_ppc_haiku.sh @@ -0,0 +1,11 @@ +SCRIPT_NAME=elf +OUTPUT_FORMAT="elf32-powerpc" +TEXT_START_ADDR=0x200000 +NONPAGED_TEXT_START_ADDR=0x200000 +MAXPAGESIZE=0x1000 +ARCH=powerpc +MACHINE= +NOP=0x60000000 +TEMPLATE_NAME=elf32 +GENERATE_SHLIB_SCRIPT=yes +NO_SMALL_DATA=yes diff --git a/gcc/configure b/gcc/configure index 6249b62361..2debf62fca 100755 --- a/gcc/configure +++ b/gcc/configure @@ -1088,12 +1088,12 @@ case "${host}" in i[3456789]86-*-beos*) noconfigdirs="$noconfigdirs tk itcl libgui gdb" ;; - i[3456789]86-*-haiku*) - noconfigdirs="$noconfigdirs tk itcl libgui gdb" - ;; *-*-cygwin*) noconfigdirs="$noconfigdirs autoconf automake send-pr rcs guile perl" ;; + *-*-haiku*) + noconfigdirs="$noconfigdirs tk itcl libgui gdb" + ;; *-*-netbsd*) noconfigdirs="$noconfigdirs rcs" ;; @@ -1438,9 +1438,6 @@ case "${target}" in i[3456789]86-*-beos*) noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}" ;; - i[3456789]86-*-haiku*) - noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}" - ;; m32r-*-*) noconfigdirs="$noconfigdirs ${libgcj}" ;; @@ -1587,6 +1584,9 @@ case "${target}" in ip2k-*-*) noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}" ;; + *-*-haiku*) + noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}" + ;; *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu) noconfigdirs="$noconfigdirs target-newlib target-libgloss" ;; diff --git a/gcc/configure.in b/gcc/configure.in index 1dc62b11d8..2311df1e5a 100644 --- a/gcc/configure.in +++ b/gcc/configure.in @@ -304,7 +304,7 @@ case "${host}" in *-*-cygwin*) noconfigdirs="$noconfigdirs autoconf automake send-pr rcs guile perl" ;; - i[[3456789]]86-*-haiku*) + *-*-haiku*) noconfigdirs="$noconfigdirs tk itcl libgui gdb" ;; *-*-netbsd*) @@ -641,9 +641,6 @@ case "${target}" in i[[3456789]]86-*-beos*) noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}" ;; - i[[3456789]]86-*-haiku*) - noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}" - ;; m32r-*-*) noconfigdirs="$noconfigdirs ${libgcj}" ;; @@ -790,6 +787,9 @@ case "${target}" in ip2k-*-*) noconfigdirs="$noconfigdirs target-libiberty target-libstdc++-v3 ${libgcj}" ;; + *-*-haiku*) + noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss ${libgcj}" + ;; *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu) noconfigdirs="$noconfigdirs target-newlib target-libgloss" ;; diff --git a/gcc/gcc/config.gcc b/gcc/gcc/config.gcc index 70a905151b..f9ff90768a 100644 --- a/gcc/gcc/config.gcc +++ b/gcc/gcc/config.gcc @@ -970,8 +970,8 @@ x86_64-*-freebsd*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h" ;; i[34567]86-*-haiku*) - tmake_file='i386/t-haiku i386/t-crtpic' - tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h i386/haiku-elf.h" + tmake_file='t-haiku i386/t-crtpic' + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h svr4.h haiku.h i386/haiku.h" extra_parts='crtbegin.o crtend.o' ;; i[34567]86-*-netbsdelf*) @@ -1640,6 +1640,11 @@ powerpc-*-eabi*) tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h" tmake_file="rs6000/t-fprules rs6000/t-ppcgas rs6000/t-ppccomm" ;; +powerpc-*-haiku*) + tmake_file="rs6000/t-fprules rs6000/t-ppcos rs6000/t-ppccomm t-haiku" + tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h haiku.h rs6000/haiku-ppc.h" + extra_parts='crtbegin.o crtend.o' + ;; powerpc-*-rtems*) tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/eabi.h rs6000/rtems.h rtems.h" tmake_file="rs6000/t-fprules rs6000/t-rtems t-rtems rs6000/t-ppccomm" diff --git a/gcc/gcc/config/i386/haiku-elf.h b/gcc/gcc/config/haiku.h similarity index 69% rename from gcc/gcc/config/i386/haiku-elf.h rename to gcc/gcc/config/haiku.h index 728de06325..7cafae7c6c 100644 --- a/gcc/gcc/config/i386/haiku-elf.h +++ b/gcc/gcc/config/haiku.h @@ -1,5 +1,6 @@ -/* Definitions for Intel x86 running Haiku - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 +/* Definitions of target machine for GCC. + Common Haiku definitions for all architectures. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GCC. @@ -20,67 +21,21 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define TARGET_VERSION fprintf (stderr, " (i386 Haiku/ELF)"); - /* Change debugging to Dwarf2. */ #undef PREFERRED_DEBUGGING_TYPE #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG -/* The SVR4 ABI for the i386 says that records and unions are returned - in memory. */ -#undef DEFAULT_PCC_STRUCT_RETURN -#define DEFAULT_PCC_STRUCT_RETURN 1 - #undef ASM_COMMENT_START #define ASM_COMMENT_START " #" -#undef DBX_REGISTER_NUMBER -#define DBX_REGISTER_NUMBER(n) \ - (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n]) - /* Output assembler code to FILE to increment profiler label # LABELNO for profiling a function entry. */ #undef MCOUNT_NAME -#define MCOUNT_NAME "mcount" - -#undef SIZE_TYPE -#define SIZE_TYPE "long unsigned int" - -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "long int" - -#undef WCHAR_TYPE -#define WCHAR_TYPE "short unsigned int" - -#undef WCHAR_TYPE_SIZE -#define WCHAR_TYPE_SIZE 16 +#define MCOUNT_NAME "_mcount" #define TARGET_DECLSPEC 1 -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - builtin_define ("__BEOS__"); \ - builtin_define ("__HAIKU__"); \ - builtin_define ("__INTEL__"); \ - builtin_define ("_X86_"); \ - builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ - builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ - builtin_assert ("system=haiku"); \ - if (flag_pic) \ - { \ - builtin_define ("__PIC__"); \ - builtin_define ("__pic__"); \ - } \ - /* Haiku apparently doesn't support merging of symbols across shared \ - object boundaries. Hence we need to explicitly specify that \ - type_infos are not merged, so that they get compared by name \ - instead of by pointer. */ \ - builtin_define ("__GXX_MERGED_TYPEINFO_NAMES=0"); \ - } \ - while (0) - /* Haiku uses lots of multichars, so don't warn about them unless the user explicitly asks for the warnings with -Wmultichar. Note that CC1_SPEC is used for both cc1 and cc1plus. */ @@ -91,16 +46,6 @@ Boston, MA 02111-1307, USA. */ #undef CC1PLUS_SPEC #define CC1PLUS_SPEC "%{!Wctor-dtor-privacy:-Wno-ctor-dtor-privacy}" -/* 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 elf_i386_be -shared -Bsymbolic %{nostart:-e 0}" - /* Provide start and end file specs appropriate to glibc. */ /* LIB_SPEC for Haiku */ @@ -113,33 +58,15 @@ Boston, MA 02111-1307, USA. */ #undef LIBGCC_SPEC #define LIBGCC_SPEC "" +/* Note: There currently is no mcount.o on Haiku. In the BeOS specification + it was i386-mcount.o, but that doesn't exist in gcc 2.95.3 either. */ + #undef STARTFILE_SPEC -#define STARTFILE_SPEC "crti.o%s crtbegin.o%s %{!nostart:start_dyn.o%s} init_term_dyn.o%s %{p:i386-mcount.o%s}" +#define STARTFILE_SPEC "crti.o%s crtbegin.o%s %{!nostart:start_dyn.o%s} init_term_dyn.o%s %{p:mcount.o%s}" #undef ENDFILE_SPEC #define ENDFILE_SPEC "crtend.o%s crtn.o%s" -/* A C statement (sans semicolon) to output to the stdio stream - FILE the assembler definition of uninitialized global DECL named - NAME whose size is SIZE bytes and alignment is ALIGN bytes. - Try to use asm_output_aligned_bss to implement this macro. */ - -#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ - asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN) - -/* A C statement to output to the stdio stream FILE an assembler - command to advance the location counter to a multiple of 1<