summaryrefslogtreecommitdiff
path: root/sos-code-article6.5/support/sos.lds
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2014-03-28 17:09:15 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2014-03-28 17:09:15 +0100
commita8968330aff45e0b8cf278f49fa337d5fcb9bfd8 (patch)
treededf697b1a5c3c96e77f77e551e9e6af8785a51c /sos-code-article6.5/support/sos.lds
parent8d9e22df8afa4c3339e52c7b3b77388ca0e69fac (diff)
downloadSOS-a8968330aff45e0b8cf278f49fa337d5fcb9bfd8.tar.gz
SOS-a8968330aff45e0b8cf278f49fa337d5fcb9bfd8.zip
Import and compile code for article 6.5
Diffstat (limited to 'sos-code-article6.5/support/sos.lds')
-rw-r--r--sos-code-article6.5/support/sos.lds115
1 files changed, 115 insertions, 0 deletions
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)
+ }
+
+}
+