[PATCH] x86/x86_64: mark rodata section read only: generic infrastructure
[linux-2.6.git] / include / asm-generic / vmlinux.lds.h
1 #ifndef LOAD_OFFSET
2 #define LOAD_OFFSET 0
3 #endif
4
5 #ifndef VMLINUX_SYMBOL
6 #define VMLINUX_SYMBOL(_sym_) _sym_
7 #endif
8
9 /* Align . to a 8 byte boundary equals to maximum function alignment. */
10 #define ALIGN_FUNCTION()  . = ALIGN(8)
11
12 #define RODATA                                                          \
13         . = ALIGN(4096);                                                \
14         __start_rodata = .;                                             \
15         .rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {           \
16                 *(.rodata) *(.rodata.*)                                 \
17                 *(__vermagic)           /* Kernel version magic */      \
18         }                                                               \
19                                                                         \
20         .rodata1          : AT(ADDR(.rodata1) - LOAD_OFFSET) {          \
21                 *(.rodata1)                                             \
22         }                                                               \
23                                                                         \
24         /* PCI quirks */                                                \
25         .pci_fixup        : AT(ADDR(.pci_fixup) - LOAD_OFFSET) {        \
26                 VMLINUX_SYMBOL(__start_pci_fixups_early) = .;           \
27                 *(.pci_fixup_early)                                     \
28                 VMLINUX_SYMBOL(__end_pci_fixups_early) = .;             \
29                 VMLINUX_SYMBOL(__start_pci_fixups_header) = .;          \
30                 *(.pci_fixup_header)                                    \
31                 VMLINUX_SYMBOL(__end_pci_fixups_header) = .;            \
32                 VMLINUX_SYMBOL(__start_pci_fixups_final) = .;           \
33                 *(.pci_fixup_final)                                     \
34                 VMLINUX_SYMBOL(__end_pci_fixups_final) = .;             \
35                 VMLINUX_SYMBOL(__start_pci_fixups_enable) = .;          \
36                 *(.pci_fixup_enable)                                    \
37                 VMLINUX_SYMBOL(__end_pci_fixups_enable) = .;            \
38         }                                                               \
39                                                                         \
40         /* RapidIO route ops */                                         \
41         .rio_route        : AT(ADDR(.rio_route) - LOAD_OFFSET) {        \
42                 VMLINUX_SYMBOL(__start_rio_route_ops) = .;              \
43                 *(.rio_route_ops)                                       \
44                 VMLINUX_SYMBOL(__end_rio_route_ops) = .;                \
45         }                                                               \
46                                                                         \
47         /* Kernel symbol table: Normal symbols */                       \
48         __ksymtab         : AT(ADDR(__ksymtab) - LOAD_OFFSET) {         \
49                 VMLINUX_SYMBOL(__start___ksymtab) = .;                  \
50                 *(__ksymtab)                                            \
51                 VMLINUX_SYMBOL(__stop___ksymtab) = .;                   \
52         }                                                               \
53                                                                         \
54         /* Kernel symbol table: GPL-only symbols */                     \
55         __ksymtab_gpl     : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) {     \
56                 VMLINUX_SYMBOL(__start___ksymtab_gpl) = .;              \
57                 *(__ksymtab_gpl)                                        \
58                 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .;               \
59         }                                                               \
60                                                                         \
61         /* Kernel symbol table: Normal symbols */                       \
62         __kcrctab         : AT(ADDR(__kcrctab) - LOAD_OFFSET) {         \
63                 VMLINUX_SYMBOL(__start___kcrctab) = .;                  \
64                 *(__kcrctab)                                            \
65                 VMLINUX_SYMBOL(__stop___kcrctab) = .;                   \
66         }                                                               \
67                                                                         \
68         /* Kernel symbol table: GPL-only symbols */                     \
69         __kcrctab_gpl     : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) {     \
70                 VMLINUX_SYMBOL(__start___kcrctab_gpl) = .;              \
71                 *(__kcrctab_gpl)                                        \
72                 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .;               \
73         }                                                               \
74                                                                         \
75         /* Kernel symbol table: strings */                              \
76         __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
77                 *(__ksymtab_strings)                                    \
78         }                                                               \
79         __end_rodata = .;                                               \
80         . = ALIGN(4096);                                                \
81                                                                         \
82         /* Built-in module parameters. */                               \
83         __param : AT(ADDR(__param) - LOAD_OFFSET) {                     \
84                 VMLINUX_SYMBOL(__start___param) = .;                    \
85                 *(__param)                                              \
86                 VMLINUX_SYMBOL(__stop___param) = .;                     \
87         }
88
89 #define SECURITY_INIT                                                   \
90         .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
91                 VMLINUX_SYMBOL(__security_initcall_start) = .;          \
92                 *(.security_initcall.init)                              \
93                 VMLINUX_SYMBOL(__security_initcall_end) = .;            \
94         }
95
96 /* sched.text is aling to function alignment to secure we have same
97  * address even at second ld pass when generating System.map */
98 #define SCHED_TEXT                                                      \
99                 ALIGN_FUNCTION();                                       \
100                 VMLINUX_SYMBOL(__sched_text_start) = .;                 \
101                 *(.sched.text)                                          \
102                 VMLINUX_SYMBOL(__sched_text_end) = .;
103
104 /* spinlock.text is aling to function alignment to secure we have same
105  * address even at second ld pass when generating System.map */
106 #define LOCK_TEXT                                                       \
107                 ALIGN_FUNCTION();                                       \
108                 VMLINUX_SYMBOL(__lock_text_start) = .;                  \
109                 *(.spinlock.text)                                       \
110                 VMLINUX_SYMBOL(__lock_text_end) = .;
111
112 #define KPROBES_TEXT                                                    \
113                 ALIGN_FUNCTION();                                       \
114                 VMLINUX_SYMBOL(__kprobes_text_start) = .;               \
115                 *(.kprobes.text)                                        \
116                 VMLINUX_SYMBOL(__kprobes_text_end) = .;
117
118                 /* DWARF debug sections.
119                 Symbols in the DWARF debugging sections are relative to
120                 the beginning of the section so we begin them at 0.  */
121 #define DWARF_DEBUG                                                     \
122                 /* DWARF 1 */                                           \
123                 .debug          0 : { *(.debug) }                       \
124                 .line           0 : { *(.line) }                        \
125                 /* GNU DWARF 1 extensions */                            \
126                 .debug_srcinfo  0 : { *(.debug_srcinfo) }               \
127                 .debug_sfnames  0 : { *(.debug_sfnames) }               \
128                 /* DWARF 1.1 and DWARF 2 */                             \
129                 .debug_aranges  0 : { *(.debug_aranges) }               \
130                 .debug_pubnames 0 : { *(.debug_pubnames) }              \
131                 /* DWARF 2 */                                           \
132                 .debug_info     0 : { *(.debug_info                     \
133                                 .gnu.linkonce.wi.*) }                   \
134                 .debug_abbrev   0 : { *(.debug_abbrev) }                \
135                 .debug_line     0 : { *(.debug_line) }                  \
136                 .debug_frame    0 : { *(.debug_frame) }                 \
137                 .debug_str      0 : { *(.debug_str) }                   \
138                 .debug_loc      0 : { *(.debug_loc) }                   \
139                 .debug_macinfo  0 : { *(.debug_macinfo) }               \
140                 /* SGI/MIPS DWARF 2 extensions */                       \
141                 .debug_weaknames 0 : { *(.debug_weaknames) }            \
142                 .debug_funcnames 0 : { *(.debug_funcnames) }            \
143                 .debug_typenames 0 : { *(.debug_typenames) }            \
144                 .debug_varnames  0 : { *(.debug_varnames) }             \
145
146                 /* Stabs debugging sections.  */
147 #define STABS_DEBUG                                                     \
148                 .stab 0 : { *(.stab) }                                  \
149                 .stabstr 0 : { *(.stabstr) }                            \
150                 .stab.excl 0 : { *(.stab.excl) }                        \
151                 .stab.exclstr 0 : { *(.stab.exclstr) }                  \
152                 .stab.index 0 : { *(.stab.index) }                      \
153                 .stab.indexstr 0 : { *(.stab.indexstr) }                \
154                 .comment 0 : { *(.comment) }