Merge from gcc:
[deliverable/binutils-gdb.git] / ld / scripttempl / mmo.sc
index 5b9ef853226be90bdb0547b58612a12b1abf79f1..33808846ac7e3de375c4d8b2f75d961976e0a64b 100644 (file)
@@ -1,7 +1,11 @@
+# MMO is not a relocateable format, and we don't want to require an
+# explicit (e.g.) "-m elf64mmix" when -r is used.
+test -z $RELOCATEABLE_OUTPUT_FORMAT && RELOCATEABLE_OUTPUT_FORMAT=$OUTPUT_FORMAT
+test -z ${RELOCATING+0} && OUTPUT_FORMAT=$RELOCATEABLE_OUTPUT_FORMAT
 cat <<EOF
-OUTPUT_FORMAT("mmo")
+OUTPUT_FORMAT("$OUTPUT_FORMAT")
 OUTPUT_ARCH(mmix)
-ENTRY(Main)
+${RELOCATING+ENTRY(Main)}
 SECTIONS
 {
   .text ${RELOCATING+ ${TEXT_START_ADDR}}:
@@ -16,12 +20,12 @@ SECTIONS
     /* FIXME: Move .init, .fini, .ctors and .dtors to their own sections.  */
     ${RELOCATING+ PROVIDE (_init_start = .);}
     ${RELOCATING+ PROVIDE (_init = .);}
-    ${RELOCATING+ *(.init)}
+    ${RELOCATING+ KEEP (*(.init))}
     ${RELOCATING+ PROVIDE (_init_end = .);}
 
     ${RELOCATING+ PROVIDE (_fini_start = .);}
     ${RELOCATING+ PROVIDE (_fini = .);}
-    ${RELOCATING+ *(.fini)}
+    ${RELOCATING+ KEEP (*(.fini))}
     ${RELOCATING+ PROVIDE (_fini_end = .);}
 
     /* FIXME: Align ctors, dtors, ehframe.  */
@@ -30,7 +34,8 @@ SECTIONS
     ${RELOCATING+ PROVIDE (_ctors = .);}
     ${RELOCATING+ PROVIDE (__ctors = .);}
     ${RELOCATING+ KEEP (*crtbegin.o(.ctors))}
-    ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))}
+    ${RELOCATING+ KEEP (*crtbegin?.o(.ctors))}
+    ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .ctors))}
     ${RELOCATING+ KEEP (*(SORT(.ctors.*)))}
     ${RELOCATING+ KEEP (*(.ctors))}
     ${RELOCATING+ PROVIDE (_ctors_end = .);}
@@ -41,7 +46,8 @@ SECTIONS
     ${RELOCATING+ PROVIDE (_dtors = .);}
     ${RELOCATING+ PROVIDE (__dtors = .);}
     ${RELOCATING+ KEEP (*crtbegin.o(.dtors))}
-    ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))}
+    ${RELOCATING+ KEEP (*crtbegin?.o(.dtors))}
+    ${RELOCATING+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o) .dtors))}
     ${RELOCATING+ KEEP (*(SORT(.dtors.*)))}
     ${RELOCATING+ KEEP (*(.dtors))}
     ${RELOCATING+ PROVIDE (_dtors_end = .);}
@@ -55,7 +61,7 @@ SECTIONS
     ${RELOCATING+ PROVIDE(_etext = .);}
     ${RELOCATING+ PROVIDE(__etext = .);}
   }
-  ${RELOCATING+Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : . - SIZEOF (.text));}
+  ${RELOCATING+Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : ADDR (.text));}
 
   .stab 0 : { *(.stab) }
   .stabstr 0 : { *(.stabstr) }
@@ -115,6 +121,7 @@ SECTIONS
   {
     /* Note that this section always has a fixed VMA - that of its
        first register * 8.  */
+    *(.MMIX.reg_contents.linker_allocated);
     *(.MMIX.reg_contents);
   }
 
@@ -125,6 +132,6 @@ SECTIONS
   /* Unfortunately, stabs are not mappable from ELF to MMO.
      It can probably be fixed with some amount of work.  */
   /DISCARD/ :
-  { *(.gnu.warning.*); }
+  { ${RELOCATING+ *(.gnu.warning.*);} }
 }
 EOF
This page took 0.024092 seconds and 4 git commands to generate.