aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/scripttempl/elfarc.sc36
-rw-r--r--ld/scripttempl/elfarcv2.sc126
3 files changed, 70 insertions, 98 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 7ff108c..58f9b8b 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-13 Claudiu Zissulescu <claziss@gmail.com>
+
+ * scripttempl/elfarcv2.sc : Allow interrupt vector table to be
+ located at an arbitrary address. Use DWARF.sc file.
+ * scripttempl/elfarc.sc: Use DWARF.sc file.
+
2020-01-07 Alan Modra <amodra@gmail.com>
* testsuite/ld-mips-elf/eh-frame5.s,
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 <<EOF
.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) }
-
- /* 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) }
+. $srcdir/scripttempl/DWARF.sc
+cat <<EOF
/* ARC Extension Sections */
- .arcextmap 0 : { *(.gnu.linkonce.arcextmap.*) }
+ .arcextmap 0 : { *(.arcextmap.*) }
${OTHER_SECTIONS}
${RELOCATING+${OTHER_END_SYMBOLS}}
diff --git a/ld/scripttempl/elfarcv2.sc b/ld/scripttempl/elfarcv2.sc
index 1d5b731..b6cab6c 100644
--- a/ld/scripttempl/elfarcv2.sc
+++ b/ld/scripttempl/elfarcv2.sc
@@ -54,6 +54,16 @@ DTOR=".dtors ${CONSTRUCTING-0} :
${CONSTRUCTING+${DTOR_END}}
} ${RELOCATING+ > ${DATA_MEMORY}}"
+IVT="
+ /* If the 'ivtbase_addr' symbol is defined, it indicates the base address of
+ the interrupt vectors. See description of INT_VECTOR_BASE register. */
+
+ .ivt DEFINED (ivtbase_addr) ? ivtbase_addr : 0x00 :
+ {
+ ${RELOCATING+ PROVIDE (__ivtbase_addr = .); }
+ KEEP (*(.ivt));
+ } ${RELOCATING+ > ${STARTUP_MEMORY}}"
+
if test -z "${NO_SMALL_DATA}"; then
SBSS=".sbss ${RELOCATING-0} :
{
@@ -110,10 +120,6 @@ MEMORY
ICCM : ORIGIN = 0x00000000, LENGTH = ${ICCM_SIZE}
DCCM : ORIGIN = ${RAM_START_ADDR}, LENGTH = ${RAM_SIZE}
}
-
-/* Setup the stack on the top of the data memory bank. */
-PROVIDE (__stack_top = (${RAM_START_ADDR} + ${RAM_SIZE} - 1) & -4);
-PROVIDE (__end_heap = ${RAM_START_ADDR} + ${RAM_SIZE} - 1);
"
;;
esac
@@ -129,15 +135,7 @@ ${RELOCATING+${MEMORY_DEF}}
SECTIONS
{
- .ivt 0x00 :
- {
- KEEP (*(.ivt));
- } ${RELOCATING+ > ${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 <<EOF
/* ARC Extension Sections */
- .arcextmap 0 : { *(.gnu.linkonce.arcextmap.*) }
+ .arcextmap 0 : { *(.arcextmap.*) }
}
EOF