This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

MMIX port, part 8/10: ld except testsuite.


Ok to commit?

Part 8/10, ld except testsuite:

	* configure.tgt (mmix-*-*): New target.
	* Makefile.am (ALL_EMULATIONS): Add eelf64mmix.o and emmo.o.
	Add dependencies to match.
	* emulparams/mmo.sh, emulparams/elf64mmix.sh, emultempl/mmo.em,
	emultempl/mmix-elfnmmo.em, emultempl/mmixelf.em,
	scripttempl/mmo.sc: New files.
	* gen-doc.texi: @set MMIX.
	* ld.texinfo: Ditto.
  	[MMIX] Add MMIX node.
	* Makefile.in: Regenerate.

Index: Makefile.am
===================================================================
RCS file: /cvs/src/src/ld/Makefile.am,v
retrieving revision 1.71
diff -p -c -r1.71 Makefile.am
*** Makefile.am	2001/09/30 22:22:05	1.71
--- Makefile.am	2001/09/30 22:30:43
*************** ALL_64_EMULATIONS = \
*** 265,270 ****
--- 265,272 ----
  	eelf64btsmip.o \
  	eelf64ltsmip.o \
  	eelf64hppa.o \
+ 	eelf64mmix.o \
+ 	emmo.o \
  	eelf64ppc.o \
  	eelf64lppc.o \
  	eaixppc64.o \
*************** eelf64_sparc.c: $(srcdir)/emulparams/elf
*** 537,542 ****
--- 539,552 ----
  eelf64bmip.c: $(srcdir)/emulparams/elf64bmip.sh \
    $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
  	${GENSCRIPTS} elf64bmip "$(tdir_elf64bmip)"
+ eelf64mmix.c: $(srcdir)/emulparams/elf64mmix.sh \
+   $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/mmix-elfnmmo.em \
+   $(srcdir)/emultempl/mmixelf.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ 	${GENSCRIPTS} elf64mmix "$(tdir_elf64mmix)"
+ emmo.c: $(srcdir)/emulparams/mmo.sh $(srcdir)/emultempl/mmix-elfnmmo.em \
+   $(srcdir)/emultempl/generic.em $(srcdir)/emultempl/mmo.em \
+   $(srcdir)/scripttempl/mmo.sc ${GEN_DEPENDS}
+ 	${GENSCRIPTS} mmo "$(tdir_mmo)"
  eelf64btsmip.c: $(srcdir)/emulparams/elf64btsmip.sh \
    $(srcdir)/emultempl/elf32.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
  	${GENSCRIPTS} elf64btsmip "$(tdir_elf64btsmip)"
Index: configure.tgt
===================================================================
RCS file: /cvs/src/src/ld/configure.tgt,v
retrieving revision 1.63
diff -p -c -r1.63 configure.tgt
*** configure.tgt	2001/09/14 11:46:37	1.63
--- configure.tgt	2001/09/30 22:30:47
*************** mips*-*-linux-gnu*)	targ_emul=elf32btsmi
*** 301,306 ****
--- 301,309 ----
  			;;
  mips*-*-lnews*)		targ_emul=mipslnews ;;
  mips*-*-sysv4*)         targ_emul=elf32btsmip ;;
+ mmix-*-*)		targ_emul=mmo
+ 			targ_extra_emuls=elf64mmix
+ 			;;
  mn10200-*-*)		targ_emul=mn10200 ;;
  mn10300-*-*)		targ_emul=mn10300 ;;
  alpha*-*-freebsd*)	targ_emul=elf64alpha
Index: gen-doc.texi
===================================================================
RCS file: /cvs/src/src/ld/gen-doc.texi,v
retrieving revision 1.2
diff -p -c -r1.2 gen-doc.texi
*** gen-doc.texi	2000/06/20 13:29:06	1.2
--- gen-doc.texi	2001/09/30 22:30:47
***************
*** 5,10 ****
--- 5,11 ----
  @c 2. Specific target machines
  @set H8300
  @set I960
+ @set MMIX
  @set TICOFF

  @c 3. Properties of this configuration
Index: ld.texinfo
===================================================================
RCS file: /cvs/src/src/ld/ld.texinfo,v
retrieving revision 1.52
diff -p -c -r1.52 ld.texinfo
*** ld.texinfo	2001/09/29 12:57:54	1.52
--- ld.texinfo	2001/09/30 22:30:51
***************
*** 31,36 ****
--- 31,37 ----
  @set M680X0
  @set MCORE
  @set MIPS
+ @set MMIX
  @set PDP11
  @set PJ
  @set SH
*************** functionality are not listed.
*** 4261,4266 ****
--- 4262,4270 ----
  * i960::                        @code{ld} and the Intel 960 family
  * ARM::				@code{ld} and the ARM family
  * HPPA ELF32::                  @code{ld} and HPPA 32-bit ELF
+ @ifset MMIX
+ * MMIX::			@code{ld} and MMIX
+ @end ifset
  @ifset TICOFF
  * TI COFF::                     @code{ld} and TI COFF
  @end ifset
*************** Note that @samp{--stub-group-size} does
*** 4435,4440 ****
--- 4439,4470 ----
  single input section larger than the group size specified will of course
  create a larger group (of one section).  If input sections are too
  large, it may not be possible for a branch to reach its stub.
+
+ @ifset MMIX
+ @node MMIX
+ @section @code{ld} and MMIX
+ For MMIX, there is choice of generating @code{ELF} object files or
+ @code{mmo} object files when linking.  The simulator @code{mmix}
+ understands the @code{mmo} format.  The binutils @code{objcopy} utility
+ can translate between the two formats.
+
+ There is one special section, the @samp{.MMIX.reg_contents} section.
+ Contents in this section is assumed to correspond to that of global
+ registers, and symbols referring to it are translated to special symbols,
+ equal to registers.  In a final link, the start address of the
+ @samp{.MMIX.reg_contents} section corresponds to the first allocated
+ global register multiplied by 8.  Register @code{$255} is not included in
+ this section; it is always set to the program entry, which is at the
+ symbol @code{Main} for @code{mmo} files.
+
+ Symbols with the prefix @code{__.MMIX.start.}, for example
+ @code{__.MMIX.start..text} and @code{__.MMIX.start..data} are special;
+ there must be only one each, even if they are local.  The default linker
+ script uses these to set the default start address of a section.
+
+ Initial and trailing multiples of zero-valued 32-bit words in a section,
+ are left out from an mmo file.
+ @end ifset

  @ifset TICOFF
  @node TI COFF
*** /dev/null	Tue Jan  1 05:00:00 1980
--- emulparams/mmo.sh	Mon Aug  6 00:04:37 2001
***************
*** 0 ****
--- 1,10 ----
+ SCRIPT_NAME=mmo
+ TARGET_PAGE_SIZE=256
+
+ # Default to 0 as mmixal does.
+ TEXT_START_ADDR='DEFINED (__.MMIX.start..text) ? __.MMIX.start..text : 0'
+ DATA_ADDR='DEFINED (__.MMIX.start..data) ? __.MMIX.start..data : 0x2000000000000000'
+ OUTPUT_FORMAT=mmo
+ ARCH=mmix
+ COMPILE_IN=yes
+ EXTRA_EM_FILE=mmo
*** /dev/null	Tue Jan  1 05:00:00 1980
--- emulparams/elf64mmix.sh	Thu Aug 23 23:42:32 2001
***************
*** 0 ****
--- 1,60 ----
+ TEMPLATE_NAME=elf32
+ GENERATE_SHLIB_SCRIPT=yes
+ ELFSIZE=64
+ SCRIPT_NAME=elf
+ OUTPUT_FORMAT="elf64-mmix"
+ ENTRY=_start.
+
+ # Default to 0 as mmixal does.
+ TEXT_START_ADDR='DEFINED (__.MMIX.start..text) ? __.MMIX.start..text : 0'
+ # Don't add SIZEOF_HEADERS.
+ # Don't set EMBEDDED, that would be misleading; it's not that kind of system.
+ TEXT_BASE_ADDRESS=$TEXT_START_ADDR
+ DATA_ADDR='DEFINED (__.MMIX.start..data) ? __.MMIX.start..data : 0x2000000000000000'
+
+ # Setting this anywhere near the quite reasonable value of 0x10000
+ # causes the binary to bloat to reach page alignment between segments.
+ # Let's just have a 256-byte default page alignment.  Having some
+ # alignment at all gives a warm feeling but not much more.
+ MAXPAGESIZE=256
+ ARCH=mmix
+ MACHINE=
+ COMPILE_IN=yes
+ EXTRA_EM_FILE=mmixelf
+
+ # The existence of a symbol __start (or _start) should overrule Main, so
+ # it can be a user symbol without the associated mmixal magic.  We
+ # also want to provide Main as a synonym for _start, if Main wasn't
+ # defined but is referred to, and _start was defined.
+ #
+ # The reason we use a symbol "_start." as a mediator is to avoid
+ # causing ld to force the type of _start to object rather than no
+ # type, which confuses disassembly; we also make it alphanumerically
+ # a successor of _start for similar reasons.  Perhaps it's a linker
+ # bug that linker-defined symbols set the symbol-type.
+ #
+ # Note that we smuggle this into OTHER_TEXT_SECTIONS (at the end
+ # of .text) rather than TEXT_START_SYMBOLS.  This is necessary, as
+ # DEFINED wouldn't find the symbol if it was at the top; presumably
+ # before the definition, if the definition is not in the first file.
+ # FIXME: Arguably a linker bug.
+ OTHER_TEXT_SECTIONS='
+  _start. = (DEFINED (_start) ? _start
+             : (DEFINED (Main) ? Main : (DEFINED (.text) ? .text : 0)));
+  PROVIDE (Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : _start.));
+ '
+
+ OTHER_RELOCATING_SECTIONS='
+  .MMIX.reg_contents :
+  {
+    /* Note that this section always has a fixed VMA - that of its
+       first register * 8.  */
+    *(.MMIX.reg_contents);
+  }
+ '
+
+ # FIXME: Also bit by the PROVIDE bug?  If not, this could be
+ # EXECUTABLE_SYMBOLS.
+ # By default, put the high end of the stack where the register stack
+ # begins.  They grow in opposite directions.  */
+ OTHER_SECTIONS='PROVIDE (__Stack_start = 0x6000000000000000);'
*** /dev/null	Tue Jan  1 05:00:00 1980
--- emultempl/mmixelf.em	Thu Aug 23 23:31:27 2001
***************
*** 0 ****
--- 1,46 ----
+ # This shell script emits a C file. -*- C -*-
+ #   Copyright 2001 Free Software Foundation, Inc.
+ #
+ # This file is part of GLD, the Gnu Linker.
+ #
+ # This program 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 of the License, or
+ # (at your option) any later version.
+ #
+ # This program 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 this program; if not, write to the Free Software
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ #
+
+ # This file is sourced from elf32.em and used to define MMIX and ELF
+ # specific things.  First include what we have in common with mmo.
+
+ . ${srcdir}/emultempl/mmix-elfnmmo.em
+
+ cat >>e${EMULATION_NAME}.c <<EOF
+ #line 29 "${srcdir}/emultempl/elfmmix.em"
+
+ static void elfmmix_before_parse PARAMS ((void));
+
+ static void
+ elfmmix_before_parse ()
+ {
+   gld${EMULATION_NAME}_before_parse ();
+
+   /* Make sure we don't create a demand-paged executable.  Unfortunately
+      this isn't changeable with a command-line option.  It makes no
+      difference to mmo, but the sections in elf64mmix will be aligned to a
+      page in the linked file, which is non-intuitive.  If there's ever a
+      full system with shared libraries and demand paging, you will want to
+      exclude this file.  */
+   config.magic_demand_paged = false;
+ }
+ EOF
+
+ LDEMUL_BEFORE_PARSE=elfmmix_before_parse
*** /dev/null	Tue Jan  1 05:00:00 1980
--- emultempl/mmo.em	Wed Aug 29 15:59:07 2001
***************
*** 0 ****
--- 1,228 ----
+ # This shell script emits a C file. -*- C -*-
+ #   Copyright 2001 Free Software Foundation, Inc.
+ #
+ # This file is part of GLD, the Gnu Linker.
+ #
+ # This program 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 of the License, or
+ # (at your option) any later version.
+ #
+ # This program 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 this program; if not, write to the Free Software
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ #
+
+ # This file is sourced from elf32.em and mmo.em, used to define
+ # linker MMIX-specifics common to ELF and MMO.
+
+ . ${srcdir}/emultempl/mmix-elfnmmo.em
+
+ cat >>e${EMULATION_NAME}.c <<EOF
+
+ static boolean mmo_place_orphan
+   PARAMS ((lang_input_statement_type *, asection *));
+ static asection *output_prev_sec_find
+   PARAMS ((lang_output_section_statement_type *));
+ static void mmo_finish PARAMS ((void));
+ static void mmo_wipe_sec_reloc_flag PARAMS ((bfd *, asection *, PTR));
+
+ /* Find the last output section before given output statement.
+    Used by place_orphan.  */
+
+ static asection *
+ output_prev_sec_find (os)
+      lang_output_section_statement_type *os;
+ {
+   asection *s = (asection *) NULL;
+   lang_statement_union_type *u;
+   lang_output_section_statement_type *lookup;
+
+   for (u = lang_output_section_statement.head;
+        u != (lang_statement_union_type *) NULL;
+        u = lookup->next)
+     {
+       lookup = &u->output_section_statement;
+       if (lookup == os)
+ 	break;
+       if (lookup->bfd_section != NULL
+ 	  && lookup->bfd_section != bfd_abs_section_ptr
+ 	  && lookup->bfd_section != bfd_com_section_ptr
+ 	  && lookup->bfd_section != bfd_und_section_ptr)
+ 	s = lookup->bfd_section;
+     }
+
+   if (u == NULL)
+     return NULL;
+
+   return s;
+ }
+
+ struct orphan_save {
+   lang_output_section_statement_type *os;
+   asection **section;
+   lang_statement_union_type **stmt;
+ };
+
+ #define HAVE_SECTION(hold, name) \
+ (hold.os != NULL || (hold.os = lang_output_section_find (name)) != NULL)
+
+ /* Place an orphan section.  We use this to put random SEC_CODE or
+    SEC_READONLY sections right after MMO_TEXT_SECTION_NAME.  Much borrowed
+    from elf32.em.  */
+
+ static boolean
+ mmo_place_orphan (file, s)
+ 	lang_input_statement_type *file;
+ 	asection *s;
+ {
+   static struct orphan_save hold_text;
+   struct orphan_save *place;
+   lang_output_section_statement_type *os;
+   lang_statement_list_type *old;
+   lang_statement_list_type add;
+   asection *snew, **pps, *bfd_section;
+
+   /* We have nothing to say for anything other than a final link.  */
+   if (link_info.relocateable
+       || (bfd_get_section_flags (s->owner, s)
+ 	  & (SEC_EXCLUDE | SEC_LOAD)) != SEC_LOAD)
+     return false;
+
+   /* Only care for sections we're going to load.  */
+   os = lang_output_section_find (bfd_get_section_name (s->owner, s));
+
+   /* We have an output section by this name.  Place the section inside it
+      (regardless of whether the linker script lists it as input).  */
+   if (os != NULL)
+     {
+       lang_add_section (&os->children, s, os, file);
+       return true;
+     }
+
+   /* If this section does not have .text-type section flags or there's no
+      MMO_TEXT_SECTION_NAME, we don't have anything to say.  */
+   if ((bfd_get_section_flags (s->owner, s) & (SEC_CODE | SEC_READONLY)) == 0)
+     return false;
+
+   if (hold_text.os == NULL)
+     hold_text.os = lang_output_section_find (MMO_TEXT_SECTION_NAME);
+
+   place = &hold_text;
+
+   /* If there's an output section by this name, we'll use it, regardless
+      of section flags, in contrast to what's done in elf32.em.  */
+
+   /* Start building a list of statements for this section.
+      First save the current statement pointer.  */
+   old = stat_ptr;
+
+   /* Add the output section statements for this orphan to our own private
+      list, inserting them later into the global statement list.  */
+   stat_ptr = &add;
+   lang_list_init (stat_ptr);
+
+   os = lang_enter_output_section_statement (bfd_get_section_name (s->owner,
+ 								  s),
+ 					    NULL, 0,
+ 					    (bfd_vma) 0,
+ 					    (etree_type *) NULL,
+ 					    (etree_type *) NULL,
+ 					    (etree_type *) NULL);
+
+   lang_add_section (&os->children, s, os, file);
+
+   lang_leave_output_section_statement
+     ((bfd_vma) 0, "*default*",
+      (struct lang_output_section_phdr_list *) NULL, "*default*");
+
+   /* Restore the global list pointer.  */
+   stat_ptr = old;
+
+   snew = os->bfd_section;
+   bfd_section = place->os->bfd_section;
+   if (place->section == NULL && bfd_section == NULL)
+     bfd_section = output_prev_sec_find (place->os);
+
+   if (place->section != NULL
+       || (bfd_section != NULL
+ 	  && bfd_section != snew))
+     {
+       /* Shuffle the section to make the output file look neater.  This is
+ 	 really only cosmetic.  */
+       if (place->section == NULL)
+ 	/* Put orphans after the first section on the list.  */
+ 	place->section = &bfd_section->next;
+
+       /*  Unlink the section.  */
+       for (pps = &output_bfd->sections; *pps != snew; pps = &(*pps)->next)
+ 	;
+       *pps = snew->next;
+
+       /* Now tack it on to the "place->os" section list.  */
+       snew->next = *place->section;
+       *place->section = snew;
+     }
+   place->section = &snew->next;	/* Save the end of this list.  */
+
+   if (add.head != NULL)
+     {
+       /* We try to put the output statements in some sort of reasonable
+ 	 order here, because they determine the final load addresses of
+ 	 the orphan sections.  */
+       if (place->stmt == NULL)
+ 	{
+ 	  /* Put the new statement list right at the head.  */
+ 	  *add.tail = place->os->header.next;
+ 	  place->os->header.next = add.head;
+ 	}
+       else
+ 	{
+ 	  /* Put it after the last orphan statement we added.  */
+ 	  *add.tail = *place->stmt;
+ 	  *place->stmt = add.head;
+ 	}
+
+       /* Fix the global list pointer if we happened to tack our new list
+ 	 at the tail.  */
+       if (*old->tail == add.head)
+ 	old->tail = add.tail;
+
+       /* Save the end of this list.  */
+       place->stmt = add.tail;
+     }
+
+   return true;
+ }
+
+ /* Remove the spurious settings of SEC_RELOC that make it to the output at
+    link time.  We are as confused as elflink.h:elf_bfd_final_link, and
+    paper over the bug similarly.  */
+
+ static void
+ mmo_wipe_sec_reloc_flag (abfd, sec, ptr)
+      bfd *abfd;
+      asection *sec;
+      PTR ptr ATTRIBUTE_UNUSED;
+ {
+   bfd_set_section_flags (abfd, sec,
+ 			 bfd_get_section_flags (abfd, sec) & ~SEC_RELOC);
+ }
+
+ /* Iterate with bfd_map_over_sections over mmo_wipe_sec_reloc_flag... */
+
+ static void
+ mmo_finish ()
+ {
+   bfd_map_over_sections (output_bfd, mmo_wipe_sec_reloc_flag, NULL);
+ }
+
+ EOF
+
+ LDEMUL_PLACE_ORPHAN=mmo_place_orphan
+ LDEMUL_FINISH=mmo_finish
*** /dev/null	Tue Jan  1 05:00:00 1980
--- emultempl/mmix-elfnmmo.em	Sun Aug 26 21:40:45 2001
***************
*** 0 ****
--- 1,74 ----
+ # This shell script emits a C file. -*- C -*-
+ #   Copyright 2001 Free Software Foundation, Inc.
+ #
+ # This file is part of GLD, the Gnu Linker.
+ #
+ # This program 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 of the License, or
+ # (at your option) any later version.
+ #
+ # This program 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 this program; if not, write to the Free Software
+ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ #
+
+ # This file is sourced from elf32.em and mmo.em, used to define
+ # MMIX-specific things common to ELF and MMO.
+
+ cat >>e${EMULATION_NAME}.c <<EOF
+ #include "elf/mmix.h"
+
+ static void mmix_set_reg_section_vma PARAMS ((void));
+
+ /* We need to set the VMA of the .MMIX.reg_contents section when it has
+    been allocated.  */
+
+ static void
+ mmix_set_reg_section_vma ()
+ {
+   asection *sec
+     = bfd_get_section_by_name (output_bfd, MMIX_REG_CONTENTS_SECTION_NAME);
+   bfd_vma regvma;
+
+   /* If there's no register section, we don't need to do anything.  */
+   if (sec == NULL)
+     return;
+
+   regvma = 256 * 8 - sec->_raw_size - 8;
+
+   /* If we start on a local register, we have too many global registers.  */
+   if (regvma < 32 * 8)
+     einfo ("%X%P: Too many global registers: %u, max 223\n",
+ 	   (unsigned) sec->_raw_size / 8);
+
+   /* Set vma to correspond to first such register number * 8.  */
+   bfd_set_section_vma (output_bfd, sec, regvma);
+
+   /* ??? Why isn't the section size (_cooked_size) set?  Doesn't it get
+      set regardless of presence of relocations?  */
+   if (sec->_cooked_size == 0
+       && ! bfd_set_section_size (output_bfd, sec, sec->_raw_size))
+     {
+       einfo ("%X%P: Can't set section %s size to %u\n",
+ 	     MMIX_REG_CONTENTS_SECTION_NAME, (unsigned) sec->_raw_size);
+       return;
+     }
+
+   /* Simplify symbol output for the register section (without contents;
+      created for register symbols) by setting the output offset to 0.  */
+   sec = bfd_get_section_by_name (output_bfd, MMIX_REG_SECTION_NAME);
+   if (sec == NULL)
+     return;
+
+   bfd_set_section_vma (abfd, sec, 0);
+
+ }
+ EOF
+
+ LDEMUL_AFTER_ALLOCATION=mmix_set_reg_section_vma
*** /dev/null	Tue Jan  1 05:00:00 1980
--- scripttempl/mmo.sc	Wed Aug 29 18:16:23 2001
***************
*** 0 ****
--- 1,129 ----
+ cat <<EOF
+ OUTPUT_FORMAT("mmo")
+ OUTPUT_ARCH(mmix)
+ ENTRY(Main)
+ SECTIONS
+ {
+   .text ${RELOCATING+ ${TEXT_START_ADDR}}:
+   {
+     *(.text)
+     ${RELOCATING+*(.text.*)}
+     ${RELOCATING+*(.gnu.linkonce.t*)}
+     ${RELOCATING+*(.rodata)}
+     ${RELOCATING+*(.rodata.*)}
+     ${RELOCATING+*(.gnu.linkonce.r*)}
+
+     /* FIXME: Move .init, .fini, .ctors and .dtors to their own sections.  */
+     ${RELOCATING+ PROVIDE (_init_start = .);}
+     ${RELOCATING+ PROVIDE (_init = .);}
+     ${RELOCATING+ *(.init)}
+     ${RELOCATING+ PROVIDE (_init_end = .);}
+
+     ${RELOCATING+ PROVIDE (_fini_start = .);}
+     ${RELOCATING+ PROVIDE (_fini = .);}
+     ${RELOCATING+ *(.fini)}
+     ${RELOCATING+ PROVIDE (_fini_end = .);}
+
+     /* FIXME: Align ctors, dtors, ehframe.  */
+     ${RELOCATING+ PROVIDE (_ctors_start = .);}
+     ${RELOCATING+ PROVIDE (__ctors_start = .);}
+     ${RELOCATING+ PROVIDE (_ctors = .);}
+     ${RELOCATING+ PROVIDE (__ctors = .);}
+     ${RELOCATING+ KEEP (*crtbegin.o(.ctors))}
+     ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))}
+     ${RELOCATING+ KEEP (*(SORT(.ctors.*)))}
+     ${RELOCATING+ KEEP (*(.ctors))}
+     ${RELOCATING+ PROVIDE (_ctors_end = .);}
+     ${RELOCATING+ PROVIDE (__ctors_end = .);}
+
+     ${RELOCATING+ PROVIDE (_dtors_start = .);}
+     ${RELOCATING+ PROVIDE (__dtors_start = .);}
+     ${RELOCATING+ PROVIDE (_dtors = .);}
+     ${RELOCATING+ PROVIDE (__dtors = .);}
+     ${RELOCATING+ KEEP (*crtbegin.o(.dtors))}
+     ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))}
+     ${RELOCATING+ KEEP (*(SORT(.dtors.*)))}
+     ${RELOCATING+ KEEP (*(.dtors))}
+     ${RELOCATING+ PROVIDE (_dtors_end = .);}
+     ${RELOCATING+ PROVIDE (__dtors_end = .);}
+
+     ${RELOCATING+KEEP (*(.jcr))}
+     ${RELOCATING+KEEP (*(.eh_frame))}
+     ${RELOCATING+*(.gcc_except_table)}
+
+     ${RELOCATING+ PROVIDE(etext = .);}
+     ${RELOCATING+ PROVIDE(_etext = .);}
+     ${RELOCATING+ PROVIDE(__etext = .);}
+   }
+   ${RELOCATING+Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : . - SIZEOF (.text));}
+
+   .stab 0 : { *(.stab) }
+   .stabstr 0 : { *(.stabstr) }
+   .stab.excl 0 : { *(.stab.excl) }
+   .stab.exclstr 0 : { *(.stab.exclstr) }
+   .stab.index 0 : { *(.stab.index) }
+   .stab.indexstr 0 : { *(.stab.indexstr) }
+   .debug_aranges  0 : { *(.debug_aranges) }
+   .debug_pubnames 0 : { *(.debug_pubnames) }
+   .debug_info     0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
+   .debug_abbrev   0 : { *(.debug_abbrev) }
+   .debug_line     0 : { *(.debug_line) }
+   .debug_frame    0 : { *(.debug_frame) }
+   .debug_str      0 : { *(.debug_str) }
+   .debug_loc      0 : { *(.debug_loc) }
+   .debug_macinfo  0 : { *(.debug_macinfo) }
+
+   .data ${RELOCATING+ ${DATA_ADDR}}:
+   {
+     ${RELOCATING+ PROVIDE(__Sdata = .);}
+
+     *(.data);
+     ${RELOCATING+*(.data.*)}
+     ${RELOCATING+*(.gnu.linkonce.d*)}
+
+     ${RELOCATING+ PROVIDE(__Edata = .);}
+
+     /* Deprecated, use __Edata.  */
+     ${RELOCATING+ PROVIDE(edata = .);}
+     ${RELOCATING+ PROVIDE(_edata = .);}
+     ${RELOCATING+ PROVIDE(__edata = .);}
+   }
+
+   /* At the moment, although perhaps we should, we can't map sections
+      without contents to sections *with* contents due to FIXME: a BFD bug.
+      Anyway, the mmo back-end ignores sections without contents when
+      writing out sections, so this works fine.   */
+   .bss :
+   {
+     ${RELOCATING+ PROVIDE(__Sbss = .);}
+     ${RELOCATING+ PROVIDE(__bss_start = .);}
+     ${RELOCATING+ *(.sbss);}
+     ${RELOCATING+ *(.bss);}
+     ${RELOCATING+*(.bss.*)}
+     ${RELOCATING+ *(COMMON);}
+     ${RELOCATING+ PROVIDE(__Ebss = .);}
+   }
+
+   /* Deprecated, use __Ebss or __Eall as appropriate.  */
+   ${RELOCATING+ PROVIDE(end = .);}
+   ${RELOCATING+ PROVIDE(_end = .);}
+   ${RELOCATING+ PROVIDE(__end = .);}
+   ${RELOCATING+ PROVIDE(__Eall = .);}
+
+   .MMIX.reg_contents :
+   {
+     /* Note that this section always has a fixed VMA - that of its
+        first register * 8.  */
+     *(.MMIX.reg_contents);
+   }
+
+   /* By default, put the high end of the stack where the register stack
+      begins.  They grow in opposite directions.  */
+   PROVIDE (__Stack_start = 0x6000000000000000);
+
+   /* Unfortunately, stabs are not mappable from ELF to MMO.
+      It can probably be fixed with some amount of work.  */
+   /DISCARD/ :
+   { *(.gnu.warning.*); }
+ }
+ EOF

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]