Andi Kleen | 2aae950 | 2007-07-21 17:10:01 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Linker script for vsyscall DSO. The vsyscall page is an ELF shared |
| 3 | * object prelinked to its virtual address, and with only one read-only |
| 4 | * segment (that fits in one page). This script controls its layout. |
| 5 | */ |
| 6 | #include <asm/asm-offsets.h> |
| 7 | #include "voffset.h" |
| 8 | |
| 9 | #define VDSO_PRELINK 0xffffffffff700000 |
| 10 | |
Roland McGrath | 5b93049 | 2008-01-30 13:30:40 +0100 | [diff] [blame^] | 11 | /* |
| 12 | * Symbols we define here called VDSO* get their values into vdso-syms.lds |
| 13 | * and become visible to the kernel itself. |
| 14 | */ |
| 15 | VDSO64_PRELINK = VDSO_PRELINK; |
| 16 | |
| 17 | #define VEXTERN(x) VDSO64_ ## x = vdso_ ## x; |
| 18 | #include "vextern.h" |
| 19 | #undef VEXTERN |
| 20 | |
Andi Kleen | 2aae950 | 2007-07-21 17:10:01 +0200 | [diff] [blame] | 21 | SECTIONS |
| 22 | { |
| 23 | . = VDSO_PRELINK + SIZEOF_HEADERS; |
| 24 | |
| 25 | .hash : { *(.hash) } :text |
| 26 | .gnu.hash : { *(.gnu.hash) } |
| 27 | .dynsym : { *(.dynsym) } |
| 28 | .dynstr : { *(.dynstr) } |
| 29 | .gnu.version : { *(.gnu.version) } |
| 30 | .gnu.version_d : { *(.gnu.version_d) } |
| 31 | .gnu.version_r : { *(.gnu.version_r) } |
| 32 | |
| 33 | /* This linker script is used both with -r and with -shared. |
| 34 | For the layouts to match, we need to skip more than enough |
| 35 | space for the dynamic symbol table et al. If this amount |
| 36 | is insufficient, ld -shared will barf. Just increase it here. */ |
| 37 | . = VDSO_PRELINK + VDSO_TEXT_OFFSET; |
| 38 | |
Roland McGrath | c65916f | 2007-10-17 18:04:41 +0200 | [diff] [blame] | 39 | .text : { *(.text*) } :text |
| 40 | .rodata : { *(.rodata*) } :text |
| 41 | .data : { |
| 42 | *(.data*) |
| 43 | *(.sdata*) |
| 44 | *(.bss*) |
| 45 | *(.dynbss*) |
| 46 | } :text |
Andi Kleen | 2aae950 | 2007-07-21 17:10:01 +0200 | [diff] [blame] | 47 | |
Roland McGrath | c65916f | 2007-10-17 18:04:41 +0200 | [diff] [blame] | 48 | .altinstructions : { *(.altinstructions) } :text |
Andi Kleen | 2aae950 | 2007-07-21 17:10:01 +0200 | [diff] [blame] | 49 | .altinstr_replacement : { *(.altinstr_replacement) } :text |
| 50 | |
| 51 | .note : { *(.note.*) } :text :note |
| 52 | .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr |
| 53 | .eh_frame : { KEEP (*(.eh_frame)) } :text |
| 54 | .dynamic : { *(.dynamic) } :text :dynamic |
| 55 | .useless : { |
| 56 | *(.got.plt) *(.got) |
| 57 | *(.gnu.linkonce.d.*) |
Andi Kleen | 2aae950 | 2007-07-21 17:10:01 +0200 | [diff] [blame] | 58 | *(.gnu.linkonce.b.*) |
| 59 | } :text |
| 60 | } |
| 61 | |
| 62 | /* |
| 63 | * We must supply the ELF program headers explicitly to get just one |
| 64 | * PT_LOAD segment, and set the flags explicitly to make segments read-only. |
| 65 | */ |
| 66 | PHDRS |
| 67 | { |
| 68 | text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */ |
| 69 | dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ |
| 70 | note PT_NOTE FLAGS(4); /* PF_R */ |
| 71 | eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */ |
| 72 | } |
| 73 | |
| 74 | /* |
| 75 | * This controls what symbols we export from the DSO. |
| 76 | */ |
| 77 | VERSION |
| 78 | { |
| 79 | LINUX_2.6 { |
| 80 | global: |
| 81 | clock_gettime; |
| 82 | __vdso_clock_gettime; |
| 83 | gettimeofday; |
| 84 | __vdso_gettimeofday; |
| 85 | getcpu; |
| 86 | __vdso_getcpu; |
| 87 | local: *; |
| 88 | }; |
| 89 | } |