⛏️ index : buildtools.git

author Jonas Sundström <jonas@kirilla.com> 2009-05-01 14:42:51.0 +00:00:00
committer Jonas Sundström <jonas@kirilla.com> 2009-05-01 14:42:51.0 +00:00:00
commit
4df3ecf7d0344577a727314979de2db99e4b7f52 [patch]
tree
9daeb02493f5cb339228b2e505bdc36a504a2600
parent
d5dc8c38040c71e67053eaa2d99caadeba08e669
download
4df3ecf7d0344577a727314979de2db99e4b7f52.tar.gz

Adding mipsel-unknown-haiku. Work in progress. Correctness uncertain. Especially gcc/gcc/config/mips/haiku.h. Inspired by the other Haiku targets x86/ppc/arm.

git-svn-id: file:///srv/svn/repos/haiku/buildtools/trunk@30534 a95241bf-73f2-0310-859d-f6bbb57e9c96

Diff

 binutils/bfd/config.bfd                    |   4 ++++
 binutils/gas/configure.tgt                 |   1 +
 binutils/ld/Makefile.am                    |   4 ++++
 binutils/ld/Makefile.in                    |   4 ++++
 binutils/ld/configure.tgt                  |   3 +++
 gcc/gcc/config.gcc                         |   5 +++++
 gcc/libgcc/config.host                     |   2 ++
 binutils/ld/emulparams/elf_mipsel_haiku.sh |   2 ++
 gcc/gcc/config/mips/haiku.h                | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 162 insertions(+)

diff --git a/binutils/bfd/config.bfd b/binutils/bfd/config.bfd
index ea88e37..da7bf32 100644
--- a/binutils/bfd/config.bfd
+++ b/binutils/bfd/config.bfd
@@ -883,6 +883,10 @@
    targ_defvec=bfd_elf32_tradlittlemips_vec
    targ_selvecs="bfd_elf32_tradbigmips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_little_vec ecoff_big_vec"
    ;;
  mips*el-*-haiku*)
    targ_defvec=bfd_elf32_littlemips_vec
    targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec"
    ;;
  mips*-*-netbsd*)
    targ_defvec=bfd_elf32_tradbigmips_vec
    targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec"
diff --git a/binutils/gas/configure.tgt b/binutils/gas/configure.tgt
index 483ff91..58c29f2 100644
--- a/binutils/gas/configure.tgt
+++ b/binutils/gas/configure.tgt
@@ -291,6 +291,7 @@
  mips-*-elf* | mips-*-rtems*)		fmt=elf ;;
  mips-*-netbsd*)			fmt=elf em=tmips ;;
  mips-*-openbsd*)			fmt=elf em=tmips ;;
  mips*-*-haiku*)			fmt=elf endian=little em=haiku ;;

  mmix-*-*)				fmt=elf ;;

diff --git a/binutils/ld/Makefile.am b/binutils/ld/Makefile.am
index e5f90b0..4e81d0e 100644
--- a/binutils/ld/Makefile.am
+++ b/binutils/ld/Makefile.am
@@ -212,6 +212,7 @@
	eelf_i386_haiku.o \
	eelf_i386_ldso.o \
	eelf_ppc_haiku.o \
	eelf_mipsel_haiku.o \
	eelf_i386_vxworks.o \
	eelf_s390.o \
	egld960.o \
@@ -1039,6 +1040,9 @@
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_mipsel_haiku.c: $(srcdir)/emulparams/elf_mipsel_haiku.sh \
  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
	${GENSCRIPTS} elf_mipsel_haiku "$(tdir_elf_mipsel_haiku)"
eelf_i386_vxworks.c: $(srcdir)/emulparams/elf_i386_vxworks.sh \
  $(srcdir)/emulparams/vxworks.sh $(srcdir)/emultempl/vxworks.em \
  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
diff --git a/binutils/ld/Makefile.in b/binutils/ld/Makefile.in
index 0c94dde..dcf3960 100644
--- a/binutils/ld/Makefile.in
+++ b/binutils/ld/Makefile.in
@@ -463,6 +463,7 @@
	eelf_i386_haiku.o \
	eelf_i386_ldso.o \
	eelf_ppc_haiku.o \
	eelf_mipsel_haiku.o \
	eelf_i386_vxworks.o \
	eelf_s390.o \
	egld960.o \
@@ -1866,6 +1867,9 @@
eelf_i386_ldso.c: $(srcdir)/emulparams/elf_i386_ldso.sh \
  $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
	${GENSCRIPTS} elf_i386_ldso "$(tdir_elf_i386_ldso)"
eelf_mipsel_haiku.c:  $(srcdir)/emulparams/elf_mipsel_haiku.sh \
  $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
	${GENSCRIPTS} elf_mipsel_haiku "$(tdir_elf_mipsel_haiku)"
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)"
diff --git a/binutils/ld/configure.tgt b/binutils/ld/configure.tgt
index baf99c9..e9d6e59 100644
--- a/binutils/ld/configure.tgt
+++ b/binutils/ld/configure.tgt
@@ -369,6 +369,9 @@
mips*el-*-netbsd*)	targ_emul=elf32ltsmip
			targ_extra_emuls="elf32btsmip elf64ltsmip elf64btsmip"
			;;
mips*el-*-haiku*)	targ_emul=elf_mipsel_haiku
			targ_extra_emuls="elf32ltsmip elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip" 
			;;
mips*-*-netbsd*)	targ_emul=elf32btsmip
			targ_extra_emuls="elf32ltsmip elf64btsmip elf64ltsmip"
  			;;
diff --git a/gcc/gcc/config.gcc b/gcc/gcc/config.gcc
index 5b331cd..d1bbf88 100644
--- a/gcc/gcc/config.gcc
+++ b/gcc/gcc/config.gcc
@@ -1802,6 +1802,11 @@
	tmake_file="mips/t-elf mips/t-libgcc-mips16"
	use_fixproto=yes
	;;
mipsel-*-haiku*)
	tmake_file='mips/t-elf t-haiku'
	tm_file="elfos.h ${tm_file} haiku.h mips/haiku.h"
	extra_parts='crtbegin.o crtend.o'
	;;
mips64-*-elf* | mips64el-*-elf*)
	tm_file="elfos.h ${tm_file} mips/elf.h"
	tmake_file="mips/t-elf mips/t-libgcc-mips16"
diff --git a/gcc/libgcc/config.host b/gcc/libgcc/config.host
index 69fed85..790e84b 100644
--- a/gcc/libgcc/config.host
+++ b/gcc/libgcc/config.host
@@ -449,6 +449,8 @@
	;;
mips*-*-openbsd*)
	;;
mips*-*-haiku*)
	;;
mipsisa32-*-elf* | mipsisa32el-*-elf*)
	;;
mipsisa32r2-*-elf* | mipsisa32r2el-*-elf*)
diff --git a/binutils/ld/emulparams/elf_mipsel_haiku.sh b/binutils/ld/emulparams/elf_mipsel_haiku.sh
new file mode 100644
index 0000000..ff9c325 100644
--- /dev/null
+++ b/binutils/ld/emulparams/elf_mipsel_haiku.sh
@@ -1,0 +1,2 @@
. ${srcdir}/emulparams/elf32lmip.sh

diff --git a/gcc/gcc/config/mips/haiku.h b/gcc/gcc/config/mips/haiku.h
new file mode 100644
index 0000000..d8ebb68 100644
--- /dev/null
+++ b/gcc/gcc/config/mips/haiku.h
@@ -1,0 +1,137 @@
/* Definitions for MIPS running Haiku
   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.  */


#define TARGET_VERSION fprintf (stderr, " (mips Haiku/ELF)");

#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

/* If we don't set MASK_ABICALLS, we can't default to PIC.  */
#undef TARGET_DEFAULT
#define TARGET_DEFAULT MASK_ABICALLS

#define TARGET_OS_CPP_BUILTINS()					\
  do									\
    {									\
	builtin_define ("__BEOS__");					\
	builtin_define ("__HAIKU__");					\
	builtin_define ("__MIPS__");					\
	builtin_define ("_MIPSEL_");					\
	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");		\
	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.  */

/* If ELF is the default format, we should not use /lib/elf.  */

#undef	LINK_SPEC
#define LINK_SPEC "%{!o*:-o %b} -m elf_mipsel_haiku -shared -Bsymbolic %{nostart:-e 0}"

/* 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 BSS_SECTION_ASM_OP	"\t.section\t.bss"

#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)

#undef ASM_DECLARE_OBJECT_NAME
#define ASM_DECLARE_OBJECT_NAME mips_declare_object_name

#undef FUNCTION_NAME_ALREADY_DECLARED
#define FUNCTION_NAME_ALREADY_DECLARED 1

/* The glibc _mcount stub will save $v0 for us.  Don't mess with saving
   it, since ASM_OUTPUT_REG_PUSH/ASM_OUTPUT_REG_POP do not work in the
   presence of $gp-relative calls.  */
#undef ASM_OUTPUT_REG_PUSH
#undef ASM_OUTPUT_REG_POP

/* The MIPS assembler has different syntax for .set. We set it to
   .dummy to trap any errors.  */
#undef SET_ASM_OP
#define SET_ASM_OP "\t.dummy\t"

#undef ASM_OUTPUT_DEF
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)				\
 do {									\
	fputc ( '\t', FILE);						\
	assemble_name (FILE, LABEL1);					\
	fputs ( " = ", FILE);						\
	assemble_name (FILE, LABEL2);					\
	fputc ( '\n', FILE);						\
 } while (0)

#undef ASM_DECLARE_FUNCTION_NAME
#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL)			\
  do {									\
    if (!flag_inhibit_size_directive)					\
      {									\
	fputs ("\t.ent\t", STREAM);					\
	assemble_name (STREAM, NAME);					\
	putc ('\n', STREAM);						\
      }									\
    ASM_OUTPUT_TYPE_DIRECTIVE (STREAM, NAME, "function");		\
    assemble_name (STREAM, NAME);					\
    fputs (":\n", STREAM);						\
  } while (0)

#undef ASM_DECLARE_FUNCTION_SIZE
#define ASM_DECLARE_FUNCTION_SIZE(STREAM, NAME, DECL)			\
  do {									\
    if (!flag_inhibit_size_directive)					\
      {									\
	fputs ("\t.end\t", STREAM);					\
	assemble_name (STREAM, NAME);					\
	putc ('\n', STREAM);						\
      }									\
  } while (0)