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