Diff markup
001 /* Copyright (C) 2003, Thomas Petazzoni 001 /* Copyright (C) 2003, Thomas Petazzoni
002 002
003 This program is free software; you can redi 003 This program is free software; you can redistribute it and/or
004 modify it under the terms of the GNU Genera 004 modify it under the terms of the GNU General Public License
005 as published by the Free Software Foundatio 005 as published by the Free Software Foundation; either version 2
006 of the License, or (at your option) any lat 006 of the License, or (at your option) any later version.
007 007
008 This program is distributed in the hope tha 008 This program is distributed in the hope that it will be useful,
009 but WITHOUT ANY WARRANTY; without even the 009 but WITHOUT ANY WARRANTY; without even the implied warranty of
010 MERCHANTABILITY or FITNESS FOR A PARTICULAR 010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
011 GNU General Public License for more details 011 GNU General Public License for more details.
012 012
013 You should have received a copy of the GNU 013 You should have received a copy of the GNU General Public License
014 along with this program; if not, write to t 014 along with this program; if not, write to the Free Software
015 Foundation, Inc., 59 Temple Place - Suite 3 015 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
016 USA. 016 USA.
017 */ 017 */
018 018
019 /* We generate binary in the ELF format */ 019 /* We generate binary in the ELF format */
020 OUTPUT_FORMAT("elf32-i386","elf32-i386","elf32 020 OUTPUT_FORMAT("elf32-i386","elf32-i386","elf32-i386");
021 021
022 /* The entry point is _start (defined in boot. 022 /* The entry point is _start (defined in boot.S) */
023 ENTRY(_start) 023 ENTRY(_start)
024 024
025 /* The architecture is i386 */ 025 /* The architecture is i386 */
026 OUTPUT_ARCH("i386") 026 OUTPUT_ARCH("i386")
027 027
028 SECTIONS 028 SECTIONS
029 { 029 {
030 /* our kernel is loaded at 0x200000 */ 030 /* our kernel is loaded at 0x200000 */
031 . = 0x200000; 031 . = 0x200000;
032 __b_load = .; 032 __b_load = .;
033 033
034 /* the multiboot header MUST come early en 034 /* the multiboot header MUST come early enough in the output
035 object file */ 035 object file */
036 .multiboot : 036 .multiboot :
037 { 037 {
038 /* The multiboot section (containing t 038 /* The multiboot section (containing the multiboot header)
039 goes here */ 039 goes here */
040 *(.multiboot); 040 *(.multiboot);
041 041
042 /* 042 /*
043 * With the following line, we force t 043 * With the following line, we force this section to be
044 * allocated in the output file as soo 044 * allocated in the output file as soon as possible, no matter
045 * when the file containing the multib 045 * when the file containing the multiboot header (multiboot.S)
046 * is compiled. This is to conform to 046 * is compiled. This is to conform to the multiboot spec, which
047 * says "The Multiboot header must be 047 * says "The Multiboot header must be contained completely
048 * within the first 8192 bytes of the 048 * within the first 8192 bytes of the OS image, and must be
049 * longword (32-bit) aligned." 049 * longword (32-bit) aligned."
050 */ 050 */
051 LONG(0); 051 LONG(0);
052 } 052 }
053 053
054 /* Defines a symbol '__b_kernel to mark th 054 /* Defines a symbol '__b_kernel to mark the start of the kernel
055 code/data */ 055 code/data */
056 . = ALIGN(4096); 056 . = ALIGN(4096);
057 __b_kernel = .; 057 __b_kernel = .;
058 058
059 /* Beginning of the text section */ 059 /* Beginning of the text section */
060 .text ALIGN(4096) : 060 .text ALIGN(4096) :
061 { 061 {
062 /* This section includes the code */ 062 /* This section includes the code */
063 *(.text*) 063 *(.text*)
064 /* Defines the 'etext' and '_etext' at 064 /* Defines the 'etext' and '_etext' at the end */
065 PROVIDE(etext = .); 065 PROVIDE(etext = .);
066 PROVIDE(_etext = .); 066 PROVIDE(_etext = .);
067 } 067 }
068 068
069 /* Beginning of the data section */ 069 /* Beginning of the data section */
070 .data . : 070 .data . :
071 { *(.data*) 071 { *(.data*)
072 PROVIDE(edata = .); 072 PROVIDE(edata = .);
073 PROVIDE(_edata = .); 073 PROVIDE(_edata = .);
074 } 074 }
075 075
076 /* Beginning of the read-only data section 076 /* Beginning of the read-only data section */
077 .rodata . : 077 .rodata . :
078 { *(.rodata*) 078 { *(.rodata*)
079 *(.eh_frame*) <<
080 <<
081 /* For articles 7.5 and later, it is b <<
082 "files" are located on a 4kB bounda <<
083 binfmt_elf32 to share program pages <<
084 user, alleviating the need to alloc <<
085 user code */ <<
086 . = ALIGN(4096); <<
087 *(.userprogs) <<
088 <<
089 PROVIDE(erodata = .); 079 PROVIDE(erodata = .);
090 PROVIDE(_erodata = .); 080 PROVIDE(_erodata = .);
091 } 081 }
092 082
093 /* We take note of the end of the data to 083 /* We take note of the end of the data to load */
094 __e_load = .; 084 __e_load = .;
095 085
096 /* Beginning of the BSS section (global un 086 /* Beginning of the BSS section (global uninitialized data) */
097 .bss SIZEOF(.rodata) + ADDR(.rodata) : 087 .bss SIZEOF(.rodata) + ADDR(.rodata) :
098 { *(.bss) 088 { *(.bss)
099 *(COMMON) 089 *(COMMON)
100 090
101 /* We put the stack of the bootstrap t 091 /* We put the stack of the bootstrap thread on a page
102 boundary, because it can be un-allo 092 boundary, because it can be un-allocated later */
103 . = ALIGN(4096); 093 . = ALIGN(4096);
104 *(.init_stack) 094 *(.init_stack)
105 095
106 PROVIDE(ebss = .); 096 PROVIDE(ebss = .);
107 PROVIDE(_ebss = .); 097 PROVIDE(_ebss = .);
108 } 098 }
109 099
110 /* We take note of the end of the kernel: 100 /* We take note of the end of the kernel: this is where the GPFM
111 will begin */ 101 will begin */
112 __e_kernel = .; 102 __e_kernel = .;
>> 103
>> 104 /* We don't care of the note, indent, comment, etc.. sections
>> 105 generated by gcc */
>> 106 /DISCARD/ :{
>> 107 *(.note*)
>> 108 *(.indent)
>> 109 *(.comment)
>> 110 *(.stab)
>> 111 *(.stabstr)
>> 112 }
>> 113
113 } 114 }
>> 115