debuggers.hg

view xen/arch/x86/xen.lds.S @ 19966:3f12d48f2880

x86: merge final linking scripts

While unrelated to the previous four patches, I realized that the two
scripts are nearly identical when coding those earlier patches, and
this patch depends on them in order to apply cleanly.

As an extra measure, it also adjusts the (unused) space freed at the
end of the per-CPU area to include all alignment space needed before
the first actual constituent of the .bss section (up to 7 pages on
x86-64).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jul 13 11:51:07 2009 +0100 (2009-07-13)
parents
children 10c0942ed240
line source
1 /* Excerpts written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> */
2 /* Modified for i386/x86-64 Xen by Keir Fraser */
4 #include <xen/config.h>
5 #include <xen/cache.h>
6 #include <asm/page.h>
7 #include <asm/percpu.h>
8 #undef ENTRY
9 #undef ALIGN
11 #ifdef __x86_64__
12 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
13 OUTPUT_ARCH(i386:x86-64)
14 #else
15 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
16 OUTPUT_ARCH(i386)
17 #endif
19 ENTRY(start)
20 PHDRS
21 {
22 text PT_LOAD ;
23 }
24 SECTIONS
25 {
26 . = __XEN_VIRT_START + 0x100000;
27 _start = .;
28 .text : {
29 _stext = .; /* Text and read-only data */
30 *(.text)
31 *(.fixup)
32 *(.gnu.warning)
33 _etext = .; /* End of text section */
34 } :text = 0x9090
36 .rodata : {
37 *(.rodata)
38 *(.rodata.*)
39 } :text
41 . = ALIGN(32); /* Exception table */
42 __ex_table : {
43 __start___ex_table = .;
44 *(__ex_table)
45 __stop___ex_table = .;
46 } :text
48 . = ALIGN(32); /* Pre-exception table */
49 __pre_ex_table : {
50 __start___pre_ex_table = .;
51 *(__pre_ex_table)
52 __stop___pre_ex_table = .;
53 } :text
55 .data : { /* Data */
56 *(.data)
57 CONSTRUCTORS
58 } :text
60 . = ALIGN(128);
61 .data.read_mostly : {
62 *(.data.read_mostly)
63 } :text
65 . = ALIGN(4096); /* Init code and data */
66 __init_begin = .;
67 .init.text : {
68 _sinittext = .;
69 *(.init.text)
70 _einittext = .;
71 } :text
72 .init.data : {
73 *(.init.data)
74 } :text
75 . = ALIGN(32);
76 .init.setup : {
77 __setup_start = .;
78 *(.init.setup)
79 __setup_end = .;
80 } :text
81 .initcall.init : {
82 __initcall_start = .;
83 *(.initcall1.init)
84 __initcall_end = .;
85 } :text
86 .xsm_initcall.init : {
87 __xsm_initcall_start = .;
88 *(.xsm_initcall.init)
89 __xsm_initcall_end = .;
90 } :text
91 . = ALIGN(PAGE_SIZE);
92 __init_end = .;
94 __per_cpu_shift = PERCPU_SHIFT; /* kdump assist */
95 .data.percpu : {
96 __per_cpu_start = .;
97 *(.data.percpu)
98 . = ALIGN(SMP_CACHE_BYTES);
99 *(.data.percpu.read_mostly)
100 __per_cpu_data_end = .;
101 } :text
102 . = __per_cpu_start + (NR_CPUS << PERCPU_SHIFT);
103 . = ALIGN(PAGE_SIZE);
105 /*
106 * Do not insert anything here - the unused portion of .data.percpu
107 * will be freed/unmapped up to __bss_start (defined below).
108 */
110 .bss : { /* BSS */
111 . = ALIGN(STACK_SIZE);
112 __bss_start = .;
113 *(.bss.stack_aligned)
114 . = ALIGN(PAGE_SIZE);
115 *(.bss.page_aligned)
116 *(.bss)
117 } :text
118 _end = . ;
120 /* Sections to be discarded */
121 /DISCARD/ : {
122 *(.exit.text)
123 *(.exit.data)
124 *(.exitcall.exit)
125 *(.eh_frame)
126 }
128 /* Stabs debugging sections. */
129 .stab 0 : { *(.stab) }
130 .stabstr 0 : { *(.stabstr) }
131 .stab.excl 0 : { *(.stab.excl) }
132 .stab.exclstr 0 : { *(.stab.exclstr) }
133 .stab.index 0 : { *(.stab.index) }
134 .stab.indexstr 0 : { *(.stab.indexstr) }
135 .comment 0 : { *(.comment) }
136 }