summaryrefslogtreecommitdiff
path: root/boot/x86_64/linker.ld
diff options
context:
space:
mode:
Diffstat (limited to 'boot/x86_64/linker.ld')
-rw-r--r--boot/x86_64/linker.ld32
1 files changed, 32 insertions, 0 deletions
diff --git a/boot/x86_64/linker.ld b/boot/x86_64/linker.ld
new file mode 100644
index 0000000..b439380
--- /dev/null
+++ b/boot/x86_64/linker.ld
@@ -0,0 +1,32 @@
+/* x86_64 UEFI Loader Linker Script — ELF -> objcopy -> PE32+ */
+
+ENTRY(efi_main)
+
+SECTIONS
+{
+ . = 0;
+
+ .text : { *(.text .text.*) }
+
+ . = ALIGN(4096);
+ .rodata : { *(.rodata .rodata.*) }
+
+ . = ALIGN(4096);
+ .data : { *(.data .data.*) *(.sdata .sdata.*) }
+
+ . = ALIGN(4096);
+ .bss : { *(.bss .bss.*) *(COMMON) }
+
+ /*
+ .reloc - empty PE base relocation sections. PE format requires this section to exist, even if empty.
+ The aarch64 target doesn't need it explicitly. X86 does. TODO: i'm not sure about this!!!!
+ */
+ . = ALIGN(4096);
+ .dynamic : { *(.dynamic) }
+ .rela : { *(.rela .rela.*) }
+ .reloc : { }
+
+ /DISCARD/ : {
+ *(.comment) *(.note.*) *(.eh_frame*) *(.gnu.hash) *(.hash)
+ }
+}