1 /* 1 /* 2 * Linker script for vDSO. This is an ELF sha 2 * Linker script for vDSO. This is an ELF shared object prelinked to 3 * its virtual address, and with only one read 3 * its virtual address, and with only one read-only segment. 4 * This script controls its layout. 4 * This script controls its layout. 5 */ 5 */ 6 6 7 #if defined(BUILD_VDSO64) 7 #if defined(BUILD_VDSO64) 8 # define SHDR_SIZE 64 8 # define SHDR_SIZE 64 9 #elif defined(BUILD_VDSO32) 9 #elif defined(BUILD_VDSO32) 10 # define SHDR_SIZE 40 10 # define SHDR_SIZE 40 11 #else 11 #else 12 # error unknown VDSO target 12 # error unknown VDSO target 13 #endif 13 #endif 14 14 15 #define NUM_FAKE_SHDRS 7 15 #define NUM_FAKE_SHDRS 7 16 16 17 SECTIONS 17 SECTIONS 18 { 18 { 19 /* 19 /* 20 * User/kernel shared data is before t 20 * User/kernel shared data is before the vDSO. This may be a little 21 * uglier than putting it after the vD 21 * uglier than putting it after the vDSO, but it avoids issues with 22 * non-allocatable things that dangle 22 * non-allocatable things that dangle past the end of the PT_LOAD 23 * segment. Page size is 8192 for both 23 * segment. Page size is 8192 for both 64-bit and 32-bit vdso binaries 24 */ 24 */ 25 25 26 vvar_start = . -8192; 26 vvar_start = . -8192; 27 vvar_data = vvar_start; 27 vvar_data = vvar_start; 28 28 29 . = SIZEOF_HEADERS; 29 . = SIZEOF_HEADERS; 30 30 31 .hash : { *(.hash) } 31 .hash : { *(.hash) } :text 32 .gnu.hash : { *(.gnu.hash) } 32 .gnu.hash : { *(.gnu.hash) } 33 .dynsym : { *(.dynsym) } 33 .dynsym : { *(.dynsym) } 34 .dynstr : { *(.dynstr) } 34 .dynstr : { *(.dynstr) } 35 .gnu.version : { *(.gnu.version) } 35 .gnu.version : { *(.gnu.version) } 36 .gnu.version_d : { *(.gnu.version_d) 36 .gnu.version_d : { *(.gnu.version_d) } 37 .gnu.version_r : { *(.gnu.version_r) 37 .gnu.version_r : { *(.gnu.version_r) } 38 38 39 .dynamic : { *(.dynamic) } 39 .dynamic : { *(.dynamic) } :text :dynamic 40 40 41 .rodata : { 41 .rodata : { 42 *(.rodata*) 42 *(.rodata*) 43 *(.data*) 43 *(.data*) 44 *(.sdata*) 44 *(.sdata*) 45 *(.got.plt) *(.got) 45 *(.got.plt) *(.got) 46 *(.gnu.linkonce.d.*) 46 *(.gnu.linkonce.d.*) 47 *(.bss*) 47 *(.bss*) 48 *(.dynbss*) 48 *(.dynbss*) 49 *(.gnu.linkonce.b.*) 49 *(.gnu.linkonce.b.*) 50 50 51 /* 51 /* 52 * Ideally this would live in 52 * Ideally this would live in a C file: kept in here for 53 * compatibility with x86-64. 53 * compatibility with x86-64. 54 */ 54 */ 55 VDSO_FAKE_SECTION_TABLE_START 55 VDSO_FAKE_SECTION_TABLE_START = .; 56 . = . + NUM_FAKE_SHDRS * SHDR_ 56 . = . + NUM_FAKE_SHDRS * SHDR_SIZE; 57 VDSO_FAKE_SECTION_TABLE_END = 57 VDSO_FAKE_SECTION_TABLE_END = .; 58 } 58 } :text 59 59 60 .fake_shstrtab : { *(.fake_shstrtab) 60 .fake_shstrtab : { *(.fake_shstrtab) } :text 61 61 62 62 63 .note : { *(.note.*) } 63 .note : { *(.note.*) } :text :note 64 64 65 .eh_frame_hdr : { *(.eh_frame_hdr) } 65 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr 66 .eh_frame : { KEEP (*(.eh_frame) 66 .eh_frame : { KEEP (*(.eh_frame)) } :text 67 67 68 68 69 /* 69 /* 70 * Text is well-separated from actual 70 * Text is well-separated from actual data: there's plenty of 71 * stuff that isn't used at runtime in 71 * stuff that isn't used at runtime in between. 72 */ 72 */ 73 73 74 .text : { *(.text*) } 74 .text : { *(.text*) } :text =0x90909090, 75 75 76 /DISCARD/ : { 76 /DISCARD/ : { 77 *(.discard) 77 *(.discard) 78 *(.discard.*) 78 *(.discard.*) 79 *(__bug_table) 79 *(__bug_table) 80 } 80 } 81 } 81 } 82 82 83 /* 83 /* 84 * Very old versions of ld do not recognize th 84 * Very old versions of ld do not recognize this name token; use the constant. 85 */ 85 */ 86 #define PT_GNU_EH_FRAME 0x6474e550 86 #define PT_GNU_EH_FRAME 0x6474e550 87 87 88 /* 88 /* 89 * We must supply the ELF program headers expl 89 * We must supply the ELF program headers explicitly to get just one 90 * PT_LOAD segment, and set the flags explicit 90 * PT_LOAD segment, and set the flags explicitly to make segments read-only. 91 */ 91 */ 92 PHDRS 92 PHDRS 93 { 93 { 94 text PT_LOAD FLAGS( 94 text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */ 95 dynamic PT_DYNAMIC FLAGS( 95 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ 96 note PT_NOTE FLAGS( 96 note PT_NOTE FLAGS(4); /* PF_R */ 97 eh_frame_hdr PT_GNU_EH_FRAME; 97 eh_frame_hdr PT_GNU_EH_FRAME; 98 } 98 }
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.