-cleaned up ld script

git-svn-id: http://moon:8086/svn/mips@113 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2017-01-21 13:07:49 +00:00
parent d1c1a04da7
commit 7a49d1e400
+42 -39
View File
@@ -1,3 +1,12 @@
/* Specify the memory areas */
MEMORY
{
rom : ORIGIN = 0xBFC00000, LENGTH = 0x00002000 /* 8K */
ram : ORIGIN = 0x40000000, LENGTH = 0x04000000 /* 64M */
flash : ORIGIN = 0x00000000, LENGTH = 0x00800000 /* 8M */
io : ORIGIN = 0xA0000000, LENGTH = 0x00800000 /* 8M */
}
stack_ptr = 0x7FFFEFF0;
STARTUP(startup.o)
@@ -5,82 +14,76 @@ INPUT(kernel.o)
SECTIONS
{
/* Read-only sections, merged into text segment: */
PROVIDE (__executable_start = 0x40000000); . = 0x40000000;
.start __executable_start :
.start :
{
start = ALIGN(2);
entry = ALIGN(2);
_entry = ALIGN(2);
__entry = ALIGN(2);
*(.start)
}
/* Kernel text with low-level exception handler */
.exc_vector __executable_start + 0x080 :
} >ram
.exc_vector ORIGIN(ram) + 0x80 :
{
_exc_vect_start = .;
*(.exc_vect)
_exc_vect_end = .;
}
} >ram
.init :
{
KEEP (*(.init))
} =0
.plt : { *(.plt) }
} >ram
.text :
{
_ftext = . ;
*(.text .stub .text.* .gnu.linkonce.t.*)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
*(.mips16.fn.*) *(.mips16.call.*)
} =0
} >ram
.fini :
{
KEEP (*(.fini))
} =0
} >ram
PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } >ram
.rodata1 : { *(.rodata1) } >ram
.sdata2 :
{
*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
}
.sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) }
.eh_frame_hdr : { *(.eh_frame_hdr) }
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
} >ram
.sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } >ram
.eh_frame_hdr : { *(.eh_frame_hdr) } >ram
.eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } >ram
.gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));
/* Exception handling */
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
.eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } >ram
.gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } >ram
/* Thread Local Storage sections */
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } >ram
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } >ram
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
}
} >ram
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
}
} >ram
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
PROVIDE_HIDDEN (__fini_array_end = .);
}
} >ram
.ctors :
{
/* gcc uses crtbegin.o to find the start of
@@ -101,7 +104,7 @@ SECTIONS
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
}
} >ram
.dtors :
{
KEEP (*crtbegin.o(.dtors))
@@ -109,18 +112,18 @@ SECTIONS
KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
}
.jcr : { KEEP (*(.jcr)) }
.data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }
} >ram
.jcr : { KEEP (*(.jcr)) } >ram
.data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } >ram
. = DATA_SEGMENT_RELRO_END (0, .);
.data :
{
_fdata = . ;
*(.data .data.* .gnu.linkonce.d.*)
SORT(CONSTRUCTORS)
}
.data1 : { *(.data1) }
.got.plt : { *(.got.plt) }
} >ram
.data1 : { *(.data1) } >ram
.got.plt : { *(.got.plt) } >ram
. = .;
_gp = ALIGN(16) + 0x7ff0;
.got : { *(.got) }
@@ -130,9 +133,9 @@ SECTIONS
.sdata :
{
*(.sdata .sdata.* .gnu.linkonce.s.*)
}
.lit8 : { *(.lit8) }
.lit4 : { *(.lit4) }
} >ram
.lit8 : { *(.lit8) } >ram
.lit4 : { *(.lit4) } >ram
_edata = .; PROVIDE (edata = .);
__bss_start = .;
_fbss = .;
@@ -141,7 +144,7 @@ SECTIONS
*(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon)
}
} >ram
.bss :
{
*(.dynbss)
@@ -153,7 +156,7 @@ SECTIONS
FIXME: Why do we need it? When there is no .bss section, we don't
pad the .data section. */
. = ALIGN(. != 0 ? 32 / 8 : 1);
}
} >ram
. = ALIGN(32 / 8);
. = ALIGN(32 / 8);
_end = .; PROVIDE (end = .);