diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-14 17:12:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-14 17:12:18 -0400 |
commit | 45e3e1935e2857c54783291107d33323b3ef33c8 (patch) | |
tree | 26a6e3228b52d0f96f6e56e5879ca898fe909592 /include | |
parent | cf5046323ea254be72535648a9d090b18b8510f3 (diff) | |
parent | 3f8d9ced7746f3f329ccca0bb3f3c7a2c15c47bb (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next: (53 commits)
.gitignore: ignore *.lzma files
kbuild: add generic --set-str option to scripts/config
kbuild: simplify argument loop in scripts/config
kbuild: handle non-existing options in scripts/config
kallsyms: generalize text region handling
kallsyms: support kernel symbols in Blackfin on-chip memory
documentation: make version fix
kbuild: fix a compile warning
gitignore: Add GNU GLOBAL files to top .gitignore
kbuild: fix delay in setlocalversion on readonly source
README: fix misleading pointer to the defconf directory
vmlinux.lds.h update
kernel-doc: cleanup perl script
Improve vmlinux.lds.h support for arch specific linker scripts
kbuild: fix headers_exports with boolean expression
kbuild/headers_check: refine extern check
kbuild: fix "Argument list too long" error for "make headers_check",
ignore *.patch files
Remove bashisms from scripts
menu: fix embedded menu presentation
...
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/vmlinux.lds.h | 241 | ||||
-rw-r--r-- | include/linux/init.h | 7 | ||||
-rw-r--r-- | include/linux/section-names.h | 6 |
3 files changed, 234 insertions, 20 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index f1736ca7922c..6bdba10fef4a 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -1,4 +1,57 @@ | |||
1 | #include <linux/section-names.h> | 1 | /* |
2 | * Helper macros to support writing architecture specific | ||
3 | * linker scripts. | ||
4 | * | ||
5 | * A minimal linker scripts has following content: | ||
6 | * [This is a sample, architectures may have special requiriements] | ||
7 | * | ||
8 | * OUTPUT_FORMAT(...) | ||
9 | * OUTPUT_ARCH(...) | ||
10 | * ENTRY(...) | ||
11 | * SECTIONS | ||
12 | * { | ||
13 | * . = START; | ||
14 | * __init_begin = .; | ||
15 | * HEAD_TEXT_SECTION | ||
16 | * INIT_TEXT_SECTION(PAGE_SIZE) | ||
17 | * INIT_DATA_SECTION(...) | ||
18 | * PERCPU(PAGE_SIZE) | ||
19 | * __init_end = .; | ||
20 | * | ||
21 | * _stext = .; | ||
22 | * TEXT_SECTION = 0 | ||
23 | * _etext = .; | ||
24 | * | ||
25 | * _sdata = .; | ||
26 | * RO_DATA_SECTION(PAGE_SIZE) | ||
27 | * RW_DATA_SECTION(...) | ||
28 | * _edata = .; | ||
29 | * | ||
30 | * EXCEPTION_TABLE(...) | ||
31 | * NOTES | ||
32 | * | ||
33 | * __bss_start = .; | ||
34 | * BSS_SECTION(0, 0) | ||
35 | * __bss_stop = .; | ||
36 | * _end = .; | ||
37 | * | ||
38 | * /DISCARD/ : { | ||
39 | * EXIT_TEXT | ||
40 | * EXIT_DATA | ||
41 | * EXIT_CALL | ||
42 | * } | ||
43 | * STABS_DEBUG | ||
44 | * DWARF_DEBUG | ||
45 | * } | ||
46 | * | ||
47 | * [__init_begin, __init_end] is the init section that may be freed after init | ||
48 | * [_stext, _etext] is the text section | ||
49 | * [_sdata, _edata] is the data section | ||
50 | * | ||
51 | * Some of the included output section have their own set of constants. | ||
52 | * Examples are: [__initramfs_start, __initramfs_end] for initramfs and | ||
53 | * [__nosave_begin, __nosave_end] for the nosave data | ||
54 | */ | ||
2 | 55 | ||
3 | #ifndef LOAD_OFFSET | 56 | #ifndef LOAD_OFFSET |
4 | #define LOAD_OFFSET 0 | 57 | #define LOAD_OFFSET 0 |
@@ -116,7 +169,36 @@ | |||
116 | FTRACE_EVENTS() \ | 169 | FTRACE_EVENTS() \ |
117 | TRACE_SYSCALLS() | 170 | TRACE_SYSCALLS() |
118 | 171 | ||
119 | #define RO_DATA(align) \ | 172 | /* |
173 | * Data section helpers | ||
174 | */ | ||
175 | #define NOSAVE_DATA \ | ||
176 | . = ALIGN(PAGE_SIZE); \ | ||
177 | VMLINUX_SYMBOL(__nosave_begin) = .; \ | ||
178 | *(.data.nosave) \ | ||
179 | . = ALIGN(PAGE_SIZE); \ | ||
180 | VMLINUX_SYMBOL(__nosave_end) = .; | ||
181 | |||
182 | #define PAGE_ALIGNED_DATA(page_align) \ | ||
183 | . = ALIGN(page_align); \ | ||
184 | *(.data.page_aligned) | ||
185 | |||
186 | #define READ_MOSTLY_DATA(align) \ | ||
187 | . = ALIGN(align); \ | ||
188 | *(.data.read_mostly) | ||
189 | |||
190 | #define CACHELINE_ALIGNED_DATA(align) \ | ||
191 | . = ALIGN(align); \ | ||
192 | *(.data.cacheline_aligned) | ||
193 | |||
194 | #define INIT_TASK(align) \ | ||
195 | . = ALIGN(align); \ | ||
196 | *(.data.init_task) | ||
197 | |||
198 | /* | ||
199 | * Read only Data | ||
200 | */ | ||
201 | #define RO_DATA_SECTION(align) \ | ||
120 | . = ALIGN((align)); \ | 202 | . = ALIGN((align)); \ |
121 | .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ | 203 | .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ |
122 | VMLINUX_SYMBOL(__start_rodata) = .; \ | 204 | VMLINUX_SYMBOL(__start_rodata) = .; \ |
@@ -270,9 +352,10 @@ | |||
270 | } \ | 352 | } \ |
271 | . = ALIGN((align)); | 353 | . = ALIGN((align)); |
272 | 354 | ||
273 | /* RODATA provided for backward compatibility. | 355 | /* RODATA & RO_DATA provided for backward compatibility. |
274 | * All archs are supposed to use RO_DATA() */ | 356 | * All archs are supposed to use RO_DATA() */ |
275 | #define RODATA RO_DATA(4096) | 357 | #define RODATA RO_DATA_SECTION(4096) |
358 | #define RO_DATA(align) RO_DATA_SECTION(align) | ||
276 | 359 | ||
277 | #define SECURITY_INIT \ | 360 | #define SECURITY_INIT \ |
278 | .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \ | 361 | .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \ |
@@ -330,16 +413,42 @@ | |||
330 | #endif | 413 | #endif |
331 | 414 | ||
332 | /* Section used for early init (in .S files) */ | 415 | /* Section used for early init (in .S files) */ |
333 | #define HEAD_TEXT *(HEAD_TEXT_SECTION) | 416 | #define HEAD_TEXT *(.head.text) |
417 | |||
418 | #define HEAD_TEXT_SECTION \ | ||
419 | .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \ | ||
420 | HEAD_TEXT \ | ||
421 | } | ||
422 | |||
423 | /* | ||
424 | * Exception table | ||
425 | */ | ||
426 | #define EXCEPTION_TABLE(align) \ | ||
427 | . = ALIGN(align); \ | ||
428 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \ | ||
429 | VMLINUX_SYMBOL(__start___ex_table) = .; \ | ||
430 | *(__ex_table) \ | ||
431 | VMLINUX_SYMBOL(__stop___ex_table) = .; \ | ||
432 | } | ||
433 | |||
434 | /* | ||
435 | * Init task | ||
436 | */ | ||
437 | #define INIT_TASK_DATA(align) \ | ||
438 | . = ALIGN(align); \ | ||
439 | .data.init_task : { \ | ||
440 | INIT_TASK \ | ||
441 | } | ||
334 | 442 | ||
335 | /* init and exit section handling */ | 443 | /* init and exit section handling */ |
336 | #define INIT_DATA \ | 444 | #define INIT_DATA \ |
337 | *(.init.data) \ | 445 | *(.init.data) \ |
338 | DEV_DISCARD(init.data) \ | 446 | DEV_DISCARD(init.data) \ |
339 | DEV_DISCARD(init.rodata) \ | ||
340 | CPU_DISCARD(init.data) \ | 447 | CPU_DISCARD(init.data) \ |
341 | CPU_DISCARD(init.rodata) \ | ||
342 | MEM_DISCARD(init.data) \ | 448 | MEM_DISCARD(init.data) \ |
449 | *(.init.rodata) \ | ||
450 | DEV_DISCARD(init.rodata) \ | ||
451 | CPU_DISCARD(init.rodata) \ | ||
343 | MEM_DISCARD(init.rodata) | 452 | MEM_DISCARD(init.rodata) |
344 | 453 | ||
345 | #define INIT_TEXT \ | 454 | #define INIT_TEXT \ |
@@ -363,9 +472,35 @@ | |||
363 | CPU_DISCARD(exit.text) \ | 472 | CPU_DISCARD(exit.text) \ |
364 | MEM_DISCARD(exit.text) | 473 | MEM_DISCARD(exit.text) |
365 | 474 | ||
366 | /* DWARF debug sections. | 475 | #define EXIT_CALL \ |
367 | Symbols in the DWARF debugging sections are relative to | 476 | *(.exitcall.exit) |
368 | the beginning of the section so we begin them at 0. */ | 477 | |
478 | /* | ||
479 | * bss (Block Started by Symbol) - uninitialized data | ||
480 | * zeroed during startup | ||
481 | */ | ||
482 | #define SBSS \ | ||
483 | .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \ | ||
484 | *(.sbss) \ | ||
485 | *(.scommon) \ | ||
486 | } | ||
487 | |||
488 | #define BSS(bss_align) \ | ||
489 | . = ALIGN(bss_align); \ | ||
490 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \ | ||
491 | VMLINUX_SYMBOL(__bss_start) = .; \ | ||
492 | *(.bss.page_aligned) \ | ||
493 | *(.dynbss) \ | ||
494 | *(.bss) \ | ||
495 | *(COMMON) \ | ||
496 | VMLINUX_SYMBOL(__bss_stop) = .; \ | ||
497 | } | ||
498 | |||
499 | /* | ||
500 | * DWARF debug sections. | ||
501 | * Symbols in the DWARF debugging sections are relative to | ||
502 | * the beginning of the section so we begin them at 0. | ||
503 | */ | ||
369 | #define DWARF_DEBUG \ | 504 | #define DWARF_DEBUG \ |
370 | /* DWARF 1 */ \ | 505 | /* DWARF 1 */ \ |
371 | .debug 0 : { *(.debug) } \ | 506 | .debug 0 : { *(.debug) } \ |
@@ -432,6 +567,12 @@ | |||
432 | VMLINUX_SYMBOL(__stop_notes) = .; \ | 567 | VMLINUX_SYMBOL(__stop_notes) = .; \ |
433 | } | 568 | } |
434 | 569 | ||
570 | #define INIT_SETUP(initsetup_align) \ | ||
571 | . = ALIGN(initsetup_align); \ | ||
572 | VMLINUX_SYMBOL(__setup_start) = .; \ | ||
573 | *(.init.setup) \ | ||
574 | VMLINUX_SYMBOL(__setup_end) = .; | ||
575 | |||
435 | #define INITCALLS \ | 576 | #define INITCALLS \ |
436 | *(.initcallearly.init) \ | 577 | *(.initcallearly.init) \ |
437 | VMLINUX_SYMBOL(__early_initcall_end) = .; \ | 578 | VMLINUX_SYMBOL(__early_initcall_end) = .; \ |
@@ -453,6 +594,31 @@ | |||
453 | *(.initcall7.init) \ | 594 | *(.initcall7.init) \ |
454 | *(.initcall7s.init) | 595 | *(.initcall7s.init) |
455 | 596 | ||
597 | #define INIT_CALLS \ | ||
598 | VMLINUX_SYMBOL(__initcall_start) = .; \ | ||
599 | INITCALLS \ | ||
600 | VMLINUX_SYMBOL(__initcall_end) = .; | ||
601 | |||
602 | #define CON_INITCALL \ | ||
603 | VMLINUX_SYMBOL(__con_initcall_start) = .; \ | ||
604 | *(.con_initcall.init) \ | ||
605 | VMLINUX_SYMBOL(__con_initcall_end) = .; | ||
606 | |||
607 | #define SECURITY_INITCALL \ | ||
608 | VMLINUX_SYMBOL(__security_initcall_start) = .; \ | ||
609 | *(.security_initcall.init) \ | ||
610 | VMLINUX_SYMBOL(__security_initcall_end) = .; | ||
611 | |||
612 | #ifdef CONFIG_BLK_DEV_INITRD | ||
613 | #define INIT_RAM_FS \ | ||
614 | . = ALIGN(PAGE_SIZE); \ | ||
615 | VMLINUX_SYMBOL(__initramfs_start) = .; \ | ||
616 | *(.init.ramfs) \ | ||
617 | VMLINUX_SYMBOL(__initramfs_end) = .; | ||
618 | #else | ||
619 | #define INITRAMFS | ||
620 | #endif | ||
621 | |||
456 | /** | 622 | /** |
457 | * PERCPU_VADDR - define output section for percpu area | 623 | * PERCPU_VADDR - define output section for percpu area |
458 | * @vaddr: explicit base address (optional) | 624 | * @vaddr: explicit base address (optional) |
@@ -509,3 +675,58 @@ | |||
509 | *(.data.percpu.shared_aligned) \ | 675 | *(.data.percpu.shared_aligned) \ |
510 | VMLINUX_SYMBOL(__per_cpu_end) = .; \ | 676 | VMLINUX_SYMBOL(__per_cpu_end) = .; \ |
511 | } | 677 | } |
678 | |||
679 | |||
680 | /* | ||
681 | * Definition of the high level *_SECTION macros | ||
682 | * They will fit only a subset of the architectures | ||
683 | */ | ||
684 | |||
685 | |||
686 | /* | ||
687 | * Writeable data. | ||
688 | * All sections are combined in a single .data section. | ||
689 | * The sections following CONSTRUCTORS are arranged so their | ||
690 | * typical alignment matches. | ||
691 | * A cacheline is typical/always less than a PAGE_SIZE so | ||
692 | * the sections that has this restriction (or similar) | ||
693 | * is located before the ones requiring PAGE_SIZE alignment. | ||
694 | * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which | ||
695 | * matches the requirment of PAGE_ALIGNED_DATA. | ||
696 | * | ||
697 | * use 0 as page_align if page_aligned data is not used */ | ||
698 | #define RW_DATA_SECTION(cacheline, nosave, pagealigned, inittask) \ | ||
699 | . = ALIGN(PAGE_SIZE); \ | ||
700 | .data : AT(ADDR(.data) - LOAD_OFFSET) { \ | ||
701 | INIT_TASK(inittask) \ | ||
702 | CACHELINE_ALIGNED_DATA(cacheline) \ | ||
703 | READ_MOSTLY_DATA(cacheline) \ | ||
704 | DATA_DATA \ | ||
705 | CONSTRUCTORS \ | ||
706 | NOSAVE_DATA(nosave) \ | ||
707 | PAGE_ALIGNED_DATA(pagealigned) \ | ||
708 | } | ||
709 | |||
710 | #define INIT_TEXT_SECTION(inittext_align) \ | ||
711 | . = ALIGN(inittext_align); \ | ||
712 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \ | ||
713 | VMLINUX_SYMBOL(_sinittext) = .; \ | ||
714 | INIT_TEXT \ | ||
715 | VMLINUX_SYMBOL(_einittext) = .; \ | ||
716 | } | ||
717 | |||
718 | #define INIT_DATA_SECTION(initsetup_align) \ | ||
719 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \ | ||
720 | INIT_DATA \ | ||
721 | INIT_SETUP(initsetup_align) \ | ||
722 | INIT_CALLS \ | ||
723 | CON_INITCALL \ | ||
724 | SECURITY_INITCALL \ | ||
725 | INIT_RAM_FS \ | ||
726 | } | ||
727 | |||
728 | #define BSS_SECTION(sbss_align, bss_align) \ | ||
729 | SBSS \ | ||
730 | BSS(bss_align) \ | ||
731 | . = ALIGN(4); | ||
732 | |||
diff --git a/include/linux/init.h b/include/linux/init.h index 0e06c176f185..b2189803f19a 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
@@ -2,8 +2,6 @@ | |||
2 | #define _LINUX_INIT_H | 2 | #define _LINUX_INIT_H |
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <linux/section-names.h> | ||
6 | #include <linux/stringify.h> | ||
7 | 5 | ||
8 | /* These macros are used to mark some functions or | 6 | /* These macros are used to mark some functions or |
9 | * initialized data (doesn't apply to uninitialized data) | 7 | * initialized data (doesn't apply to uninitialized data) |
@@ -101,7 +99,7 @@ | |||
101 | #define __memexitconst __section(.memexit.rodata) | 99 | #define __memexitconst __section(.memexit.rodata) |
102 | 100 | ||
103 | /* For assembly routines */ | 101 | /* For assembly routines */ |
104 | #define __HEAD .section __stringify(HEAD_TEXT_SECTION),"ax" | 102 | #define __HEAD .section ".head.text","ax" |
105 | #define __INIT .section ".init.text","ax" | 103 | #define __INIT .section ".init.text","ax" |
106 | #define __FINIT .previous | 104 | #define __FINIT .previous |
107 | 105 | ||
@@ -225,7 +223,8 @@ struct obs_kernel_param { | |||
225 | * obs_kernel_param "array" too far apart in .init.setup. | 223 | * obs_kernel_param "array" too far apart in .init.setup. |
226 | */ | 224 | */ |
227 | #define __setup_param(str, unique_id, fn, early) \ | 225 | #define __setup_param(str, unique_id, fn, early) \ |
228 | static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \ | 226 | static const char __setup_str_##unique_id[] __initconst \ |
227 | __aligned(1) = str; \ | ||
229 | static struct obs_kernel_param __setup_##unique_id \ | 228 | static struct obs_kernel_param __setup_##unique_id \ |
230 | __used __section(.init.setup) \ | 229 | __used __section(.init.setup) \ |
231 | __attribute__((aligned((sizeof(long))))) \ | 230 | __attribute__((aligned((sizeof(long))))) \ |
diff --git a/include/linux/section-names.h b/include/linux/section-names.h deleted file mode 100644 index c956f4eb2adf..000000000000 --- a/include/linux/section-names.h +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #ifndef __LINUX_SECTION_NAMES_H | ||
2 | #define __LINUX_SECTION_NAMES_H | ||
3 | |||
4 | #define HEAD_TEXT_SECTION .head.text | ||
5 | |||
6 | #endif /* !__LINUX_SECTION_NAMES_H */ | ||