pico430prog/test/link.ld

168 lines
4.4 KiB
Plaintext

OUTPUT_FORMAT("elf32-msp430","elf32-msp430","elf32-msp430")
OUTPUT_ARCH(msp:14)
ENTRY(_start)
MEMORY
{
data (rwx) : ORIGIN = 0x0200, LENGTH = 0x100
text (rx) : ORIGIN = 0xf800, LENGTH = 0x800 - 0x20
vectors (rw) : ORIGIN = 0xffe0, LENGTH = 0x20
}
SECTIONS {
/* Internal text space. */
.text :
{
. = ALIGN(2);
*(SORT_NONE(.init))
*(SORT_NONE(.init0)) /* Start here after reset. */
*(SORT_NONE(.init1))
*(SORT_NONE(.init2)) /* Copy data loop */
*(SORT_NONE(.init3))
*(SORT_NONE(.init4)) /* Clear bss */
*(SORT_NONE(.init5))
*(SORT_NONE(.init6)) /* C++ constructors. */
*(SORT_NONE(.init7))
*(SORT_NONE(.init8))
*(SORT_NONE(.init9)) /* Call main(). */
__ctors_start = . ;
*(.ctors)
__ctors_end = . ;
__dtors_start = . ;
*(.dtors)
__dtors_end = . ;
. = ALIGN(2);
*(.lower.text.* .lower.text)
. = ALIGN(2);
*(.text)
. = ALIGN(2);
*(.text.*)
. = ALIGN(2);
*(.text:*)
. = ALIGN(2);
*(SORT_NONE(.fini9))
*(SORT_NONE(.fini8))
*(SORT_NONE(.fini7))
*(SORT_NONE(.fini6)) /* C++ destructors. */
*(SORT_NONE(.fini5))
*(SORT_NONE(.fini4))
*(SORT_NONE(.fini3))
*(SORT_NONE(.fini2))
*(SORT_NONE(.fini1))
*(SORT_NONE(.fini0)) /* Infinite loop after program termination. */
*(SORT_NONE(.fini))
_etext = .;
} > text =0xff
.rodata :
{
. = ALIGN(2);
*(.lower.rodata.* .lower.rodata)
. = ALIGN(2);
*(.plt)
*(.rodata .rodata.* .gnu.linkonce.r.* .const .const:*)
*(.rodata1)
*(.eh_frame_hdr)
KEEP (*(.eh_frame))
KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
PROVIDE (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE (__preinit_array_end = .);
PROVIDE (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE (__init_array_end = .);
PROVIDE (__fini_array_start = .);
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
PROVIDE (__fini_array_end = .);
LONG(0); /* Sentinel. */
/* gcc uses crtbegin.o to find the start of the constructors, so
we make sure it is first. Because this is a wildcard, it
doesn't matter if the user does not actually link against
crtbegin.o; the linker won't look for a file to match a
wildcard. The wildcard also means that it doesn't matter which
directory crtbegin.o is in. */
KEEP (*crtbegin*.o(.ctors))
/* We don't want to include the .ctor section from from the
crtend.o file until after the sorted ctors. The .ctor section
from the crtend file contains the end of ctors marker and it
must be last */
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))
} > text =0xff
.vectors :
{
PROVIDE (__vectors_start = .) ;
*(.vectors*)
_vectors_end = . ;
} > vectors =0xff
.data :
{
PROVIDE (__data_start = .) ;
PROVIDE (__datastart = .) ;
. = ALIGN(2);
KEEP (*(.jcr))
*(.data.rel.ro.local) *(.data.rel.ro*)
*(.dynamic)
. = ALIGN(2);
*(.lower.data.* .lower.data)
*(.data)
*(.data.*)
*(.gnu.linkonce.d*)
KEEP (*(.gnu.linkonce.d.*personality*))
*(.data1)
*(.got.plt) *(.got)
. = ALIGN(2);
*(.sdata .sdata.* .gnu.linkonce.s.*)
. = ALIGN(2);
_edata = . ;
} > data AT> text
.bss SIZEOF(.data) + ADDR(.data) :
{
. = ALIGN(2);
PROVIDE (__bss_start = .) ;
*(.lower.bss.* .lower.bss)
. = ALIGN(2);
*(.bss)
*(COMMON)
PROVIDE (__bss_end = .) ;
_end = . ;
} > data
.noinit SIZEOF(.bss) + ADDR(.bss) :
{
PROVIDE (__noinit_start = .) ;
*(.noinit)
*(COMMON)
PROVIDE (__noinit_end = .) ;
_end = . ;
} > data
.fill :
{
FILL(0xffffffff);
. = ORIGIN(vectors);
} > text
.MP430.attributes 0 :
{
KEEP (*(.MSP430.attributes))
KEEP (*(.gnu.attributes))
KEEP (*(__TI_build_attributes))
}
PROVIDE (__stack = 0x2fe) ;
PROVIDE (__data_start_rom = _etext) ;
PROVIDE (__data_end_rom = _etext + SIZEOF (.data)) ;
PROVIDE (__noinit_start_rom = _etext + SIZEOF (.data)) ;
PROVIDE (__noinit_end_rom = _etext + SIZEOF (.data) + SIZEOF (.noinit)) ;
PROVIDE (__subdevice_has_heap = 0) ;
}