blob: 44817d97ab43c91b7921ca83064d447da79034ad [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Roland McGrath1a43be72007-10-15 20:40:29 -07002 * Linker script for gate DSO. The gate pages are an ELF shared object
3 * prelinked to its virtual address, with only one read-only segment and
4 * one execute-only segment (both fit in one page). This script controls
5 * its layout.
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 */
7
Linus Torvalds1da177e2005-04-16 15:20:36 -07008
9#include <asm/system.h>
10
11SECTIONS
12{
Roland McGrath1a43be72007-10-15 20:40:29 -070013 . = GATE_ADDR + SIZEOF_HEADERS;
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
Roland McGrath1a43be72007-10-15 20:40:29 -070015 .hash : { *(.hash) } :readable
16 .gnu.hash : { *(.gnu.hash) }
17 .dynsym : { *(.dynsym) }
18 .dynstr : { *(.dynstr) }
19 .gnu.version : { *(.gnu.version) }
20 .gnu.version_d : { *(.gnu.version_d) }
21 .gnu.version_r : { *(.gnu.version_r) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
Roland McGrath1a43be72007-10-15 20:40:29 -070023 .dynamic : { *(.dynamic) } :readable :dynamic
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
Roland McGrath1a43be72007-10-15 20:40:29 -070025 /*
26 * This linker script is used both with -r and with -shared. For
27 * the layouts to match, we need to skip more than enough space for
28 * the dynamic symbol table et al. If this amount is insufficient,
29 * ld -shared will barf. Just increase it here.
30 */
31 . = GATE_ADDR + 0x500;
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
Roland McGrath1a43be72007-10-15 20:40:29 -070033 .data.patch : {
34 __start_gate_mckinley_e9_patchlist = .;
35 *(.data.patch.mckinley_e9)
36 __end_gate_mckinley_e9_patchlist = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
Roland McGrath1a43be72007-10-15 20:40:29 -070038 __start_gate_vtop_patchlist = .;
39 *(.data.patch.vtop)
40 __end_gate_vtop_patchlist = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
Roland McGrath1a43be72007-10-15 20:40:29 -070042 __start_gate_fsyscall_patchlist = .;
43 *(.data.patch.fsyscall_table)
44 __end_gate_fsyscall_patchlist = .;
45
46 __start_gate_brl_fsys_bubble_down_patchlist = .;
47 *(.data.patch.brl_fsys_bubble_down)
48 __end_gate_brl_fsys_bubble_down_patchlist = .;
49 } :readable
50
51 .IA_64.unwind_info : { *(.IA_64.unwind_info*) }
52 .IA_64.unwind : { *(.IA_64.unwind*) } :readable :unwind
Linus Torvalds1da177e2005-04-16 15:20:36 -070053#ifdef HAVE_BUGGY_SEGREL
Roland McGrath1a43be72007-10-15 20:40:29 -070054 .text (GATE_ADDR + PAGE_SIZE) : { *(.text) *(.text.*) } :readable
Linus Torvalds1da177e2005-04-16 15:20:36 -070055#else
Roland McGrath1a43be72007-10-15 20:40:29 -070056 . = ALIGN(PERCPU_PAGE_SIZE) + (. & (PERCPU_PAGE_SIZE - 1));
57 .text : { *(.text) *(.text.*) } :epc
Linus Torvalds1da177e2005-04-16 15:20:36 -070058#endif
59
Roland McGrath1a43be72007-10-15 20:40:29 -070060 /DISCARD/ : {
61 *(.got.plt) *(.got)
62 *(.data .data.* .gnu.linkonce.d.*)
63 *(.dynbss)
64 *(.bss .bss.* .gnu.linkonce.b.*)
65 *(__ex_table)
66 *(__mca_table)
67 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070068}
69
70/*
Roland McGrath1a43be72007-10-15 20:40:29 -070071 * ld does not recognize this name token; use the constant.
72 */
73#define PT_IA_64_UNWIND 0x70000001
74
75/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 * We must supply the ELF program headers explicitly to get just one
77 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
78 */
79PHDRS
80{
Roland McGrath1a43be72007-10-15 20:40:29 -070081 readable PT_LOAD FILEHDR PHDRS FLAGS(4); /* PF_R */
Linus Torvalds1da177e2005-04-16 15:20:36 -070082#ifndef HAVE_BUGGY_SEGREL
Roland McGrath1a43be72007-10-15 20:40:29 -070083 epc PT_LOAD FILEHDR PHDRS FLAGS(1); /* PF_X */
Linus Torvalds1da177e2005-04-16 15:20:36 -070084#endif
Roland McGrath1a43be72007-10-15 20:40:29 -070085 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
86 unwind PT_IA_64_UNWIND;
Linus Torvalds1da177e2005-04-16 15:20:36 -070087}
88
89/*
90 * This controls what symbols we export from the DSO.
91 */
92VERSION
93{
Roland McGrath1a43be72007-10-15 20:40:29 -070094 LINUX_2.5 {
95 global:
96 __kernel_syscall_via_break;
97 __kernel_syscall_via_epc;
98 __kernel_sigtramp;
Linus Torvalds1da177e2005-04-16 15:20:36 -070099
Roland McGrath1a43be72007-10-15 20:40:29 -0700100 local: *;
101 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102}
103
104/* The ELF entry point can be used to set the AT_SYSINFO value. */
105ENTRY(__kernel_syscall_via_epc)