summaryrefslogtreecommitdiff
path: root/sys/arch/amd64/conf/link.ld
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-06-04 13:41:11 -0400
committerIan Moffett <ian@osmora.org>2024-06-04 13:45:31 -0400
commit98ccb3a2d41015b42d46d8b382decc755a003c3f (patch)
tree4e514830880a4deabebb60c38055792695314ae6 /sys/arch/amd64/conf/link.ld
project: Initial commit
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/arch/amd64/conf/link.ld')
-rw-r--r--sys/arch/amd64/conf/link.ld47
1 files changed, 47 insertions, 0 deletions
diff --git a/sys/arch/amd64/conf/link.ld b/sys/arch/amd64/conf/link.ld
new file mode 100644
index 0000000..b073054
--- /dev/null
+++ b/sys/arch/amd64/conf/link.ld
@@ -0,0 +1,47 @@
+OUTPUT_FORMAT(elf64-x86-64)
+OUTPUT_ARCH(i386:x86-64)
+ENTRY(main)
+
+PHDRS
+{
+ text PT_LOAD FLAGS((1 << 0) | (1 << 2)) ; /* Execute + Read */
+ rodata PT_LOAD FLAGS((1 << 2)) ; /* Read only */
+ data PT_LOAD FLAGS((1 << 1) | (1 << 2)) ; /* Write + Read */
+}
+
+SECTIONS
+{
+ . = 0xFFFFFFFF80000000;
+
+ .text : {
+ *(.text .text.*)
+ } :text
+
+ . += CONSTANT(MAXPAGESIZE);
+
+ .rodata : {
+ *(.rodata .rodata.*)
+ } :rodata
+
+ .drivers : {
+ __drivers_init_start = .;
+ *(.drivers .drivers)
+ __drivers_init_end = .;
+ } :rodata
+
+ . += CONSTANT(MAXPAGESIZE);
+
+ .data : {
+ *(.data .data.*)
+ } :data
+
+ .bss : {
+ *(COMMON)
+ *(.bss .bss.*)
+ } :data
+
+ /DISCARD/ : {
+ *(.eh_frame)
+ *(.note .note.*)
+ }
+}