2021-07-20 11:40:09 +03:00
|
|
|
#include <AK/Platform.h>
|
|
|
|
|
2021-07-18 15:47:32 +03:00
|
|
|
ENTRY(init)
|
2018-10-16 12:01:38 +03:00
|
|
|
|
2021-07-20 03:34:02 +03:00
|
|
|
#define PF_X 0x1
|
|
|
|
#define PF_W 0x2
|
|
|
|
#define PF_R 0x4
|
|
|
|
|
2021-06-18 20:04:39 +03:00
|
|
|
PHDRS
|
|
|
|
{
|
2021-07-26 16:10:51 +03:00
|
|
|
elf_headers PT_LOAD FILEHDR PHDRS FLAGS(PF_R) ;
|
2021-07-20 03:34:02 +03:00
|
|
|
super_pages PT_LOAD FLAGS(PF_R | PF_W) ;
|
|
|
|
text PT_LOAD FLAGS(PF_R | PF_X) ;
|
|
|
|
data PT_LOAD FLAGS(PF_R | PF_W) ;
|
|
|
|
bss PT_LOAD FLAGS(PF_R | PF_W) ;
|
2021-07-26 16:10:51 +03:00
|
|
|
dynamic_segment PT_LOAD FLAGS(PF_R | PF_W) ;
|
|
|
|
dynamic PT_DYNAMIC FLAGS(PF_R | PF_W) ;
|
2021-07-20 03:34:02 +03:00
|
|
|
ksyms PT_LOAD FLAGS(PF_R) ;
|
2021-06-18 20:04:39 +03:00
|
|
|
}
|
|
|
|
|
2018-10-16 12:01:38 +03:00
|
|
|
SECTIONS
|
|
|
|
{
|
2020-01-17 21:59:20 +03:00
|
|
|
start_of_kernel_image = .;
|
|
|
|
|
2021-07-26 16:10:51 +03:00
|
|
|
.elf_headers (SIZEOF_HEADERS) : AT (ADDR(.elf_headers) + SIZEOF_HEADERS)
|
|
|
|
{
|
|
|
|
start_of_elf_headers = .;
|
|
|
|
} :elf_headers
|
|
|
|
|
|
|
|
.super_pages ALIGN(4K) (NOLOAD) : AT (ADDR(.super_pages))
|
2021-07-19 10:29:07 +03:00
|
|
|
{
|
|
|
|
*(.super_pages)
|
2021-07-19 19:52:01 +03:00
|
|
|
} :super_pages
|
2021-07-19 10:29:07 +03:00
|
|
|
|
2021-07-26 16:10:51 +03:00
|
|
|
.text ALIGN(4K) : AT (ADDR(.text))
|
2021-06-17 20:27:05 +03:00
|
|
|
{
|
2020-01-06 15:53:30 +03:00
|
|
|
start_of_kernel_text = .;
|
2020-12-20 04:48:56 +03:00
|
|
|
|
|
|
|
start_of_safemem_text = .;
|
2021-02-10 01:49:02 +03:00
|
|
|
KEEP(*(.text.safemem))
|
2020-12-20 04:48:56 +03:00
|
|
|
end_of_safemem_text = .;
|
|
|
|
start_of_safemem_atomic_text = .;
|
2021-02-10 01:49:02 +03:00
|
|
|
KEEP(*(.text.safemem.atomic))
|
2020-12-20 04:48:56 +03:00
|
|
|
end_of_safemem_atomic_text = .;
|
|
|
|
|
2021-02-10 01:49:02 +03:00
|
|
|
*(.text*)
|
2021-06-18 20:04:39 +03:00
|
|
|
} :text
|
2021-02-19 20:21:54 +03:00
|
|
|
|
2021-07-26 16:10:51 +03:00
|
|
|
.unmap_after_init ALIGN(4K) : AT (ADDR(.unmap_after_init))
|
2021-02-19 20:21:54 +03:00
|
|
|
{
|
|
|
|
start_of_unmap_after_init = .;
|
|
|
|
*(.unmap_after_init*);
|
|
|
|
end_of_unmap_after_init = .;
|
|
|
|
|
2020-01-06 15:53:30 +03:00
|
|
|
end_of_kernel_text = .;
|
2021-06-18 20:04:39 +03:00
|
|
|
} :text
|
2018-10-16 12:01:38 +03:00
|
|
|
|
2021-07-26 16:10:51 +03:00
|
|
|
.rodata ALIGN(4K) : AT (ADDR(.rodata))
|
2020-01-16 11:46:09 +03:00
|
|
|
{
|
2020-08-10 18:44:35 +03:00
|
|
|
start_heap_ctors = .;
|
|
|
|
*libkernel_heap.a:*(.ctors)
|
2022-01-19 21:12:50 +03:00
|
|
|
*libkernel_heap.a:*(.init_array)
|
2020-08-10 18:44:35 +03:00
|
|
|
end_heap_ctors = .;
|
|
|
|
|
2020-01-16 11:46:09 +03:00
|
|
|
start_ctors = .;
|
|
|
|
*(.ctors)
|
2022-01-19 21:12:50 +03:00
|
|
|
*(.init_array)
|
2020-01-16 11:46:09 +03:00
|
|
|
end_ctors = .;
|
2019-10-31 21:01:13 +03:00
|
|
|
|
2021-02-10 01:49:02 +03:00
|
|
|
*(.rodata*)
|
2021-06-18 20:04:39 +03:00
|
|
|
} :data
|
2018-10-16 12:01:38 +03:00
|
|
|
|
2021-07-26 16:10:51 +03:00
|
|
|
.data ALIGN(4K) : AT (ADDR(.data))
|
2020-01-16 11:46:09 +03:00
|
|
|
{
|
2020-01-06 15:53:30 +03:00
|
|
|
start_of_kernel_data = .;
|
2021-02-10 01:49:02 +03:00
|
|
|
*(.data*)
|
2020-01-06 15:53:30 +03:00
|
|
|
end_of_kernel_data = .;
|
2021-06-18 20:04:39 +03:00
|
|
|
} :data
|
2018-10-16 12:01:38 +03:00
|
|
|
|
2021-07-26 16:10:51 +03:00
|
|
|
.ro_after_init ALIGN(4K) (NOLOAD) : AT(ADDR(.ro_after_init))
|
2021-02-14 19:35:07 +03:00
|
|
|
{
|
|
|
|
start_of_ro_after_init = .;
|
|
|
|
*(.ro_after_init);
|
|
|
|
end_of_ro_after_init = .;
|
2021-06-18 20:04:39 +03:00
|
|
|
} :data
|
2021-02-14 19:35:07 +03:00
|
|
|
|
2021-07-26 16:10:51 +03:00
|
|
|
.bss ALIGN(4K) (NOLOAD) : AT (ADDR(.bss))
|
2020-01-16 11:46:09 +03:00
|
|
|
{
|
2020-01-06 15:53:30 +03:00
|
|
|
start_of_kernel_bss = .;
|
2020-01-17 21:59:20 +03:00
|
|
|
*(page_tables)
|
2020-01-16 11:46:09 +03:00
|
|
|
*(COMMON)
|
2021-09-11 10:56:12 +03:00
|
|
|
*(.bss*)
|
2020-01-06 15:53:30 +03:00
|
|
|
end_of_kernel_bss = .;
|
2021-01-20 19:49:55 +03:00
|
|
|
|
|
|
|
. = ALIGN(4K);
|
|
|
|
*(.heap)
|
2021-06-18 20:04:39 +03:00
|
|
|
} :bss
|
2020-01-17 21:59:20 +03:00
|
|
|
|
2021-07-26 16:10:51 +03:00
|
|
|
.dynamic ALIGN(4K) : AT (ADDR(.dynamic))
|
|
|
|
{
|
|
|
|
*(.dynamic)
|
|
|
|
} :dynamic_segment :dynamic
|
2021-07-14 22:04:18 +03:00
|
|
|
|
2021-07-26 16:10:51 +03:00
|
|
|
.ksyms ALIGN(4K) : AT (ADDR(.ksyms))
|
2021-07-14 22:04:18 +03:00
|
|
|
{
|
2021-07-16 10:50:34 +03:00
|
|
|
start_of_kernel_ksyms = .;
|
2021-07-14 22:04:18 +03:00
|
|
|
*(.kernel_symbols)
|
2021-07-16 10:50:34 +03:00
|
|
|
end_of_kernel_ksyms = .;
|
2021-07-14 22:04:18 +03:00
|
|
|
} :ksyms
|
2021-07-16 10:50:34 +03:00
|
|
|
|
|
|
|
end_of_kernel_image = .;
|
2018-10-16 12:01:38 +03:00
|
|
|
}
|