Home | History | Annotate | Download | only in ldscripts
      1 /* Script for -N: mix text and data on same page; don't align data */
      2 OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux",
      3 	      "elf32-sh-linux")
      4 OUTPUT_ARCH(sh)
      5 ENTRY(_start)
      6 SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");
      7 SECTIONS
      8 {
      9   /* Read-only sections, merged into text segment: */
     10   PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS;
     11   .interp         : { *(.interp) }
     12   .note.gnu.build-id : { *(.note.gnu.build-id) }
     13   .hash           : { *(.hash) }
     14   .gnu.hash       : { *(.gnu.hash) }
     15   .dynsym         : { *(.dynsym) }
     16   .dynstr         : { *(.dynstr) }
     17   .gnu.version    : { *(.gnu.version) }
     18   .gnu.version_d  : { *(.gnu.version_d) }
     19   .gnu.version_r  : { *(.gnu.version_r) }
     20   .rela.init      : { *(.rela.init) }
     21   .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
     22   .rela.fini      : { *(.rela.fini) }
     23   .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
     24   .rela.data.rel.ro   : { *(.rela.data.rel.ro* .rela.gnu.linkonce.d.rel.ro.*) }
     25   .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
     26   .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
     27   .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
     28   .rela.ctors     : { *(.rela.ctors) }
     29   .rela.dtors     : { *(.rela.dtors) }
     30   .rela.got       : { *(.rela.got) }
     31   .rela.sdata     : { *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) }
     32   .rela.sbss      : { *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) }
     33   .rela.sdata2    : { *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) }
     34   .rela.sbss2     : { *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) }
     35   .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
     36   .rela.plt       : { *(.rela.plt) }
     37   .init           :
     38   {
     39     KEEP (*(.init))
     40   } =0
     41   .plt            : { *(.plt) }
     42   .text           :
     43   {
     44     *(.text .stub .text.* .gnu.linkonce.t.*)
     45     /* .gnu.warning sections are handled specially by elf32.em.  */
     46     *(.gnu.warning)
     47   } =0
     48   .fini           :
     49   {
     50     KEEP (*(.fini))
     51   } =0
     52   PROVIDE (__etext = .);
     53   PROVIDE (_etext = .);
     54   PROVIDE (etext = .);
     55   .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
     56   .rodata1        : { *(.rodata1) }
     57   .sdata2         :
     58   {
     59     *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
     60   }
     61   .sbss2          : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
     62   .eh_frame_hdr : { *(.eh_frame_hdr) }
     63   .eh_frame       : ONLY_IF_RO { KEEP (*(.eh_frame)) }
     64   .gcc_except_table   : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
     65   /* Adjust the address for the data segment.  We want to adjust up to
     66      the same address within the page on the next page up.  */
     67   . = .;
     68   /* Exception handling  */
     69   .eh_frame       : ONLY_IF_RW { KEEP (*(.eh_frame)) }
     70   .gcc_except_table   : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
     71   /* Thread Local Storage sections  */
     72   .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
     73   .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
     74   .preinit_array     :
     75   {
     76     PROVIDE_HIDDEN (__preinit_array_start = .);
     77     KEEP (*(.preinit_array))
     78     PROVIDE_HIDDEN (__preinit_array_end = .);
     79   }
     80   .init_array     :
     81   {
     82      PROVIDE_HIDDEN (__init_array_start = .);
     83      KEEP (*(SORT(.init_array.*)))
     84      KEEP (*(.init_array))
     85      PROVIDE_HIDDEN (__init_array_end = .);
     86   }
     87   .fini_array     :
     88   {
     89     PROVIDE_HIDDEN (__fini_array_start = .);
     90     KEEP (*(.fini_array))
     91     KEEP (*(SORT(.fini_array.*)))
     92     PROVIDE_HIDDEN (__fini_array_end = .);
     93   }
     94   .ctors          :
     95   {
     96     /* gcc uses crtbegin.o to find the start of
     97        the constructors, so we make sure it is
     98        first.  Because this is a wildcard, it
     99        doesn't matter if the user does not
    100        actually link against crtbegin.o; the
    101        linker won't look for a file to match a
    102        wildcard.  The wildcard also means that it
    103        doesn't matter which directory crtbegin.o
    104        is in.  */
    105     KEEP (*crtbegin.o(.ctors))
    106     KEEP (*crtbegin?.o(.ctors))
    107     /* We don't want to include the .ctor section from
    108        the crtend.o file until after the sorted ctors.
    109        The .ctor section from the crtend file contains the
    110        end of ctors marker and it must be last */
    111     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
    112     KEEP (*(SORT(.ctors.*)))
    113     KEEP (*(.ctors))
    114   }
    115   .dtors          :
    116   {
    117     KEEP (*crtbegin.o(.dtors))
    118     KEEP (*crtbegin?.o(.dtors))
    119     KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
    120     KEEP (*(SORT(.dtors.*)))
    121     KEEP (*(.dtors))
    122   }
    123   .jcr            : { KEEP (*(.jcr)) }
    124   .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
    125   .dynamic        : { *(.dynamic) }
    126   .data           :
    127   {
    128     PROVIDE (__data_start = .);
    129     *(.data .data.* .gnu.linkonce.d.*)
    130     SORT(CONSTRUCTORS)
    131   }
    132   .data1          : { *(.data1) }
    133   .note.ABI-tag   : { *(.note.ABI-tag) }
    134   .got            : { *(.got.plt) *(.got) }
    135   /* We want the small data sections together, so single-instruction offsets
    136      can access them all, and initialized data all before uninitialized, so
    137      we can shorten the on-disk segment size.  */
    138   .sdata          :
    139   {
    140     *(.sdata .sdata.* .gnu.linkonce.s.*)
    141   }
    142   _edata = .; PROVIDE (edata = .);
    143   __bss_start = .;
    144   .sbss           :
    145   {
    146     *(.dynsbss)
    147     *(.sbss .sbss.* .gnu.linkonce.sb.*)
    148     *(.scommon)
    149   }
    150   .bss            :
    151   {
    152    *(.dynbss)
    153    *(.bss .bss.* .gnu.linkonce.b.*)
    154    *(COMMON)
    155    /* Align here to ensure that the .bss section occupies space up to
    156       _end.  Align after .bss to ensure correct alignment even if the
    157       .bss section disappears because there are no input sections.
    158       FIXME: Why do we need it? When there is no .bss section, we don't
    159       pad the .data section.  */
    160    . = ALIGN(. != 0 ? 32 / 8 : 1);
    161   }
    162   . = ALIGN(32 / 8);
    163   . = ALIGN(32 / 8);
    164   _end = .; PROVIDE (end = .);
    165   /* Stabs debugging sections.  */
    166   .stab          0 : { *(.stab) }
    167   .stabstr       0 : { *(.stabstr) }
    168   .stab.excl     0 : { *(.stab.excl) }
    169   .stab.exclstr  0 : { *(.stab.exclstr) }
    170   .stab.index    0 : { *(.stab.index) }
    171   .stab.indexstr 0 : { *(.stab.indexstr) }
    172   .comment       0 : { *(.comment) }
    173   /* DWARF debug sections.
    174      Symbols in the DWARF debugging sections are relative to the beginning
    175      of the section so we begin them at 0.  */
    176   /* DWARF 1 */
    177   .debug          0 : { *(.debug) }
    178   .line           0 : { *(.line) }
    179   /* GNU DWARF 1 extensions */
    180   .debug_srcinfo  0 : { *(.debug_srcinfo) }
    181   .debug_sfnames  0 : { *(.debug_sfnames) }
    182   /* DWARF 1.1 and DWARF 2 */
    183   .debug_aranges  0 : { *(.debug_aranges) }
    184   .debug_pubnames 0 : { *(.debug_pubnames) }
    185   /* DWARF 2 */
    186   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
    187   .debug_abbrev   0 : { *(.debug_abbrev) }
    188   .debug_line     0 : { *(.debug_line) }
    189   .debug_frame    0 : { *(.debug_frame) }
    190   .debug_str      0 : { *(.debug_str) }
    191   .debug_loc      0 : { *(.debug_loc) }
    192   .debug_macinfo  0 : { *(.debug_macinfo) }
    193   /* SGI/MIPS DWARF 2 extensions */
    194   .debug_weaknames 0 : { *(.debug_weaknames) }
    195   .debug_funcnames 0 : { *(.debug_funcnames) }
    196   .debug_typenames 0 : { *(.debug_typenames) }
    197   .debug_varnames  0 : { *(.debug_varnames) }
    198   /* DWARF 3 */
    199   .debug_pubtypes 0 : { *(.debug_pubtypes) }
    200   .debug_ranges   0 : { *(.debug_ranges) }
    201   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
    202   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
    203 }
    204