From 8cb31badff78ca9cdda0c90ba53b6cfd7d8bd423 Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Mon, 13 Jan 2020 11:16:47 +0200 Subject: [ARC][committed] Use DWARF.sc in elf linker script templates. xxxx-xx-xx Claudiu Zissulescu * elfarcv2.sc : Allow interrupt vector table to be located at an arbitrary address. Use DWARF.sc file. * elfarc.sc: Use DWARF.sc file. --- ld/scripttempl/elfarc.sc | 36 ++----------- ld/scripttempl/elfarcv2.sc | 126 +++++++++++++++++++++------------------------ 2 files changed, 64 insertions(+), 98 deletions(-) (limited to 'ld/scripttempl') diff --git a/ld/scripttempl/elfarc.sc b/ld/scripttempl/elfarc.sc index 0390e05..8851c77 100644 --- a/ld/scripttempl/elfarc.sc +++ b/ld/scripttempl/elfarc.sc @@ -408,40 +408,14 @@ cat < ${STARTUP_MEMORY}} - - .startup 0x100: - { - KEEP (*crt0.o(.text.__startup)) - } ${RELOCATING+ > ${STARTUP_MEMORY}} + ${RELOCATING+${IVT}} /* Read-only sections, merged into text segment: */ ${TEXT_DYNAMIC+${DYNAMIC}} @@ -175,35 +173,21 @@ SECTIONS .rel.bss ${RELOCATING-0} : { *(.rel.bss${RELOCATING+ .rel.bss.* .rel.gnu.linkonce.b.*}) } .rela.bss ${RELOCATING-0} : { *(.rela.bss${RELOCATING+ .rela.bss.* .rela.gnu.linkonce.b.*}) } - .jcr : { KEEP (*(.jcr)) } ${RELOCATING+> ${TEXT_MEMORY}} - .eh_frame : { KEEP (*(.eh_frame)) } ${RELOCATING+> ${TEXT_MEMORY}} - .gcc_except_table : { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) } ${RELOCATING+> ${TEXT_MEMORY}} - .plt : { *(.plt) } ${RELOCATING+> ${TEXT_MEMORY}} - .jlitab : - { - ${RELOCATING+${JLI_START_TABLE}} - ${RELOCATING+jlitab*.o:(.jlitab*)} - *(.jlitab${RELOCATING+*}) - } ${RELOCATING+> ${TEXT_MEMORY}} - - .rodata ${RELOCATING-0} : + .text ${RELOCATING-0} : { - *(.rodata) ${RELOCATING+*(.rodata.*)} ${RELOCATING+*(.gnu.linkonce.r.*)} - } ${RELOCATING+> ${TEXT_MEMORY}} - - .rodata1 ${RELOCATING-0} : { *(.rodata1) } ${RELOCATING+> ${TEXT_MEMORY}} + ${RELOCATING+${TEXT_START_SYMBOLS}} - .init ${RELOCATING-0} : - { + ${RELOCATING+ . = ALIGN(4);} ${RELOCATING+${INIT_START}} KEEP (*(SORT_NONE(.init))) ${RELOCATING+${INIT_END}} - } ${RELOCATING+ > ${TEXT_MEMORY}} =${NOP-0} - .text ${RELOCATING-0} : - { - ${RELOCATING+${TEXT_START_SYMBOLS}} + /* Start here after reset. */ + ${RELOCATING+ . = ALIGN(4);} + KEEP (*crt0.o(.text.__startup)) + /* Remaining code. */ + ${RELOCATING+ . = ALIGN(4);} *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*}) /* .gnu.warning sections are handled specially by elf.em. */ *(.gnu.warning) @@ -223,6 +207,39 @@ SECTIONS ${RELOCATING+PROVIDE (etext = .);} } ${RELOCATING+ > ${TEXT_MEMORY}} =${NOP-0} + .jcr ${RELOCATING-0} : + { + KEEP (*(.jcr)) + } ${RELOCATING+> ${TEXT_MEMORY}} + + .eh_frame ${RELOCATING-0} : + { + KEEP (*(.eh_frame)) + } ${RELOCATING+> ${TEXT_MEMORY}} + + .gcc_except_table ${RELOCATING-0} : + { + *(.gcc_except_table) *(.gcc_except_table.*) + } ${RELOCATING+> ${TEXT_MEMORY}} + + .plt ${RELOCATING-0} : + { + *(.plt) + } ${RELOCATING+> ${TEXT_MEMORY}} + + .jlitab ${RELOCATING-0} : + { + ${RELOCATING+${JLI_START_TABLE}} + jlitab*.o:(.jlitab*) *(.jlitab*) + } ${RELOCATING+> ${TEXT_MEMORY}} + + .rodata ${RELOCATING-0} : + { + *(.rodata) ${RELOCATING+*(.rodata.*)} ${RELOCATING+*(.gnu.linkonce.r.*)} + } ${RELOCATING+> ${TEXT_MEMORY}} + + .rodata1 ${RELOCATING-0} : { *(.rodata1) } ${RELOCATING+> ${TEXT_MEMORY}} + ${RELOCATING+${OTHER_READONLY_SECTIONS}} /* Start of the data section image in ROM. */ @@ -271,6 +288,8 @@ SECTIONS ${RELOCATING+ PROVIDE (__start_heap = .) ; } } ${RELOCATING+ > ${DATA_MEMORY}} + ${RELOCATING+ PROVIDE (__stack_top = (ORIGIN (${DATA_MEMORY}) + LENGTH (${DATA_MEMORY}) - 1) & -4);} + ${RELOCATING+ PROVIDE (__end_heap = ORIGIN (${DATA_MEMORY}) + LENGTH (${DATA_MEMORY}) - 1);} /* Stabs debugging sections. */ .stab 0 : { *(.stab) } @@ -281,40 +300,13 @@ SECTIONS .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } +EOF - /* 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${RELOCATING+ .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) } - - /* DWARF 3 */ - .debug_pubtypes 0 : { *(.debug_pubtypes) } - .debug_ranges 0 : { *(.debug_ranges) } - - /* DWARF Extension. */ - .debug_macro 0 : { *(.debug_macro) } +. $srcdir/scripttempl/DWARF.sc +cat <