1OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
2/*
3 * LK linker script for single segment binaries.
4 */
5PHDRS
6{
7    code PT_LOAD FLAGS(5);   /* PF_R|PF_X */
8    rodata PT_LOAD FLAGS(4); /* PF_R */
9    data PT_LOAD FLAGS(6);   /* PF_R|PF_W */
10}
11
12ENTRY(_start)
13SECTIONS
14{
15    . = %KERNEL_BASE% + %KERNEL_LOAD_OFFSET%;
16
17    _start = .;
18
19    /* text/read-only data */
20    /* set the load address to physical MEMBASE */
21    .text : AT(%MEMBASE% + %KERNEL_LOAD_OFFSET%) {
22        KEEP(*(.text.boot))
23        *(.text .text*)
24        *(.gnu.linkonce.t.*)
25    } :code
26
27    . = ALIGN(CONSTANT(MAXPAGESIZE));
28
29    .rodata : {
30        __rodata_start = .;
31        *(.rodata .rodata.* .gnu.linkonce.r.*)
32    } :rodata
33
34    /* trick to force any extra sections to be emitted here */
35    . = .;
36
37    . = ALIGN(CONSTANT(MAXPAGESIZE));
38
39    .data : {
40        __data_start = .;
41        *(.data .data.* .gnu.linkonce.d.*)
42        __ctor_list = .;
43        KEEP(*(.ctors .init_array))
44        __ctor_end = .;
45        __dtor_list = .;
46        KEEP(*(.dtors .fini_array))
47        __dtor_end = .;
48        *(.got*)
49        *(.dynamic)
50    } :data
51
52    . = ALIGN(32 / 8);
53    __data_end = .;
54    __bss_start = .;
55
56    /* uninitialized data (in same segment as writable data) */
57    .bss : {
58        /* regular bss */
59        *(.bss .bss.*)
60        *(.gnu.linkonce.b.*)
61    }
62
63    . = ALIGN(32 / 8);
64    __bss_end = .;
65
66    /* Align the end to ensure anything after the kernel ends up on its own pages */
67    . = ALIGN(CONSTANT(MAXPAGESIZE));
68    _end = .;
69
70    . = %KERNEL_BASE% + %MEMSIZE%;
71    _end_of_ram = .;
72
73    /* Strip unnecessary stuff */
74    /DISCARD/ : { *(.comment .note .eh_frame) }
75}
76
77