diff options
| author | Tianhao Wang <shrik3@riseup.net> | 2023-03-10 19:26:31 +0100 |
|---|---|---|
| committer | Tianhao Wang <shrik3@riseup.net> | 2023-03-10 19:26:31 +0100 |
| commit | 29e28bc9c67378d0d9a7174dec6a0b541fb7f4d5 (patch) | |
| tree | ff9cd708e41ffb7f3b84347d404ffde758c18ab5 /src/arch/x86_64/linker.ld | |
| parent | 285508a3c9c2fa35b608e3a561f0c7a63cfacf62 (diff) | |
a minimal working demo on bare metal
Diffstat (limited to 'src/arch/x86_64/linker.ld')
| -rw-r--r-- | src/arch/x86_64/linker.ld | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/arch/x86_64/linker.ld b/src/arch/x86_64/linker.ld new file mode 100644 index 0000000..7a03770 --- /dev/null +++ b/src/arch/x86_64/linker.ld @@ -0,0 +1,74 @@ +SECTIONS +{ + . = 0x100000; /* system's start address */ + + .text : + { + *(".text") + *(".text.*") + *(".text$") + *(".init") + *(".fini") + *(".gnu.linkonce.*") + } + + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + KEEP (*(".ctors")) + KEEP (*(".ctor")) + PROVIDE_HIDDEN (__init_array_end = .); + } + + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array)) + KEEP (*(".dtors")) + KEEP (*(".dtor")) + PROVIDE_HIDDEN (__fini_array_end = .); + } + + .data : + { + *(".data") + *(".data$") + *(".rodata") + *(".rodata.*") + *(".got") + *(".got.plt") + *(".eh_frame") + *(".eh_fram") + *(".jcr") + *(".note.*") + } + + .bss : + { + ___BSS_START__ = .; + *(".bss") + *(".bss.*") + ___BSS_END__ = .; + } + + /* global page table for 64-bit long mode */ + .global_pagetable ALIGN(4096) (NOLOAD) : + { + *(".global_pagetable") + } + +/* + /DISCARD/ : + { + *(".note") + *(".comment") + *(".debug_line") + *(".debug_info") + *(".debug_abbrev") + *(".debug_aranges") + } +*/ +} |
