summaryrefslogtreecommitdiffstats
path: root/kernel/linker.ld
diff options
context:
space:
mode:
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)
+ }
+}