Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 2 | * 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | */ |
| 7 | |
David Howells | c140d87 | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 8 | #include <asm/page.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
| 10 | SECTIONS |
| 11 | { |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 12 | . = GATE_ADDR + SIZEOF_HEADERS; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 14 | .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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | |
Roland McGrath | 172c510 | 2007-10-18 15:11:08 -0700 | [diff] [blame] | 22 | .note : { *(.note*) } :readable :note |
| 23 | |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 24 | .dynamic : { *(.dynamic) } :readable :dynamic |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 26 | /* |
| 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 Morton | 1f0abae | 2007-12-05 14:32:13 -0800 | [diff] [blame] | 32 | . = GATE_ADDR + 0x600; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | |
Denys Vlasenko | dafb932 | 2010-02-20 01:03:42 +0100 | [diff] [blame] | 34 | .data..patch : { |
Luis R. Rodriguez | e55645e | 2015-06-02 11:42:02 -0700 | [diff] [blame] | 35 | __start_gate_mckinley_e9_patchlist = .; |
Denys Vlasenko | dafb932 | 2010-02-20 01:03:42 +0100 | [diff] [blame] | 36 | *(.data..patch.mckinley_e9) |
Luis R. Rodriguez | e55645e | 2015-06-02 11:42:02 -0700 | [diff] [blame] | 37 | __end_gate_mckinley_e9_patchlist = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
Luis R. Rodriguez | e55645e | 2015-06-02 11:42:02 -0700 | [diff] [blame] | 39 | __start_gate_vtop_patchlist = .; |
Denys Vlasenko | dafb932 | 2010-02-20 01:03:42 +0100 | [diff] [blame] | 40 | *(.data..patch.vtop) |
Luis R. Rodriguez | e55645e | 2015-06-02 11:42:02 -0700 | [diff] [blame] | 41 | __end_gate_vtop_patchlist = .; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | |
Luis R. Rodriguez | e55645e | 2015-06-02 11:42:02 -0700 | [diff] [blame] | 43 | __start_gate_fsyscall_patchlist = .; |
Denys Vlasenko | dafb932 | 2010-02-20 01:03:42 +0100 | [diff] [blame] | 44 | *(.data..patch.fsyscall_table) |
Luis R. Rodriguez | e55645e | 2015-06-02 11:42:02 -0700 | [diff] [blame] | 45 | __end_gate_fsyscall_patchlist = .; |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 46 | |
Luis R. Rodriguez | e55645e | 2015-06-02 11:42:02 -0700 | [diff] [blame] | 47 | __start_gate_brl_fsys_bubble_down_patchlist = .; |
Denys Vlasenko | dafb932 | 2010-02-20 01:03:42 +0100 | [diff] [blame] | 48 | *(.data..patch.brl_fsys_bubble_down) |
Luis R. Rodriguez | e55645e | 2015-06-02 11:42:02 -0700 | [diff] [blame] | 49 | __end_gate_brl_fsys_bubble_down_patchlist = .; |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 50 | } :readable |
| 51 | |
| 52 | .IA_64.unwind_info : { *(.IA_64.unwind_info*) } |
| 53 | .IA_64.unwind : { *(.IA_64.unwind*) } :readable :unwind |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | #ifdef HAVE_BUGGY_SEGREL |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 55 | .text (GATE_ADDR + PAGE_SIZE) : { *(.text) *(.text.*) } :readable |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | #else |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 57 | . = ALIGN(PERCPU_PAGE_SIZE) + (. & (PERCPU_PAGE_SIZE - 1)); |
| 58 | .text : { *(.text) *(.text.*) } :epc |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | #endif |
| 60 | |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 61 | /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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | /* |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 72 | * ld does not recognize this name token; use the constant. |
| 73 | */ |
| 74 | #define PT_IA_64_UNWIND 0x70000001 |
| 75 | |
| 76 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | * 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 | */ |
| 80 | PHDRS |
| 81 | { |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 82 | readable PT_LOAD FILEHDR PHDRS FLAGS(4); /* PF_R */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | #ifndef HAVE_BUGGY_SEGREL |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 84 | epc PT_LOAD FILEHDR PHDRS FLAGS(1); /* PF_X */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | #endif |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 86 | dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ |
Roland McGrath | 172c510 | 2007-10-18 15:11:08 -0700 | [diff] [blame] | 87 | note PT_NOTE FLAGS(4); /* PF_R */ |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 88 | unwind PT_IA_64_UNWIND; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | /* |
| 92 | * This controls what symbols we export from the DSO. |
| 93 | */ |
| 94 | VERSION |
| 95 | { |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 96 | LINUX_2.5 { |
| 97 | global: |
| 98 | __kernel_syscall_via_break; |
| 99 | __kernel_syscall_via_epc; |
| 100 | __kernel_sigtramp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | |
Roland McGrath | 1a43be7 | 2007-10-15 20:40:29 -0700 | [diff] [blame] | 102 | local: *; |
| 103 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | /* The ELF entry point can be used to set the AT_SYSINFO value. */ |
| 107 | ENTRY(__kernel_syscall_via_epc) |