summaryrefslogtreecommitdiffstats
path: root/kernel/linker.ld
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-11-03 00:15:58 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2015-11-03 00:15:58 +0100
commita71fe5ed5d709ef0a3caefb744a99c575fb9dd29 (patch)
tree9a33e76614e7f51a4c255d8b59068e1dd289b35c /kernel/linker.ld
downloadjeyzuos-a71fe5ed5d709ef0a3caefb744a99c575fb9dd29.zip
jeyzuos-a71fe5ed5d709ef0a3caefb744a99c575fb9dd29.tar.gz
initial commit
Diffstat (limited to 'kernel/linker.ld')
-rw-r--r--kernel/linker.ld46
1 files changed, 46 insertions, 0 deletions
diff --git a/kernel/linker.ld b/kernel/linker.ld
new file mode 100644
index 0000000..3f1fe9d
--- /dev/null
+++ b/kernel/linker.ld
@@ -0,0 +1,46 @@
+/* the entry point */
+ENTRY(_start)
+
+SECTIONS
+{
+ /* all sections located above 1MB */
+ . = 0x100000;
+
+ /* multiboot header first (needs to reside within the first 8KB),
+ * then the code itself
+ */
+ .text BLOCK(4K) : ALIGN(4K)
+ {
+ *(.multiboot)
+ *(.code)
+ }
+
+ /* to be sure that this kernel is identified as a multiboot one,
+ * the GNU notes information should be placed inside the first 8K.
+ * another option is to exclude this unqiue header with -Wl,--build-id=none
+ */
+ .note.gnu.build-id BLOCK(4K) : ALIGN(4K)
+ {
+ *(.note.gnu.build-id)
+ }
+
+ /* read-only data */
+ .rodata BLOCK(4K) : ALIGN(4K)
+ {
+ *(.rodata*)
+ }
+
+ /* read-write data (initialized) */
+ .data BLOCK(4K) : ALIGN(4K)
+ {
+ *(.data*)
+ }
+
+ /* read-write data (uninitialized) and stack */
+ .bss BLOCK(4K) : ALIGN(4K)
+ {
+ *(COMMON)
+ *(.bss)
+ *(.bootstrap_stack)
+ }
+}