From 3df1e72ed0d835f771e5452bd12daeabf72d4ac4 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 11 May 2010 19:33:44 +0000 Subject: [PATCH] Patch by Nathan Mentley: Added initial support for Haiku x86_64. git-svn-id: file:///srv/svn/repos/haiku/buildtools/trunk@36793 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- binutils/bfd/config.bfd | 5 +++++ binutils/ld/configure.tgt | 2 ++ gcc/gcc/config.gcc | 4 ++++ gcc/libgcc/config.host | 2 ++ gcc/gcc/config/i386/haiku64.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 74 insertions(+) diff --git a/binutils/bfd/config.bfd b/binutils/bfd/config.bfd index da7bf32..02f8c48 100644 --- a/binutils/bfd/config.bfd +++ b/binutils/bfd/config.bfd @@ -614,6 +614,11 @@ targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec bfd_efi_bsdrv_ia32_vec bfd_efi_rtdrv_ia32_vec bfd_efi_app_x86_64_vec bfd_efi_bsdrv_x86_64_vec bfd_efi_rtdrv_x86_64_vec" want64=true ;; + x86_64-*-haiku*) + targ_defvec=bfd_elf64_x86_64_vec + targ_selvecs="bfd_elf32_i386_vec" + want64=true + ;; x86_64-*-mingw*) targ_defvec=x86_64pe_vec targ_selvecs="x86_64pe_vec x86_64pei_vec bfd_elf64_x86_64_vec" diff --git a/binutils/ld/configure.tgt b/binutils/ld/configure.tgt index e9d6e59..f6cb438 100644 --- a/binutils/ld/configure.tgt +++ b/binutils/ld/configure.tgt @@ -276,6 +276,8 @@ 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_haiku ;; +x86_64-*-haiku*) targ_emul=elf_x86_64 + targ_extra_emuls=elf_i386_haiku ;; i[3-7]86-*-vxworks*) targ_emul=elf_i386_vxworks ;; i[3-7]86-*-chaos) targ_emul=elf_i386_chaos ;; diff --git a/gcc/gcc/config.gcc b/gcc/gcc/config.gcc index 2cfce66..facdce6 100644 --- a/gcc/gcc/config.gcc +++ b/gcc/gcc/config.gcc @@ -1136,6 +1136,10 @@ 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' ;; +x86_64-*-haiku*) + 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/x86-64.h i386/haiku64.h" + ;; i[34567]86-*-netbsdelf*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h" ;; diff --git a/gcc/libgcc/config.host b/gcc/libgcc/config.host index 790e84b..da15e37 100644 --- a/gcc/libgcc/config.host +++ b/gcc/libgcc/config.host @@ -317,6 +317,8 @@ ;; i[34567]86-*-haiku*) ;; +x86_64-*-haiku*) + ;; i[34567]86-*-netbsdelf*) ;; i[34567]86-*-netbsd*) diff --git a/gcc/gcc/config/i386/haiku64.h b/gcc/gcc/config/i386/haiku64.h new file mode 100644 index 0000000..6e5958e 100644 --- /dev/null +++ b/gcc/gcc/config/i386/haiku64.h @@ -1,0 +1,61 @@ +/* Definitions for AMD x86_64 running Haiku with ELF format. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 + 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. */ + + +#if TARGET_64BIT_DEFAULT +#define TARGET_VERSION fprintf (stderr, " (x86-64 Haiku/ELF)"); +#else +#define TARGET_VERSION fprintf (stderr, " (i386 Haiku/ELF)"); +#endif + +/* The SVR4 ABI for the i386 says that records and unions are returned + * in memory. + * + * TODO: Linux64 doesn't use pcc_struct_return scheme. Does haiku? + * If not this could be removed. + */ +#undef DEFAULT_PCC_STRUCT_RETURN +#define DEFAULT_PCC_STRUCT_RETURN 1 + +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__HAIKU__"); \ + builtin_define ("__stdcall=__attribute__((__stdcall__))"); \ + builtin_define ("__cdecl=__attribute__((__cdecl__))"); \ + builtin_assert ("system=haiku"); \ + /* 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"); \ + builtin_define ("__GXX_TYPEINFO_EQUALITY_INLINE=0"); \ + } \ + 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. */ + +#undef LINK_SPEC +#define LINK_SPEC "-m elf_x86_64_haiku -shared -Bsymbolic %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}" + -- gitore 0.2.2