From a8968330aff45e0b8cf278f49fa337d5fcb9bfd8 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Fri, 28 Mar 2014 17:09:15 +0100 Subject: Import and compile code for article 6.5 --- sos-code-article6.5/support/sos.lds | 115 ++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 sos-code-article6.5/support/sos.lds (limited to 'sos-code-article6.5/support/sos.lds') diff --git a/sos-code-article6.5/support/sos.lds b/sos-code-article6.5/support/sos.lds new file mode 100644 index 0000000..497c9b5 --- /dev/null +++ b/sos-code-article6.5/support/sos.lds @@ -0,0 +1,115 @@ +/* Copyright (C) 2003, Thomas Petazzoni + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. +*/ + +/* We generate binary in the ELF format */ +OUTPUT_FORMAT("elf32-i386","elf32-i386","elf32-i386"); + +/* The entry point is _start (defined in boot.S) */ +ENTRY(_start) + +/* The architecture is i386 */ +OUTPUT_ARCH("i386") + +SECTIONS +{ + /* our kernel is loaded at 0x200000 */ + . = 0x200000; + __b_load = .; + + /* the multiboot header MUST come early enough in the output + object file */ + .multiboot : + { + /* The multiboot section (containing the multiboot header) + goes here */ + *(.multiboot); + + /* + * With the following line, we force this section to be + * allocated in the output file as soon as possible, no matter + * when the file containing the multiboot header (multiboot.S) + * is compiled. This is to conform to the multiboot spec, which + * says "The Multiboot header must be contained completely + * within the first 8192 bytes of the OS image, and must be + * longword (32-bit) aligned." + */ + LONG(0); + } + + /* Defines a symbol '__b_kernel to mark the start of the kernel + code/data */ + . = ALIGN(4096); + __b_kernel = .; + + /* Beginning of the text section */ + .text ALIGN(4096) : + { + /* This section includes the code */ + *(.text*) + /* Defines the 'etext' and '_etext' at the end */ + PROVIDE(etext = .); + PROVIDE(_etext = .); + } + + /* Beginning of the data section */ + .data . : + { *(.data*) + PROVIDE(edata = .); + PROVIDE(_edata = .); + } + + /* Beginning of the read-only data section */ + .rodata . : + { *(.rodata*) + PROVIDE(erodata = .); + PROVIDE(_erodata = .); + } + + /* We take note of the end of the data to load */ + __e_load = .; + + /* Beginning of the BSS section (global uninitialized data) */ + .bss SIZEOF(.rodata) + ADDR(.rodata) : + { *(.bss) + *(COMMON) + + /* We put the stack of the bootstrap thread on a page + boundary, because it can be un-allocated later */ + . = ALIGN(4096); + *(.init_stack) + + PROVIDE(ebss = .); + PROVIDE(_ebss = .); + } + + /* We take note of the end of the kernel: this is where the GPFM + will begin */ + __e_kernel = .; + + /* We don't care of the note, indent, comment, etc.. sections + generated by gcc */ + /DISCARD/ :{ + *(.note*) + *(.indent) + *(.comment) + *(.stab) + *(.stabstr) + } + +} + -- cgit v1.2.3