diff options
Diffstat (limited to 'ld/scripttempl/pru.sc')
-rw-r--r-- | ld/scripttempl/pru.sc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/ld/scripttempl/pru.sc b/ld/scripttempl/pru.sc index f64e0b7..bba9b6f 100644 --- a/ld/scripttempl/pru.sc +++ b/ld/scripttempl/pru.sc @@ -2,6 +2,9 @@ cat <<EOF OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}") OUTPUT_ARCH(${ARCH}) +EOF + +test -n "${RELOCATING}" && cat <<EOF MEMORY { imem (x) : ORIGIN = $TEXT_ORIGIN, LENGTH = $TEXT_LENGTH @@ -11,10 +14,13 @@ MEMORY __HEAP_SIZE = DEFINED(__HEAP_SIZE) ? __HEAP_SIZE : 32; __STACK_SIZE = DEFINED(__STACK_SIZE) ? __STACK_SIZE : 512; -${RELOCATING+ PROVIDE (_stack_top = ORIGIN(dmem) + LENGTH(dmem)) ; } +PROVIDE (_stack_top = ORIGIN(dmem) + LENGTH(dmem)); + +ENTRY (_start) -${RELOCATING+ENTRY (_start)} +EOF +cat <<EOF SECTIONS { /* Read-only sections, merged into text segment: */ @@ -122,11 +128,11 @@ SECTIONS ${CONSTRUCTING+ KEEP (*(.fini_array))} ${CONSTRUCTING+ __fini_array_end = . ; } - /* DATA memory starts at address 0. So to avoid placing a valid static + ${RELOCATING+/* DATA memory starts at address 0. So to avoid placing a valid static variable at the invalid NULL address, we introduce the .data.atzero section. If CRT can make some use of it - great. Otherwise skip a word. In all cases .data/.bss sections must start at non-zero. */ - . += (. == 0 ? 4 : 0); + . += (. == 0 ? 4 : 0);} ${RELOCATING+ PROVIDE (_data_start = .) ; } *(.data) @@ -143,9 +149,8 @@ SECTIONS .resource_table ${RELOCATING-0} : { - *(.resource_table) KEEP (*(.resource_table)) - } > dmem + } ${RELOCATING+ > dmem} .bss ${RELOCATING-0} : { @@ -154,7 +159,7 @@ SECTIONS ${RELOCATING+ *(.bss.*)} ${RELOCATING+ *(.bss:*)} ${RELOCATING+*(.gnu.linkonce.b*)} - *(COMMON) + ${RELOCATING+*(COMMON)} ${RELOCATING+ PROVIDE (_bss_end = .) ; } } ${RELOCATING+ > dmem} @@ -166,9 +171,9 @@ SECTIONS ${RELOCATING+ PROVIDE (_noinit_end = .) ; } ${RELOCATING+ PROVIDE (_heap_start = .) ; } ${RELOCATING+ . += __HEAP_SIZE ; } - /* Stack is not here really. It will be put at the end of DMEM. + ${RELOCATING+/* Stack is not here really. It will be put at the end of DMEM. But we take into account its size here, in order to allow - for MEMORY overflow checking during link time. */ + for MEMORY overflow checking during link time. */} ${RELOCATING+ . += __STACK_SIZE ; } } ${RELOCATING+ > dmem} |