hod24-ctf/FullStackNote/script.ld
2024-12-03 14:24:04 +01:00

57 lines
1.3 KiB
Text

FLASH_SIZE = 8 * 1024 * 1024;
FLASH_START = 0x100000000 - FLASH_SIZE;
MEM_SIZE = 128 * 1024 * 1024;
RESET_VECTOR = 0xfffffff0;
BIOS = 0xffffff00;
KERNEL = 0xfffff000;
USERSPACE = 0xffffe000;
OS_LOAD_ADDR = 0x10000;
OUTPUT_FORMAT("elf32-i386")
MEMORY
{
flash : ORIGIN = FLASH_START, LENGTH = FLASH_SIZE
ram : ORIGIN = 0x0, LENGTH = MEM_SIZE
}
SECTIONS
{
.kernel OS_LOAD_ADDR : AT (KERNEL) {
_kernel_start = LOADADDR(.kernel);
KEEP(*(.kernel*))
KEEP(*(.kernel.*))
_kernel_end = LOADADDR(.kernel) + SIZEOF(.kernel);
}
.userspace 0x0 : AT (USERSPACE) {
_userspace_start = USERSPACE;
KEEP(*(.userspace.text))
_userspace_end = USERSPACE + SIZEOF(.userspace);
}
.userspace.data 0x1000 : AT (USERSPACE + SIZEOF(.userspace)) {
_userspace_data_start = LOADADDR(.userspace.data);
KEEP(*(.rodata))
_userspace_data_end = LOADADDR(.userspace.data) + SIZEOF(.userspace.data);
}
.bios BIOS : {
KEEP(*(.bios.gdt))
KEEP(*(.bios.gdt_ptr))
KEEP(*(.bios.text))
KEEP(*(.bios.jmp_pm))
} > flash
.bios.reset_vector RESET_VECTOR : {
KEEP(*(.bios.reset_vector))
FILL(0xab);
. = ABSOLUTE(0x100000000);
foo = .;
} > flash
/DISCARD/ : {
*(.eh_frame) *(.comment) *(.note) *(.note.*) *(.note_*)
}
}