ia64/xen-unstable
changeset 1741:380963a0e1a5
bitkeeper revision 1.1062.1.7 (40f24af2r5kZAs1cqmBvB4wRz47kpg)
Fix the linker scripts to always produce exactly one loadable program
segment.
Fix the linker scripts to always produce exactly one loadable program
segment.
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Mon Jul 12 08:25:22 2004 +0000 (2004-07-12) |
parents | a503a822a023 |
children | cda0735bdc4c 8e52f41499a0 9dc267c240e7 |
files | xen/arch/x86/boot/mkelf32.c xen/arch/x86/x86_32/xen.lds xen/arch/x86/x86_64/xen.lds |
line diff
1.1 --- a/xen/arch/x86/boot/mkelf32.c Sun Jul 11 14:24:27 2004 +0000 1.2 +++ b/xen/arch/x86/boot/mkelf32.c Mon Jul 12 08:25:22 2004 +0000 1.3 @@ -199,6 +199,13 @@ int main(int argc, char **argv) 1.4 return 1; 1.5 } 1.6 1.7 + if ( in32_ehdr.e_phnum != 1 ) 1.8 + { 1.9 + fprintf(stderr, "Expect precisly 1 program header; found %d.\n", 1.10 + (int)in32_ehdr.e_phnum); 1.11 + return 1; 1.12 + } 1.13 + 1.14 (void)lseek(infd, in32_ehdr.e_phoff, SEEK_SET); 1.15 do_read(infd, &in32_phdr, sizeof(in32_phdr)); 1.16 1.17 @@ -218,6 +225,13 @@ int main(int argc, char **argv) 1.18 return 1; 1.19 } 1.20 1.21 + if ( in64_ehdr.e_phnum != 1 ) 1.22 + { 1.23 + fprintf(stderr, "Expect precisly 1 program header; found %d.\n", 1.24 + (int)in64_ehdr.e_phnum); 1.25 + return 1; 1.26 + } 1.27 + 1.28 (void)lseek(infd, in64_ehdr.e_phoff, SEEK_SET); 1.29 do_read(infd, &in64_phdr, sizeof(in64_phdr)); 1.30
2.1 --- a/xen/arch/x86/x86_32/xen.lds Sun Jul 11 14:24:27 2004 +0000 2.2 +++ b/xen/arch/x86/x86_32/xen.lds Mon Jul 12 08:25:22 2004 +0000 2.3 @@ -1,9 +1,14 @@ 2.4 /* ld script to make i386 Linux kernel 2.5 - * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>; 2.6 + * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> 2.7 + * Modifified for i386 Xen by Keir Fraser 2.8 */ 2.9 OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") 2.10 OUTPUT_ARCH(i386) 2.11 ENTRY(start) 2.12 +PHDRS 2.13 +{ 2.14 + text PT_LOAD ; 2.15 +} 2.16 SECTIONS 2.17 { 2.18 . = 0xFC400000 + 0x100000; 2.19 @@ -12,61 +17,61 @@ SECTIONS 2.20 *(.text) 2.21 *(.fixup) 2.22 *(.gnu.warning) 2.23 - } = 0x9090 2.24 - .text.lock : { *(.text.lock) } /* out-of-line lock text */ 2.25 + } :text =0x9090 2.26 + .text.lock : { *(.text.lock) } :text /* out-of-line lock text */ 2.27 2.28 _etext = .; /* End of text section */ 2.29 2.30 - .rodata : { *(.rodata) *(.rodata.*) } 2.31 - .kstrtab : { *(.kstrtab) } 2.32 + .rodata : { *(.rodata) *(.rodata.*) } :text 2.33 + .kstrtab : { *(.kstrtab) } :text 2.34 2.35 . = ALIGN(16); /* Exception table */ 2.36 __start___ex_table = .; 2.37 - __ex_table : { *(__ex_table) } 2.38 + __ex_table : { *(__ex_table) } :text 2.39 __stop___ex_table = .; 2.40 2.41 __start___ksymtab = .; /* Kernel symbol table */ 2.42 - __ksymtab : { *(__ksymtab) } 2.43 + __ksymtab : { *(__ksymtab) } :text 2.44 __stop___ksymtab = .; 2.45 2.46 __start___kallsyms = .; /* All kernel symbols */ 2.47 - __kallsyms : { *(__kallsyms) } 2.48 + __kallsyms : { *(__kallsyms) } :text 2.49 __stop___kallsyms = .; 2.50 2.51 .data : { /* Data */ 2.52 *(.data) 2.53 CONSTRUCTORS 2.54 - } 2.55 + } :text 2.56 2.57 _edata = .; /* End of data section */ 2.58 2.59 . = ALIGN(8192); /* init_task */ 2.60 - .data.init_task : { *(.data.init_task) } 2.61 + .data.init_task : { *(.data.init_task) } :text 2.62 2.63 . = ALIGN(4096); /* Init code and data */ 2.64 __init_begin = .; 2.65 - .text.init : { *(.text.init) } 2.66 - .data.init : { *(.data.init) } 2.67 + .text.init : { *(.text.init) } :text 2.68 + .data.init : { *(.data.init) } :text 2.69 . = ALIGN(16); 2.70 __setup_start = .; 2.71 - .setup.init : { *(.setup.init) } 2.72 + .setup.init : { *(.setup.init) } :text 2.73 __setup_end = .; 2.74 __initcall_start = .; 2.75 - .initcall.init : { *(.initcall.init) } 2.76 + .initcall.init : { *(.initcall.init) } :text 2.77 __initcall_end = .; 2.78 . = ALIGN(4096); 2.79 __init_end = .; 2.80 2.81 . = ALIGN(4096); 2.82 - .data.page_aligned : { *(.data.idt) } 2.83 + .data.page_aligned : { *(.data.idt) } :text 2.84 2.85 . = ALIGN(32); 2.86 - .data.cacheline_aligned : { *(.data.cacheline_aligned) } 2.87 + .data.cacheline_aligned : { *(.data.cacheline_aligned) } :text 2.88 2.89 __bss_start = .; /* BSS */ 2.90 .bss : { 2.91 *(.bss) 2.92 - } 2.93 + } :text 2.94 _end = . ; 2.95 2.96 /* Sections to be discarded */
3.1 --- a/xen/arch/x86/x86_64/xen.lds Sun Jul 11 14:24:27 2004 +0000 3.2 +++ b/xen/arch/x86/x86_64/xen.lds Mon Jul 12 08:25:22 2004 +0000 3.3 @@ -1,7 +1,12 @@ 3.4 /* Excerpts written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> */ 3.5 +/* Modified for x86-64 Xen by Keir Fraser */ 3.6 OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") 3.7 OUTPUT_ARCH(i386:x86-64) 3.8 ENTRY(start) 3.9 +PHDRS 3.10 +{ 3.11 + text PT_LOAD ; 3.12 +} 3.13 SECTIONS 3.14 { 3.15 . = 0xFFFF830000100000; 3.16 @@ -10,61 +15,61 @@ SECTIONS 3.17 *(.text) 3.18 *(.fixup) 3.19 *(.gnu.warning) 3.20 - } = 0x9090 3.21 - .text.lock : { *(.text.lock) } /* out-of-line lock text */ 3.22 + } :text = 0x9090 3.23 + .text.lock : { *(.text.lock) } :text /* out-of-line lock text */ 3.24 3.25 _etext = .; /* End of text section */ 3.26 3.27 - .rodata : { *(.rodata) *(.rodata.*) } 3.28 - .kstrtab : { *(.kstrtab) } 3.29 + .rodata : { *(.rodata) *(.rodata.*) } :text 3.30 + .kstrtab : { *(.kstrtab) } :text 3.31 3.32 . = ALIGN(16); /* Exception table */ 3.33 __start___ex_table = .; 3.34 - __ex_table : { *(__ex_table) } 3.35 + __ex_table : { *(__ex_table) } :text 3.36 __stop___ex_table = .; 3.37 3.38 __start___ksymtab = .; /* Kernel symbol table */ 3.39 - __ksymtab : { *(__ksymtab) } 3.40 + __ksymtab : { *(__ksymtab) } :text 3.41 __stop___ksymtab = .; 3.42 3.43 __start___kallsyms = .; /* All kernel symbols */ 3.44 - __kallsyms : { *(__kallsyms) } 3.45 + __kallsyms : { *(__kallsyms) } :text 3.46 __stop___kallsyms = .; 3.47 3.48 .data : { /* Data */ 3.49 *(.data) 3.50 CONSTRUCTORS 3.51 - } 3.52 + } :text 3.53 3.54 _edata = .; /* End of data section */ 3.55 3.56 . = ALIGN(8192); /* init_task */ 3.57 - .data.init_task : { *(.data.init_task) } 3.58 + .data.init_task : { *(.data.init_task) } :text 3.59 3.60 . = ALIGN(4096); /* Init code and data */ 3.61 __init_begin = .; 3.62 - .text.init : { *(.text.init) } 3.63 - .data.init : { *(.data.init) } 3.64 + .text.init : { *(.text.init) } :text 3.65 + .data.init : { *(.data.init) } :text 3.66 . = ALIGN(16); 3.67 __setup_start = .; 3.68 - .setup.init : { *(.setup.init) } 3.69 + .setup.init : { *(.setup.init) } :text 3.70 __setup_end = .; 3.71 __initcall_start = .; 3.72 - .initcall.init : { *(.initcall.init) } 3.73 + .initcall.init : { *(.initcall.init) } :text 3.74 __initcall_end = .; 3.75 . = ALIGN(4096); 3.76 __init_end = .; 3.77 3.78 . = ALIGN(4096); 3.79 - .data.page_aligned : { *(.data.idt) } 3.80 + .data.page_aligned : { *(.data.idt) } :text 3.81 3.82 . = ALIGN(32); 3.83 - .data.cacheline_aligned : { *(.data.cacheline_aligned) } 3.84 + .data.cacheline_aligned : { *(.data.cacheline_aligned) } :text 3.85 3.86 __bss_start = .; /* BSS */ 3.87 .bss : { 3.88 *(.bss) 3.89 - } 3.90 + } :text 3.91 _end = . ; 3.92 3.93 /* Sections to be discarded */