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