Commit f05f3757 authored by Alessandro Rubini's avatar Alessandro Rubini

arch/lm32/ram.ld: remove all cruft

Remove all unneeded stuff from the linker script. Now the script only
includes what is actually used: it is easier to understand and change
(we'll add some local ELF sections), and it makes a better reference
for possible porting to a different architecture.

This commit also moves the default libraries from the linker script
itself to the LDFLAGS in Makefile, where they really belong.

CONFIG_DETERMINISTIC_BINARY confirms this makes no difference in
the generated binary (nor the ELF FWIW).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 583ab278
...@@ -129,3 +129,4 @@ scripts_basic config %config: ...@@ -129,3 +129,4 @@ scripts_basic config %config:
$(MAKE) -f Makefile.kconfig $@ $(MAKE) -f Makefile.kconfig $@
.config: silentoldconfig .config: silentoldconfig
...@@ -36,114 +36,24 @@ MEMORY ...@@ -36,114 +36,24 @@ MEMORY
SECTIONS SECTIONS
{ {
.boot : { *(.boot) } > ram
.boot : { *(.boot) } > ram .text : { *(.text .text.*) } > ram =0
/* Code */ .rodata : { *(.rodata .rodata.*) } > ram
.text :
{
. = ALIGN(4);
_ftext = .;
_ftext_rom = LOADADDR(.text);
*(.text .stub .text.* .gnu.linkonce.t.*)
*(.gnu.warning)
KEEP (*(.init))
KEEP (*(.fini))
/* Constructors and destructors */
KEEP (*crtbegin*.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
KEEP (*crtbegin*.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
KEEP (*(.jcr))
_etext = .;
} > ram =0
/* Exception handlers */ .data : {
.eh_frame_hdr : { *(.eh_frame_hdr) } > ram *(.data .data.*)
.eh_frame : { KEEP (*(.eh_frame)) } > ram _gp = ALIGN(16) + 0x7ff0; /* FIXME: what is this? */
.gcc_except_table : { *(.gcc_except_table) *(.gcc_except_table.*) } > ram } > ram
/* Read-only data */ .bss : {
.rodata : _fbss = .;
{ *(.bss .bss.*)
. = ALIGN(4); *(COMMON)
_frodata = .; _ebss = .;
_frodata_rom = LOADADDR(.rodata); } > ram
*(.rodata .rodata.* .gnu.linkonce.r.*)
*(.rodata1)
_erodata = .;
} > ram
/* Data */ /* First location in stack is highest address in RAM */
.data : PROVIDE(_fstack = ORIGIN(ram) + LENGTH(ram) - 4);
{
. = ALIGN(4);
_fdata = .;
_fdata_rom = LOADADDR(.data);
*(.data .data.* .gnu.linkonce.d.*)
*(.data1)
SORT(CONSTRUCTORS)
_gp = ALIGN(16) + 0x7ff0;
*(.sdata .sdata.* .gnu.linkonce.s.*)
_edata = .;
} > ram
/* BSS */
.bss :
{
. = ALIGN(4);
_fbss = .;
*(.dynsbss)
*(.sbss .sbss.* .gnu.linkonce.sb.*)
*(.scommon)
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = .;
_end = .;
PROVIDE (end = .);
} > ram
/* First location in stack is highest address in RAM */
PROVIDE(_fstack = ORIGIN(ram) + LENGTH(ram) - 4);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment