Andy Lutomirski | 18d0a6f | 2014-05-05 12:19:35 -0700 | [diff] [blame] | 1 | #include <asm/vdso.h> |
| 2 | |
Roland McGrath | f6b46eb | 2008-01-30 13:30:41 +0100 | [diff] [blame] | 3 | /* |
| 4 | * Linker script for vDSO. This is an ELF shared object prelinked to |
| 5 | * its virtual address, and with only one read-only segment. |
| 6 | * This script controls its layout. |
| 7 | */ |
| 8 | |
| 9 | SECTIONS |
| 10 | { |
Andy Lutomirski | b0b49f2 | 2014-03-13 16:01:26 -0700 | [diff] [blame] | 11 | . = SIZEOF_HEADERS; |
Roland McGrath | f6b46eb | 2008-01-30 13:30:41 +0100 | [diff] [blame] | 12 | |
| 13 | .hash : { *(.hash) } :text |
| 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 | |
| 21 | .note : { *(.note.*) } :text :note |
| 22 | |
| 23 | .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr |
| 24 | .eh_frame : { KEEP (*(.eh_frame)) } :text |
| 25 | |
| 26 | .dynamic : { *(.dynamic) } :text :dynamic |
| 27 | |
| 28 | .rodata : { *(.rodata*) } :text |
| 29 | .data : { |
| 30 | *(.data*) |
| 31 | *(.sdata*) |
| 32 | *(.got.plt) *(.got) |
| 33 | *(.gnu.linkonce.d.*) |
| 34 | *(.bss*) |
| 35 | *(.dynbss*) |
| 36 | *(.gnu.linkonce.b.*) |
| 37 | } |
| 38 | |
| 39 | .altinstructions : { *(.altinstructions) } |
| 40 | .altinstr_replacement : { *(.altinstr_replacement) } |
| 41 | |
| 42 | /* |
| 43 | * Align the actual code well away from the non-instruction data. |
| 44 | * This is the best thing for the I-cache. |
| 45 | */ |
| 46 | . = ALIGN(0x100); |
| 47 | |
Andy Lutomirski | 378ed3c | 2014-04-03 10:53:43 -0700 | [diff] [blame] | 48 | .text : { *(.text*) } :text =0x90909090, |
| 49 | |
| 50 | /* |
Andy Lutomirski | 18d0a6f | 2014-05-05 12:19:35 -0700 | [diff] [blame] | 51 | * The remainder of the vDSO consists of special pages that are |
| 52 | * shared between the kernel and userspace. It needs to be at the |
| 53 | * end so that it doesn't overlap the mapping of the actual |
| 54 | * vDSO image. |
Andy Lutomirski | 378ed3c | 2014-04-03 10:53:43 -0700 | [diff] [blame] | 55 | */ |
H. Peter Anvin | 26f5ef2 | 2014-03-25 13:41:36 -0700 | [diff] [blame] | 56 | |
Andy Lutomirski | 18d0a6f | 2014-05-05 12:19:35 -0700 | [diff] [blame] | 57 | . = ALIGN(PAGE_SIZE); |
| 58 | vvar_page = .; |
| 59 | |
| 60 | /* Place all vvars at the offsets in asm/vvar.h. */ |
| 61 | #define EMIT_VVAR(name, offset) vvar_ ## name = vvar_page + offset; |
| 62 | #define __VVAR_KERNEL_LDS |
| 63 | #include <asm/vvar.h> |
| 64 | #undef __VVAR_KERNEL_LDS |
| 65 | #undef EMIT_VVAR |
| 66 | |
| 67 | . = vvar_page + PAGE_SIZE; |
| 68 | |
| 69 | hpet_page = .; |
| 70 | . = . + PAGE_SIZE; |
Andy Lutomirski | 18d0a6f | 2014-05-05 12:19:35 -0700 | [diff] [blame] | 71 | |
| 72 | . = ALIGN(PAGE_SIZE); |
| 73 | end_mapping = .; |
| 74 | |
H. Peter Anvin | 26f5ef2 | 2014-03-25 13:41:36 -0700 | [diff] [blame] | 75 | /DISCARD/ : { |
| 76 | *(.discard) |
| 77 | *(.discard.*) |
| 78 | } |
Roland McGrath | f6b46eb | 2008-01-30 13:30:41 +0100 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | /* |
| 82 | * Very old versions of ld do not recognize this name token; use the constant. |
| 83 | */ |
| 84 | #define PT_GNU_EH_FRAME 0x6474e550 |
| 85 | |
| 86 | /* |
| 87 | * We must supply the ELF program headers explicitly to get just one |
| 88 | * PT_LOAD segment, and set the flags explicitly to make segments read-only. |
| 89 | */ |
| 90 | PHDRS |
| 91 | { |
| 92 | text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */ |
| 93 | dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ |
| 94 | note PT_NOTE FLAGS(4); /* PF_R */ |
| 95 | eh_frame_hdr PT_GNU_EH_FRAME; |
Roland McGrath | f6b46eb | 2008-01-30 13:30:41 +0100 | [diff] [blame] | 96 | } |