diff options
| author | Tianhao Wang <shrik3@mailbox.org> | 2024-04-17 14:33:34 +0200 |
|---|---|---|
| committer | Tianhao Wang <shrik3@mailbox.org> | 2024-06-11 15:16:32 +0200 |
| commit | e5733c69740dc492fa82aed35861c40a770e9b50 (patch) | |
| tree | 47712613f32c7d2ea26db90e17e3423cdfd3e9f9 /defs/x86_64-linker.ld | |
| parent | 41be743a05b9350e356ffb1c897a11656ed0b398 (diff) | |
rework linker script
Diffstat (limited to 'defs/x86_64-linker.ld')
| -rw-r--r-- | defs/x86_64-linker.ld | 100 |
1 files changed, 33 insertions, 67 deletions
diff --git a/defs/x86_64-linker.ld b/defs/x86_64-linker.ld index b484366..7783bc2 100644 --- a/defs/x86_64-linker.ld +++ b/defs/x86_64-linker.ld @@ -1,76 +1,42 @@ SECTIONS { - . = 0x100000; /* system's start address */ + PROVIDE (___KERNEL_START__ = .); + . = 0x100000; /* system's start address */ - .text : - { - *(".text") - *(".text.*") - *(".text$") - *(".init") - *(".fini") - *(".gnu.linkonce.*") - } + .text : + { + *(".text") + *(".text.*") + *(".text$") + } - .init_array : - { - PROVIDE_HIDDEN (__init_array_start = .); - KEEP (*(SORT(.init_array.*))) - KEEP (*(.init_array)) - KEEP (*(".ctors")) - KEEP (*(".ctor")) - PROVIDE_HIDDEN (__init_array_end = .); - } + .data : + { + *(".data") + *(".data$") + } - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array)) - KEEP (*(".dtors")) - KEEP (*(".dtor")) - PROVIDE_HIDDEN (__fini_array_end = .); - } + .rodata : + { + *(".rodata") + *(".rodata$") + *(".rodata.*") + } - .data : - { - *(".data") - *(".data$") - *(".rodata") - *(".rodata.*") - *(".got") - *(".got.plt") - *(".eh_frame") - *(".eh_fram") - *(".jcr") - *(".note.*") - } + .bss : + { + ___BSS_START__ = .; + *(".bss") + *(".bss.*") + ___BSS_END__ = .; + } - .bss : - { - ___BSS_START__ = .; - *(".bss") - *(".bss.*") - ___BSS_END__ = .; - } + /* global page table for 64-bit long mode */ + .global_pagetable ALIGN(4096) (NOLOAD) : + { + *(".global_pagetable") + } - /* 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") - } -*/ - . = ALIGN(4096); - PROVIDE (___KERNEL_END__ = .); + . = ALIGN(4096); + PROVIDE (___KERNEL_END__ = .); } |
