blob: 2ec72f651ebffa887ae037aebf556869fa5c6968 [file] [log] [blame]
Andy Lutomirski18d0a6f2014-05-05 12:19:35 -07001#include <asm/vdso.h>
2
Roland McGrathf6b46eb2008-01-30 13:30:41 +01003/*
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
9SECTIONS
10{
Andy Lutomirskib0b49f22014-03-13 16:01:26 -070011 . = SIZEOF_HEADERS;
Roland McGrathf6b46eb2008-01-30 13:30:41 +010012
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 Lutomirski378ed3c2014-04-03 10:53:43 -070048 .text : { *(.text*) } :text =0x90909090,
49
50 /*
Andy Lutomirski18d0a6f2014-05-05 12:19:35 -070051 * 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 Lutomirski378ed3c2014-04-03 10:53:43 -070055 */
H. Peter Anvin26f5ef22014-03-25 13:41:36 -070056
Andy Lutomirski18d0a6f2014-05-05 12:19:35 -070057 . = 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 Lutomirski18d0a6f2014-05-05 12:19:35 -070071
72 . = ALIGN(PAGE_SIZE);
73 end_mapping = .;
74
H. Peter Anvin26f5ef22014-03-25 13:41:36 -070075 /DISCARD/ : {
76 *(.discard)
77 *(.discard.*)
78 }
Roland McGrathf6b46eb2008-01-30 13:30:41 +010079}
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 */
90PHDRS
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 McGrathf6b46eb2008-01-30 13:30:41 +010096}