blob: 3e8271e85a1e11d3755fa369a8d6ff364942dc12 [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
David Howellsc140d872012-03-28 18:30:02 +01008#include <asm/page.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009
10SECTIONS
11{
Roland McGrath1a43be72007-10-15 20:40:29 -070012 . = GATE_ADDR + SIZEOF_HEADERS;
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
Roland McGrath1a43be72007-10-15 20:40:29 -070014 .hash : { *(.hash) } :readable
15 .gnu.hash : { *(.gnu.hash) }
16 .dynsym : { *(.dynsym) }
17 .dynstr : { *(.dynstr) }
18 .gnu.version : { *(.gnu.version) }
19 .gnu.version_d : { *(.gnu.version_d) }
20 .gnu.version_r : { *(.gnu.version_r) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
Roland McGrath172c5102007-10-18 15:11:08 -070022 .note : { *(.note*) } :readable :note
23
Roland McGrath1a43be72007-10-15 20:40:29 -070024 .dynamic : { *(.dynamic) } :readable :dynamic
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
Roland McGrath1a43be72007-10-15 20:40:29 -070026 /*
27 * This linker script is used both with -r and with -shared. For
28 * the layouts to match, we need to skip more than enough space for
29 * the dynamic symbol table et al. If this amount is insufficient,
30 * ld -shared will barf. Just increase it here.
31 */
Andrew Morton1f0abae2007-12-05 14:32:13 -080032 . = GATE_ADDR + 0x600;
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Denys Vlasenkodafb9322010-02-20 01:03:42 +010034 .data..patch : {
Luis R. Rodrigueze55645e2015-06-02 11:42:02 -070035 __start_gate_mckinley_e9_patchlist = .;
Denys Vlasenkodafb9322010-02-20 01:03:42 +010036 *(.data..patch.mckinley_e9)
Luis R. Rodrigueze55645e2015-06-02 11:42:02 -070037 __end_gate_mckinley_e9_patchlist = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
Luis R. Rodrigueze55645e2015-06-02 11:42:02 -070039 __start_gate_vtop_patchlist = .;
Denys Vlasenkodafb9322010-02-20 01:03:42 +010040 *(.data..patch.vtop)
Luis R. Rodrigueze55645e2015-06-02 11:42:02 -070041 __end_gate_vtop_patchlist = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -070042
Luis R. Rodrigueze55645e2015-06-02 11:42:02 -070043 __start_gate_fsyscall_patchlist = .;
Denys Vlasenkodafb9322010-02-20 01:03:42 +010044 *(.data..patch.fsyscall_table)
Luis R. Rodrigueze55645e2015-06-02 11:42:02 -070045 __end_gate_fsyscall_patchlist = .;
Roland McGrath1a43be72007-10-15 20:40:29 -070046
Luis R. Rodrigueze55645e2015-06-02 11:42:02 -070047 __start_gate_brl_fsys_bubble_down_patchlist = .;
Denys Vlasenkodafb9322010-02-20 01:03:42 +010048 *(.data..patch.brl_fsys_bubble_down)
Luis R. Rodrigueze55645e2015-06-02 11:42:02 -070049 __end_gate_brl_fsys_bubble_down_patchlist = .;
Roland McGrath1a43be72007-10-15 20:40:29 -070050 } :readable
51
52 .IA_64.unwind_info : { *(.IA_64.unwind_info*) }
53 .IA_64.unwind : { *(.IA_64.unwind*) } :readable :unwind
Linus Torvalds1da177e2005-04-16 15:20:36 -070054#ifdef HAVE_BUGGY_SEGREL
Roland McGrath1a43be72007-10-15 20:40:29 -070055 .text (GATE_ADDR + PAGE_SIZE) : { *(.text) *(.text.*) } :readable
Linus Torvalds1da177e2005-04-16 15:20:36 -070056#else
Roland McGrath1a43be72007-10-15 20:40:29 -070057 . = ALIGN(PERCPU_PAGE_SIZE) + (. & (PERCPU_PAGE_SIZE - 1));
58 .text : { *(.text) *(.text.*) } :epc
Linus Torvalds1da177e2005-04-16 15:20:36 -070059#endif
60
Roland McGrath1a43be72007-10-15 20:40:29 -070061 /DISCARD/ : {
62 *(.got.plt) *(.got)
63 *(.data .data.* .gnu.linkonce.d.*)
64 *(.dynbss)
65 *(.bss .bss.* .gnu.linkonce.b.*)
66 *(__ex_table)
67 *(__mca_table)
68 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070069}
70
71/*
Roland McGrath1a43be72007-10-15 20:40:29 -070072 * ld does not recognize this name token; use the constant.
73 */
74#define PT_IA_64_UNWIND 0x70000001
75
76/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 * We must supply the ELF program headers explicitly to get just one
78 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
79 */
80PHDRS
81{
Roland McGrath1a43be72007-10-15 20:40:29 -070082 readable PT_LOAD FILEHDR PHDRS FLAGS(4); /* PF_R */
Linus Torvalds1da177e2005-04-16 15:20:36 -070083#ifndef HAVE_BUGGY_SEGREL
Roland McGrath1a43be72007-10-15 20:40:29 -070084 epc PT_LOAD FILEHDR PHDRS FLAGS(1); /* PF_X */
Linus Torvalds1da177e2005-04-16 15:20:36 -070085#endif
Roland McGrath1a43be72007-10-15 20:40:29 -070086 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
Roland McGrath172c5102007-10-18 15:11:08 -070087 note PT_NOTE FLAGS(4); /* PF_R */
Roland McGrath1a43be72007-10-15 20:40:29 -070088 unwind PT_IA_64_UNWIND;
Linus Torvalds1da177e2005-04-16 15:20:36 -070089}
90
91/*
92 * This controls what symbols we export from the DSO.
93 */
94VERSION
95{
Roland McGrath1a43be72007-10-15 20:40:29 -070096 LINUX_2.5 {
97 global:
98 __kernel_syscall_via_break;
99 __kernel_syscall_via_epc;
100 __kernel_sigtramp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101
Roland McGrath1a43be72007-10-15 20:40:29 -0700102 local: *;
103 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104}
105
106/* The ELF entry point can be used to set the AT_SYSINFO value. */
107ENTRY(__kernel_syscall_via_epc)