blob: d32b0855110ae96e358547c9f0c835ae7000f0c2 [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>
Isaku Yamahatae4ff5b82009-03-04 21:05:42 +090010#include "paravirt_patchlist.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
12SECTIONS
13{
Roland McGrath1a43be72007-10-15 20:40:29 -070014 . = GATE_ADDR + SIZEOF_HEADERS;
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
Roland McGrath1a43be72007-10-15 20:40:29 -070016 .hash : { *(.hash) } :readable
17 .gnu.hash : { *(.gnu.hash) }
18 .dynsym : { *(.dynsym) }
19 .dynstr : { *(.dynstr) }
20 .gnu.version : { *(.gnu.version) }
21 .gnu.version_d : { *(.gnu.version_d) }
22 .gnu.version_r : { *(.gnu.version_r) }
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Roland McGrath172c5102007-10-18 15:11:08 -070024 .note : { *(.note*) } :readable :note
25
Roland McGrath1a43be72007-10-15 20:40:29 -070026 .dynamic : { *(.dynamic) } :readable :dynamic
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
Roland McGrath1a43be72007-10-15 20:40:29 -070028 /*
29 * This linker script is used both with -r and with -shared. For
30 * the layouts to match, we need to skip more than enough space for
31 * the dynamic symbol table et al. If this amount is insufficient,
32 * ld -shared will barf. Just increase it here.
33 */
Andrew Morton1f0abae2007-12-05 14:32:13 -080034 . = GATE_ADDR + 0x600;
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
Denys Vlasenkodafb9322010-02-20 01:03:42 +010036 .data..patch : {
Isaku Yamahatae4ff5b82009-03-04 21:05:42 +090037 __paravirt_start_gate_mckinley_e9_patchlist = .;
Denys Vlasenkodafb9322010-02-20 01:03:42 +010038 *(.data..patch.mckinley_e9)
Isaku Yamahatae4ff5b82009-03-04 21:05:42 +090039 __paravirt_end_gate_mckinley_e9_patchlist = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
Isaku Yamahatae4ff5b82009-03-04 21:05:42 +090041 __paravirt_start_gate_vtop_patchlist = .;
Denys Vlasenkodafb9322010-02-20 01:03:42 +010042 *(.data..patch.vtop)
Isaku Yamahatae4ff5b82009-03-04 21:05:42 +090043 __paravirt_end_gate_vtop_patchlist = .;
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
Isaku Yamahatae4ff5b82009-03-04 21:05:42 +090045 __paravirt_start_gate_fsyscall_patchlist = .;
Denys Vlasenkodafb9322010-02-20 01:03:42 +010046 *(.data..patch.fsyscall_table)
Isaku Yamahatae4ff5b82009-03-04 21:05:42 +090047 __paravirt_end_gate_fsyscall_patchlist = .;
Roland McGrath1a43be72007-10-15 20:40:29 -070048
Isaku Yamahatae4ff5b82009-03-04 21:05:42 +090049 __paravirt_start_gate_brl_fsys_bubble_down_patchlist = .;
Denys Vlasenkodafb9322010-02-20 01:03:42 +010050 *(.data..patch.brl_fsys_bubble_down)
Isaku Yamahatae4ff5b82009-03-04 21:05:42 +090051 __paravirt_end_gate_brl_fsys_bubble_down_patchlist = .;
Roland McGrath1a43be72007-10-15 20:40:29 -070052 } :readable
53
54 .IA_64.unwind_info : { *(.IA_64.unwind_info*) }
55 .IA_64.unwind : { *(.IA_64.unwind*) } :readable :unwind
Linus Torvalds1da177e2005-04-16 15:20:36 -070056#ifdef HAVE_BUGGY_SEGREL
Roland McGrath1a43be72007-10-15 20:40:29 -070057 .text (GATE_ADDR + PAGE_SIZE) : { *(.text) *(.text.*) } :readable
Linus Torvalds1da177e2005-04-16 15:20:36 -070058#else
Roland McGrath1a43be72007-10-15 20:40:29 -070059 . = ALIGN(PERCPU_PAGE_SIZE) + (. & (PERCPU_PAGE_SIZE - 1));
60 .text : { *(.text) *(.text.*) } :epc
Linus Torvalds1da177e2005-04-16 15:20:36 -070061#endif
62
Roland McGrath1a43be72007-10-15 20:40:29 -070063 /DISCARD/ : {
64 *(.got.plt) *(.got)
65 *(.data .data.* .gnu.linkonce.d.*)
66 *(.dynbss)
67 *(.bss .bss.* .gnu.linkonce.b.*)
68 *(__ex_table)
69 *(__mca_table)
70 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070071}
72
73/*
Roland McGrath1a43be72007-10-15 20:40:29 -070074 * ld does not recognize this name token; use the constant.
75 */
76#define PT_IA_64_UNWIND 0x70000001
77
78/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 * We must supply the ELF program headers explicitly to get just one
80 * PT_LOAD segment, and set the flags explicitly to make segments read-only.
81 */
82PHDRS
83{
Roland McGrath1a43be72007-10-15 20:40:29 -070084 readable PT_LOAD FILEHDR PHDRS FLAGS(4); /* PF_R */
Linus Torvalds1da177e2005-04-16 15:20:36 -070085#ifndef HAVE_BUGGY_SEGREL
Roland McGrath1a43be72007-10-15 20:40:29 -070086 epc PT_LOAD FILEHDR PHDRS FLAGS(1); /* PF_X */
Linus Torvalds1da177e2005-04-16 15:20:36 -070087#endif
Roland McGrath1a43be72007-10-15 20:40:29 -070088 dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
Roland McGrath172c5102007-10-18 15:11:08 -070089 note PT_NOTE FLAGS(4); /* PF_R */
Roland McGrath1a43be72007-10-15 20:40:29 -070090 unwind PT_IA_64_UNWIND;
Linus Torvalds1da177e2005-04-16 15:20:36 -070091}
92
93/*
94 * This controls what symbols we export from the DSO.
95 */
96VERSION
97{
Roland McGrath1a43be72007-10-15 20:40:29 -070098 LINUX_2.5 {
99 global:
100 __kernel_syscall_via_break;
101 __kernel_syscall_via_epc;
102 __kernel_sigtramp;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103
Roland McGrath1a43be72007-10-15 20:40:29 -0700104 local: *;
105 };
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106}
107
108/* The ELF entry point can be used to set the AT_SYSINFO value. */
109ENTRY(__kernel_syscall_via_epc)