Using wild match init_array* to include global array init ctor Before: 10 .ctors 00000040 ffff0000001e6b80 00000000401e6b80 DATA 11 .dtors 00000000 ffff0000001e6bc0 00000000401e6bc0 DATA 12 .got 00000060 ffff0000001e6bc0 00000000401e6bc0 DATA 13 .init_array.1 00000470 ffff0000001e6c20 00000000401e6c20 14 .fini_array.1 00000470 ffff0000001e7090 00000000401e7090 15 .dummy_post_data 00000000 ffff0000001e7500 00000000401e7500 DATA 16 .bss 00009460 ffff0000001e8000 00000000401e8000 BSS After: 10 .ctors 000004b0 ffff0000001e6b80 00000000401e6b80 DATA 11 .dtors 00000470 ffff0000001e7030 00000000401e7030 12 .got 00000060 ffff0000001e74a0 00000000401e74a0 DATA 13 .dummy_post_data 00000000 ffff0000001e7500 00000000401e7500 DATA 14 .bss 00009460 ffff0000001e8000 00000000401e8000 BSS Signed-off-by: Lei Wen <leiwen@asrmicro.com>
77 lines
1.6 KiB
Plaintext
77 lines
1.6 KiB
Plaintext
OUTPUT_FORMAT("elf32-m68k", "elf32-m68k", "elf32-m68k")
|
|
/*
|
|
* LK linker script for single segment binaries.
|
|
*/
|
|
PHDRS
|
|
{
|
|
code PT_LOAD FLAGS(5); /* PF_R|PF_X */
|
|
rodata PT_LOAD FLAGS(4); /* PF_R */
|
|
data PT_LOAD FLAGS(6); /* PF_R|PF_W */
|
|
}
|
|
|
|
ENTRY(_start)
|
|
SECTIONS
|
|
{
|
|
. = %KERNEL_BASE% + %KERNEL_LOAD_OFFSET%;
|
|
|
|
_start = .;
|
|
|
|
/* text/read-only data */
|
|
/* set the load address to physical MEMBASE */
|
|
.text : AT(%MEMBASE% + %KERNEL_LOAD_OFFSET%) {
|
|
KEEP(*(.text.boot))
|
|
*(.text .text*)
|
|
*(.gnu.linkonce.t.*)
|
|
} :code
|
|
|
|
. = ALIGN(CONSTANT(MAXPAGESIZE));
|
|
|
|
.rodata : {
|
|
__rodata_start = .;
|
|
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
|
} :rodata
|
|
|
|
/* trick to force any extra sections to be emitted here */
|
|
. = .;
|
|
|
|
. = ALIGN(CONSTANT(MAXPAGESIZE));
|
|
|
|
.data : {
|
|
__data_start = .;
|
|
*(.data .data.* .gnu.linkonce.d.*)
|
|
__ctor_list = .;
|
|
KEEP(*(.ctors .init_array*))
|
|
__ctor_end = .;
|
|
__dtor_list = .;
|
|
KEEP(*(.dtors .fini_array*))
|
|
__dtor_end = .;
|
|
*(.got*)
|
|
*(.dynamic)
|
|
} :data
|
|
|
|
. = ALIGN(32 / 8);
|
|
__data_end = .;
|
|
__bss_start = .;
|
|
|
|
/* uninitialized data (in same segment as writable data) */
|
|
.bss : {
|
|
/* regular bss */
|
|
*(.bss .bss.*)
|
|
*(.gnu.linkonce.b.*)
|
|
}
|
|
|
|
. = ALIGN(32 / 8);
|
|
__bss_end = .;
|
|
|
|
/* Align the end to ensure anything after the kernel ends up on its own pages */
|
|
. = ALIGN(CONSTANT(MAXPAGESIZE));
|
|
_end = .;
|
|
|
|
. = %KERNEL_BASE% + %MEMSIZE%;
|
|
_end_of_ram = .;
|
|
|
|
/* Strip unnecessary stuff */
|
|
/DISCARD/ : { *(.comment .note .eh_frame) }
|
|
}
|
|
|