Home | History | Annotate | Download | only in ldscripts
      1 /* Script for -n: mix text and data on same page */
      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.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   . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
     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_SEGMENT_RELRO_END (0, .);
    127   .data           :
    128   {
    129     PROVIDE (__data_start = .);
    130     *(.data .data.* .gnu.linkonce.d.*)
    131     SORT(CONSTRUCTORS)
    132   }
    133   .data1          : { *(.data1) }
    134   .note.ABI-tag   : { *(.note.ABI-tag) }
    135   .got            : { *(.got.plt) *(.got) }
    136   /* We want the small data sections together, so single-instruction offsets
    137      can access them all, and initialized data all before uninitialized, so
    138      we can shorten the on-disk segment size.  */
    139   .sdata          :
    140   {
    141     *(.sdata .sdata.* .gnu.linkonce.s.*)
    142   }
    143   _edata = .; PROVIDE (edata = .);
    144   __bss_start = .;
    145   .sbss           :
    146   {
    147     *(.dynsbss)
    148     *(.sbss .sbss.* .gnu.linkonce.sb.*)
    149     *(.scommon)
    150   }
    151   .bss            :
    152   {
    153    *(.dynbss)
    154    *(.bss .bss.* .gnu.linkonce.b.*)
    155    *(COMMON)
    156    /* Align here to ensure that the .bss section occupies space up to
    157       _end.  Align after .bss to ensure correct alignment even if the
    158       .bss section disappears because there are no input sections.
    159       FIXME: Why do we need it? When there is no .bss section, we don't
    160       pad the .data section.  */
    161    . = ALIGN(. != 0 ? 32 / 8 : 1);
    162   }
    163   . = ALIGN(32 / 8);
    164   . = ALIGN(32 / 8);
    165   _end = .; PROVIDE (end = .);
    166   . = DATA_SEGMENT_END (.);
    167   /* Stabs debugging sections.  */
    168   .stab          0 : { *(.stab) }
    169   .stabstr       0 : { *(.stabstr) }
    170   .stab.excl     0 : { *(.stab.excl) }
    171   .stab.exclstr  0 : { *(.stab.exclstr) }
    172   .stab.index    0 : { *(.stab.index) }
    173   .stab.indexstr 0 : { *(.stab.indexstr) }
    174   .comment       0 : { *(.comment) }
    175   /* DWARF debug sections.
    176      Symbols in the DWARF debugging sections are relative to the beginning
    177      of the section so we begin them at 0.  */
    178   /* DWARF 1 */
    179   .debug          0 : { *(.debug) }
    180   .line           0 : { *(.line) }
    181   /* GNU DWARF 1 extensions */
    182   .debug_srcinfo  0 : { *(.debug_srcinfo) }
    183   .debug_sfnames  0 : { *(.debug_sfnames) }
    184   /* DWARF 1.1 and DWARF 2 */
    185   .debug_aranges  0 : { *(.debug_aranges) }
    186   .debug_pubnames 0 : { *(.debug_pubnames) }
    187   /* DWARF 2 */
    188   .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
    189   .debug_abbrev   0 : { *(.debug_abbrev) }
    190   .debug_line     0 : { *(.debug_line) }
    191   .debug_frame    0 : { *(.debug_frame) }
    192   .debug_str      0 : { *(.debug_str) }
    193   .debug_loc      0 : { *(.debug_loc) }
    194   .debug_macinfo  0 : { *(.debug_macinfo) }
    195   /* SGI/MIPS DWARF 2 extensions */
    196   .debug_weaknames 0 : { *(.debug_weaknames) }
    197   .debug_funcnames 0 : { *(.debug_funcnames) }
    198   .debug_typenames 0 : { *(.debug_typenames) }
    199   .debug_varnames  0 : { *(.debug_varnames) }
    200   /* DWARF 3 */
    201   .debug_pubtypes 0 : { *(.debug_pubtypes) }
    202   .debug_ranges   0 : { *(.debug_ranges) }
    203   .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
    204   /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
    205 }
    206