Don't define _FORTIFY_SOURCE on MinGW
[deliverable/binutils-gdb.git] / ld / scripttempl / xstormy16.sc
index d504e18107e2d13f6b983beb67b3a48eb3091557..b89560873b3a9cb464746c14ea784712987ff21c 100644 (file)
@@ -1,3 +1,8 @@
+# Copyright (C) 2014-2020 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
 #
 # Unusual variables checked by this code:
 #      NOP - two byte opcode for no-op (defaults to 0)
@@ -7,7 +12,6 @@
 #      OTHER_TEXT_SECTIONS - these get put in .text when relocating
 #      OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
 #              (e.g., .PARISC.global)
-#      OTHER_BSS_SECTIONS - other than .bss .sbss ...
 #      OTHER_SECTIONS - at the end
 #      EXECUTABLE_SYMBOLS - symbols that must be defined for an
 #              executable (e.g., _DYNAMIC_LINK)
@@ -21,9 +25,9 @@
 #              .bss section besides __bss_start.
 #      INPUT_FILES - INPUT command of files to always include
 #      INIT_START, INIT_END -  statements just before and just after
-#      combination of .init sections.
+#      combination of .init sections.
 #      FINI_START, FINI_END - statements just before and just after
-#      combination of .fini sections.
+#      combination of .fini sections.
 #
 # When adding sections, do note that the names of some sections are used
 # when specifying the start address of the next.
@@ -55,7 +59,7 @@ test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
 if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
 test -z "${ELFSIZE}" && ELFSIZE=32
 test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
-CTOR=".ctors ${CONSTRUCTING-0} : 
+CTOR=".ctors ${CONSTRUCTING-0} :
   {
     ${CONSTRUCTING+${CTOR_START}}
     /* gcc uses crtbegin.o to find the start of
@@ -69,13 +73,14 @@ CTOR=".ctors ${CONSTRUCTING-0} :
        is in.  */
 
     KEEP (*crtbegin.o(.ctors))
+    KEEP (*crtbegin?.o(.ctors))
 
     /* We don't want to include the .ctor section from
-       from the crtend.o file until after the sorted ctors.
+       the crtend.o file until after the sorted ctors.
        The .ctor section from the crtend file contains the
        end of ctors marker and it must be last */
 
-    KEEP (*(EXCLUDE_FILE (*crtend.o $OTHER_EXCLUDE_FILES) .ctors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))
     KEEP (*(SORT(.ctors.*)))
     KEEP (*(.ctors))
     ${CONSTRUCTING+${CTOR_END}}
@@ -85,44 +90,54 @@ DTOR=" .dtors       ${CONSTRUCTING-0} :
   {
     ${CONSTRUCTING+${DTOR_START}}
     KEEP (*crtbegin.o(.dtors))
-    KEEP (*(EXCLUDE_FILE (*crtend.o $OTHER_EXCLUDE_FILES) .dtors))
+    KEEP (*crtbegin?.o(.dtors))
+    KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
     KEEP (*(SORT(.dtors.*)))
     KEEP (*(.dtors))
     ${CONSTRUCTING+${DTOR_END}}
   } > ROM"
 
 cat <<EOF
+/* Copyright (C) 2014-2020 Free Software Foundation, Inc.
+
+   Copying and distribution of this script, with or without modification,
+   are permitted in any medium without royalty provided the copyright
+   notice and this notice are preserved.  */
+
 OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
              "${LITTLE_OUTPUT_FORMAT}")
 OUTPUT_ARCH(${OUTPUT_ARCH})
+EOF
+
+test -n "${RELOCATING}" && cat <<EOF
 ENTRY(${ENTRY})
 
-${RELOCATING+${LIB_SEARCH_DIRS}}
-${RELOCATING+${EXECUTABLE_SYMBOLS}}
-${RELOCATING+${INPUT_FILES}}
-${RELOCATING- /* For some reason, the Solaris linker makes bad executables
-  if gld -r is used and the intermediate file has sections starting
-  at non-zero addresses.  Could be a Solaris ld bug, could be a GNU ld
-  bug.  But for now assigning the zero vmas works.  */}
+${LIB_SEARCH_DIRS}
+${EXECUTABLE_SYMBOLS}
+${INPUT_FILES}
 
 /* There are two memory regions we care about, one from 0 through 0x7F00
    that is RAM and one from 0x8000 up which is ROM.  */
-MEMORY 
+MEMORY
 {
   RAM (w) : ORIGIN = 0, LENGTH = 0x7F00
   ROM (!w) : ORIGIN = 0x8000, LENGTH = 0xFF8000
 }
+EOF
 
+cat <<EOF
 SECTIONS
 {
   .data  ${RELOCATING-0} :
   {
+    ${RELOCATING+__rdata = .;}
+    ${RELOCATING+__data = .;}
     ${RELOCATING+${DATA_START_SYMBOLS}}
     *(.data)
     ${RELOCATING+*(.data.*)}
     ${RELOCATING+*(.gnu.linkonce.d.*)}
     ${CONSTRUCTING+SORT(CONSTRUCTORS)}
-  } > RAM
+  }${RELOCATING+ > RAM}
   ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
   ${RELOCATING+${OTHER_GOT_SYMBOLS}}
   ${RELOCATING+${OTHER_GOT_SECTIONS}}
@@ -132,33 +147,33 @@ SECTIONS
   ${RELOCATING+${OTHER_BSS_SYMBOLS}}
   .bss     ${RELOCATING-0} :
   {
-   *(.dynbss)
+   ${RELOCATING+*(.dynbss)}
    *(.bss)
    ${RELOCATING+*(.bss.*)}
    ${RELOCATING+*(.gnu.linkonce.b.*)}
-   *(COMMON)
+   ${RELOCATING+*(COMMON)
    /* Align here to ensure that the .bss section occupies space up to
       _end.  Align after .bss to ensure correct alignment even if the
       .bss section disappears because there are no input sections.  */
-   ${RELOCATING+. = ALIGN(${ALIGNMENT});}
-  } > RAM
-  ${RELOCATING+${OTHER_BSS_SECTIONS}}
+   . = ALIGN(${ALIGNMENT});}
+  }${RELOCATING+ > RAM}
+  ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
   ${RELOCATING+. = ALIGN(${ALIGNMENT});}
-  ${RELOCATING+__stack = .;}
-  ${RELOCATING+. = . + 4096;}
+  ${RELOCATING+${OTHER_END_SYMBOLS}}
   ${RELOCATING+_end = .;}
-  ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
+  ${RELOCATING+__stack = .;}
   ${RELOCATING+PROVIDE (end = .);}
 
   /* Read-only sections in ROM.  */
-  .int_vec     ${RELOCATING-0} : { *(.int_vec) } > ROM
+  .int_vec     ${RELOCATING-0} : { *(.int_vec) }${RELOCATING+ > ROM}
 
-  .rodata ${RELOCATING-0} : { *(.rodata) ${RELOCATING+*(.rodata.*)} ${RELOCATING+*(.gnu.linkonce.r.*)} } > ROM
+  .rodata ${RELOCATING-0} : { *(.rodata) ${RELOCATING+*(.rodata.*)} ${RELOCATING+*(.gnu.linkonce.r.*)} }${RELOCATING+ > ROM}
   ${RELOCATING+${CTOR}}
   ${RELOCATING+${DTOR}}
-  .eh_frame : { KEEP (*(.eh_frame)) } > ROM
-  .gcc_except_table : { *(.gcc_except_table) } > ROM
-  .plt : { *(.plt) } > ROM
+  .jcr : { KEEP (*(.jcr)) }${RELOCATING+ > ROM}
+  .eh_frame : { KEEP (*(.eh_frame)) }${RELOCATING+ > ROM}
+  .gcc_except_table : { *(.gcc_except_table)${RELOCATING+ *(.gcc_except_table.*)} }${RELOCATING+ > ROM}
+  .plt : { *(.plt) }${RELOCATING+ > ROM}
 
   .text    ${RELOCATING-0} :
   {
@@ -166,23 +181,23 @@ SECTIONS
     *(.text)
     ${RELOCATING+*(.text.*)}
     *(.stub)
-    /* .gnu.warning sections are handled specially by elf32.em.  */
+    /* .gnu.warning sections are handled specially by elf.em.  */
     *(.gnu.warning)
     ${RELOCATING+*(.gnu.linkonce.t.*)}
     ${RELOCATING+${OTHER_TEXT_SECTIONS}}
-  } > ROM =${NOP-0}
-  .init        ${RELOCATING-0} : 
-  { 
+  }${RELOCATING+ > ROM =${NOP-0}}
+  .init        ${RELOCATING-0} :
+  {
     ${RELOCATING+${INIT_START}}
-    KEEP (*(.init))
+    KEEP (*(SORT_NONE(.init)))
     ${RELOCATING+${INIT_END}}
-  } > ROM =${NOP-0}
+  }${RELOCATING+ > ROM =${NOP-0}}
   .fini    ${RELOCATING-0} :
   {
     ${RELOCATING+${FINI_START}}
-    KEEP (*(.fini))
+    KEEP (*(SORT_NONE(.fini)))
     ${RELOCATING+${FINI_END}}
-  } > ROM =${NOP-0}
+  }${RELOCATING+ > ROM =${NOP-0}}
   ${RELOCATING+PROVIDE (__etext = .);}
   ${RELOCATING+PROVIDE (_etext = .);}
   ${RELOCATING+PROVIDE (etext = .);}
@@ -199,37 +214,11 @@ SECTIONS
 
   .comment 0 : { *(.comment) }
 
-  /* DWARF debug sections.
-     Symbols in the DWARF debugging sections are relative to the beginning
-     of the section so we begin them at 0.  */
-
-  /* DWARF 1 */
-  .debug          0 : { *(.debug) }
-  .line           0 : { *(.line) }
-
-  /* GNU DWARF 1 extensions */
-  .debug_srcinfo  0 : { *(.debug_srcinfo) }
-  .debug_sfnames  0 : { *(.debug_sfnames) }
-
-  /* DWARF 1.1 and DWARF 2 */
-  .debug_aranges  0 : { *(.debug_aranges) }
-  .debug_pubnames 0 : { *(.debug_pubnames) }
-
-  /* DWARF 2 */
-  .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) }
-
-  /* SGI/MIPS DWARF 2 extensions */
-  .debug_weaknames 0 : { *(.debug_weaknames) }
-  .debug_funcnames 0 : { *(.debug_funcnames) }
-  .debug_typenames 0 : { *(.debug_typenames) }
-  .debug_varnames  0 : { *(.debug_varnames) }
+EOF
+
+. $srcdir/scripttempl/DWARF.sc
 
+cat <<EOF
   ${RELOCATING+${OTHER_RELOCATING_SECTIONS}}
 
   /* These must appear regardless of ${RELOCATING}.  */
This page took 0.027088 seconds and 4 git commands to generate.