aboutsummaryrefslogtreecommitdiff
path: root/loader_linker.ld
diff options
context:
space:
mode:
Diffstat (limited to 'loader_linker.ld')
-rw-r--r--loader_linker.ld70
1 files changed, 70 insertions, 0 deletions
diff --git a/loader_linker.ld b/loader_linker.ld
new file mode 100644
index 0000000..a8942f6
--- /dev/null
+++ b/loader_linker.ld
@@ -0,0 +1,70 @@
+ENTRY(_start)
+
+SECTIONS
+{
+ /* Starts at LOADER_ADDR. */
+ /* Warning! Internet says RPis in 32-bit mode load binary at 0x8000! */
+ /* My experiments do, however, show, that qemu emulating RPi2 */
+ /* loads it at 0x10000! (took some pain to find out) */
+
+ /* . = 0x10000; */
+
+ /* rpi-open-firmware, on the other hand, loads it at 0x2000000 */
+ /* (and this should be not-so-hard to change by modifying the */
+ /* firmware) */
+
+ . = 0x2000000;
+
+ /* For AArch64, use . = 0x80000; Unless this too is wrong */
+
+ __start = .;
+ __text_stage1_start = .;
+ .text_stage1 :
+ {
+ KEEP(*(.text.boot))
+ *(.text.boot)
+ *(.text.stage1main)
+ }
+ . = ALIGN(4096); /* align to page size */
+ __text_stage1_end = .;
+
+ __stage2_start = .;
+ __text_start = .;
+ .text :
+ {
+ KEEP(*(.text.stage2main))
+ *(.text.boot)
+ }
+ . = ALIGN(4096); /* align to page size */
+ __text_end = .;
+
+ __rodata_start = .;
+ .rodata :
+ {
+ *(.rodata)
+ }
+ . = ALIGN(4096); /* align to page size */
+ __rodata_end = .;
+
+ __data_start = .;
+ .data :
+ {
+ *(.data)
+ }
+ . = ALIGN(4096); /* align to page size */
+ __data_end = .;
+
+ __bss_start = .;
+ .bss :
+ {
+ bss = .;
+ *(.bss)
+ }
+ . = ALIGN(4096); /* align to page size */
+ __bss_end = .;
+ __bss_size = __bss_end - __bss_start;
+
+ __stage2_end = .;
+ __stage2_size = __stage2_end - __stage2_start;
+ __end = .;
+}