aboutsummaryrefslogtreecommitdiff
path: root/linker.ld
diff options
context:
space:
mode:
Diffstat (limited to 'linker.ld')
-rw-r--r--linker.ld63
1 files changed, 18 insertions, 45 deletions
diff --git a/linker.ld b/linker.ld
index 01eda35..387e7c7 100644
--- a/linker.ld
+++ b/linker.ld
@@ -1,18 +1,21 @@
-ENTRY(_start)
+ENTRY(_start) /* defined in boot.S */
SECTIONS
{
- /* Starts at LOADER_ADDR, which is 0x8000 - that's where RPis in */
- /* 32-bit mode load kernel at. */
+ /* Starts at 0x8000 - that's where RPis in 32-bit mode load kernel at. */
/* My experiments do, however, show, that qemu emulating RPi2 */
/* loads the kernel at 0x10000! (took some pain to find out). */
- /* Since we're using a bootloader now, we can compile the kernel */
- /* for 0x8000 and bootloader will load it properly (although it */
- /* itself still has to be compiled for 0x10000) */
- /* rpi-open-firmware, ont he other hand, loads kernel at 0x2000000 */
- /* This issue is also to be avoided by the use of bootloader */
+ /* rpi-open-firmware, on the other hand, loads kernel at 0x2000000! */
+ /* This is not really a problem, since: */
+ /* 1. We can use out bootloader to load the kernel at 0x8000 */
+ /* 2. We compile kernel with -fPIC, so it should be able to work with */
+ /* any load addr.
+ /* 3. In qemu, we can load kernel.elf instead of raw binary */
+ /* (qemu will do the loading then) */
+
. = 0x8000;
- /* For AArch64, use . = 0x80000; Unless this too is wrong in qemu… */
+
+ /* For AArch64, use . = 0x80000 */
__start = .;
__text_start = .;
@@ -51,44 +54,14 @@ SECTIONS
__bss_size = __bss_end - __bss_start;
-
- /* Here come the definitions for renamed sections */
- __renamed_start = .;
- __renamed_text_start = .;
- .renamed_text :
- {
- *(.renamed_text)
- }
- . = ALIGN(4096); /* align to page size */
- __renamed_text_end = .;
-
- __renamed_rodata_start = .;
- .renamed_rodata :
- {
- *(.renamed_rodata)
- }
- . = ALIGN(4096); /* align to page size */
- __renamed_rodata_end = .;
-
- __renamed_data_start = .;
- .renamed_data :
- {
- *(.renamed_data)
- }
- . = ALIGN(4096); /* align to page size */
- __renamed_data_end = .;
-
- __renamed_bss_start = .;
- .renamed_bss :
+ /* libkernel */
+ .libkernel :
{
- renamed_bss = .;
- *(.renamed_bss)
+ __libkernel_start = .;
+ libkernel.o
+ __libkernel_end = .;
}
- . = ALIGN(4096); /* align to page size */
- __renamed_bss_end = .;
- __renamed_bss_size = __renamed_bss_end - __renamed_bss_start;
- __renamed_end = .;
- __renamed_size = __renamed_end - __renamed_start;
+ __libkernel_size = __libkernel_end - __libkernel_start;
. = ALIGN(4096); /* align to page size */