aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/xen.lds.S
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-07-13 11:51:07 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-07-13 11:51:07 +0100
commite1b075eaf13283dd695d33fb53d63fabd9067d4f (patch)
tree694621991aedacd99993b6955af30a436351aa4f /xen/arch/x86/xen.lds.S
parent716ffa3e1d7abb7570fa10e04fd05bc41c3734af (diff)
downloadxen-e1b075eaf13283dd695d33fb53d63fabd9067d4f.tar.gz
xen-e1b075eaf13283dd695d33fb53d63fabd9067d4f.tar.bz2
xen-e1b075eaf13283dd695d33fb53d63fabd9067d4f.zip
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>
Diffstat (limited to 'xen/arch/x86/xen.lds.S')
-rw-r--r--xen/arch/x86/xen.lds.S136
1 files changed, 136 insertions, 0 deletions
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
new file mode 100644
index 0000000000..5de98dff64
--- /dev/null
+++ b/xen/arch/x86/xen.lds.S
@@ -0,0 +1,136 @@
+/* Excerpts written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> */
+/* Modified for i386/x86-64 Xen by Keir Fraser */
+
+#include <xen/config.h>
+#include <xen/cache.h>
+#include <asm/page.h>
+#include <asm/percpu.h>
+#undef ENTRY
+#undef ALIGN
+
+#ifdef __x86_64__
+OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
+OUTPUT_ARCH(i386:x86-64)
+#else
+OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
+OUTPUT_ARCH(i386)
+#endif
+
+ENTRY(start)
+PHDRS
+{
+ text PT_LOAD ;
+}
+SECTIONS
+{
+ . = __XEN_VIRT_START + 0x100000;
+ _start = .;
+ .text : {
+ _stext = .; /* Text and read-only data */
+ *(.text)
+ *(.fixup)
+ *(.gnu.warning)
+ _etext = .; /* End of text section */
+ } :text = 0x9090
+
+ .rodata : {
+ *(.rodata)
+ *(.rodata.*)
+ } :text
+
+ . = ALIGN(32); /* Exception table */
+ __ex_table : {
+ __start___ex_table = .;
+ *(__ex_table)
+ __stop___ex_table = .;
+ } :text
+
+ . = ALIGN(32); /* Pre-exception table */
+ __pre_ex_table : {
+ __start___pre_ex_table = .;
+ *(__pre_ex_table)
+ __stop___pre_ex_table = .;
+ } :text
+
+ .data : { /* Data */
+ *(.data)
+ CONSTRUCTORS
+ } :text
+
+ . = ALIGN(128);
+ .data.read_mostly : {
+ *(.data.read_mostly)
+ } :text
+
+ . = ALIGN(4096); /* Init code and data */
+ __init_begin = .;
+ .init.text : {
+ _sinittext = .;
+ *(.init.text)
+ _einittext = .;
+ } :text
+ .init.data : {
+ *(.init.data)
+ } :text
+ . = ALIGN(32);
+ .init.setup : {
+ __setup_start = .;
+ *(.init.setup)
+ __setup_end = .;
+ } :text
+ .initcall.init : {
+ __initcall_start = .;
+ *(.initcall1.init)
+ __initcall_end = .;
+ } :text
+ .xsm_initcall.init : {
+ __xsm_initcall_start = .;
+ *(.xsm_initcall.init)
+ __xsm_initcall_end = .;
+ } :text
+ . = ALIGN(PAGE_SIZE);
+ __init_end = .;
+
+ __per_cpu_shift = PERCPU_SHIFT; /* kdump assist */
+ .data.percpu : {
+ __per_cpu_start = .;
+ *(.data.percpu)
+ . = ALIGN(SMP_CACHE_BYTES);
+ *(.data.percpu.read_mostly)
+ __per_cpu_data_end = .;
+ } :text
+ . = __per_cpu_start + (NR_CPUS << PERCPU_SHIFT);
+ . = ALIGN(PAGE_SIZE);
+
+ /*
+ * Do not insert anything here - the unused portion of .data.percpu
+ * will be freed/unmapped up to __bss_start (defined below).
+ */
+
+ .bss : { /* BSS */
+ . = ALIGN(STACK_SIZE);
+ __bss_start = .;
+ *(.bss.stack_aligned)
+ . = ALIGN(PAGE_SIZE);
+ *(.bss.page_aligned)
+ *(.bss)
+ } :text
+ _end = . ;
+
+ /* Sections to be discarded */
+ /DISCARD/ : {
+ *(.exit.text)
+ *(.exit.data)
+ *(.exitcall.exit)
+ *(.eh_frame)
+ }
+
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+ .comment 0 : { *(.comment) }
+}