Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Linker script for vDSO.  This is an ELF shared object prelinked to
0003  * its virtual address, and with only one read-only segment.
0004  * This script controls its layout.
0005  */
0006 
0007 #if defined(BUILD_VDSO64)
0008 # define SHDR_SIZE 64
0009 #elif defined(BUILD_VDSO32)
0010 # define SHDR_SIZE 40
0011 #else
0012 # error unknown VDSO target
0013 #endif
0014 
0015 #define NUM_FAKE_SHDRS 7
0016 
0017 SECTIONS
0018 {
0019     /*
0020      * User/kernel shared data is before the vDSO.  This may be a little
0021      * uglier than putting it after the vDSO, but it avoids issues with
0022      * non-allocatable things that dangle past the end of the PT_LOAD
0023      * segment. Page size is 8192 for both 64-bit and 32-bit vdso binaries
0024      */
0025 
0026     vvar_start = . -8192;
0027     vvar_data = vvar_start;
0028 
0029     . = SIZEOF_HEADERS;
0030 
0031     .hash       : { *(.hash) }          :text
0032     .gnu.hash   : { *(.gnu.hash) }
0033     .dynsym     : { *(.dynsym) }
0034     .dynstr     : { *(.dynstr) }
0035     .gnu.version    : { *(.gnu.version) }
0036     .gnu.version_d  : { *(.gnu.version_d) }
0037     .gnu.version_r  : { *(.gnu.version_r) }
0038 
0039     .dynamic    : { *(.dynamic) }       :text   :dynamic
0040 
0041     .rodata     : {
0042         *(.rodata*)
0043         *(.data*)
0044         *(.sdata*)
0045         *(.got.plt) *(.got)
0046         *(.gnu.linkonce.d.*)
0047         *(.bss*)
0048         *(.dynbss*)
0049         *(.gnu.linkonce.b.*)
0050 
0051         /*
0052          * Ideally this would live in a C file: kept in here for
0053          * compatibility with x86-64.
0054          */
0055         VDSO_FAKE_SECTION_TABLE_START = .;
0056         . = . + NUM_FAKE_SHDRS * SHDR_SIZE;
0057         VDSO_FAKE_SECTION_TABLE_END = .;
0058     }                       :text
0059 
0060     .fake_shstrtab  : { *(.fake_shstrtab) }     :text
0061 
0062 
0063     .note       : { *(.note.*) }        :text   :note
0064 
0065     .eh_frame_hdr   : { *(.eh_frame_hdr) }      :text   :eh_frame_hdr
0066     .eh_frame   : { KEEP (*(.eh_frame)) }   :text
0067 
0068 
0069     /*
0070      * Text is well-separated from actual data: there's plenty of
0071      * stuff that isn't used at runtime in between.
0072      */
0073 
0074     .text       : { *(.text*) }         :text   =0x90909090,
0075 
0076     /DISCARD/ : {
0077         *(.discard)
0078         *(.discard.*)
0079         *(__bug_table)
0080     }
0081 }
0082 
0083 /*
0084  * Very old versions of ld do not recognize this name token; use the constant.
0085  */
0086 #define PT_GNU_EH_FRAME 0x6474e550
0087 
0088 /*
0089  * We must supply the ELF program headers explicitly to get just one
0090  * PT_LOAD segment, and set the flags explicitly to make segments read-only.
0091  */
0092 PHDRS
0093 {
0094     text        PT_LOAD     FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */
0095     dynamic     PT_DYNAMIC  FLAGS(4);       /* PF_R */
0096     note        PT_NOTE     FLAGS(4);       /* PF_R */
0097     eh_frame_hdr    PT_GNU_EH_FRAME;
0098 }