diff options
Diffstat (limited to 'ld/scripttempl/epiphany_4x4.sc')
-rw-r--r-- | ld/scripttempl/epiphany_4x4.sc | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/ld/scripttempl/epiphany_4x4.sc b/ld/scripttempl/epiphany_4x4.sc index d8718e8..41b2b50 100644 --- a/ld/scripttempl/epiphany_4x4.sc +++ b/ld/scripttempl/epiphany_4x4.sc @@ -123,7 +123,7 @@ fi test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=yes if test -z "$GOT"; then if test -z "$SEPARATE_GOTPLT"; then - GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) }" + GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt)} *(.got) }" else GOT=".got ${RELOCATING-0} : { *(.got) }" GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt) }" @@ -138,9 +138,9 @@ if test -z "${NO_SMALL_DATA}"; then { ${RELOCATING+${SBSS_START_SYMBOLS}} ${CREATE_SHLIB+*(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)} - *(.dynsbss) + ${RELOCATING+*(.dynsbss)} *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*}) - *(.scommon) + ${RELOCATING+*(.scommon)} ${RELOCATING+${SBSS_END_SYMBOLS}} }" SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) }" @@ -150,7 +150,7 @@ if test -z "${NO_SMALL_DATA}"; then .sdata ${RELOCATING-0} : { ${RELOCATING+${SDATA_START_SYMBOLS}} - ${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)} + ${RELOCATING+${CREATE_SHLIB+*(.sdata2 .sdata2.* .gnu.linkonce.s2.*)}} *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*}) }" SDATA2=".sdata2 ${RELOCATING-0} : @@ -191,9 +191,9 @@ test "${LARGE_SECTIONS}" = "yes" && OTHER_BSS_SECTIONS=" ${OTHER_BSS_SECTIONS} .lbss ${RELOCATING-0} : { - *(.dynlbss) + ${RELOCATING+*(.dynlbss)} *(.lbss${RELOCATING+ .lbss.* .gnu.linkonce.lb.*}) - *(LARGE_COMMON) + ${RELOCATING+*(LARGE_COMMON)} }" test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS=" .lrodata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} : @@ -259,16 +259,13 @@ cat <<EOF OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}", "${LITTLE_OUTPUT_FORMAT}") OUTPUT_ARCH(${OUTPUT_ARCH}) -${RELOCATING+ENTRY(${ENTRY})} - -${RELOCATING+${EXECUTABLE_SYMBOLS}} -${RELOCATING+${INPUT_FILES}} -${RELOCATING- /* For some reason, the Solaris linker makes bad executables - if gld -r is used and the intermediate file has sections starting - at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld - bug. But for now assigning the zero vmas works. */} +EOF +test -n "${RELOCATING}" && cat <<EOF +ENTRY(${ENTRY}) +${EXECUTABLE_SYMBOLS} +${INPUT_FILES} /* BSP specific*/ __PROG_SIZE_FOR_CORE__ = 1M; @@ -284,8 +281,8 @@ __FIRST_CORE_COL_ = 0x24; PROVIDE (__CORE_ROW_ = __FIRST_CORE_ROW_); PROVIDE (__CORE_COL_ = __FIRST_CORE_COL_); -/* generic don't touch */ -/* used to calculated the slice address in the external memory*/ +/* generic do not touch */ +/* used to calculated the slice address in the external memory */ __CORE_NUM_ = (__CORE_ROW_ - __FIRST_CORE_ROW_ )* __MAX_NUM_CORES_IN_COLS__ + (__CORE_COL_ - __FIRST_CORE_COL_ ) ; @@ -331,10 +328,14 @@ MEMORY } +EOF +cat <<EOF SECTIONS { +EOF +test -n "${RELOCATING}" && cat <<EOF IVT 0 : {*.o(IVT) } > RESERVED_CRT0_RAM RESERVED_CRT0 : {*.o(RESERVED_CRT0) } > RESERVED_CRT0_RAM RESERVED_CRT0 : {*.o(reserved_crt0) } > RESERVED_CRT0_RAM @@ -354,7 +355,7 @@ SECTIONS __new_lib_start_external_ = ( ORIGIN(EXTERNAL_DRAM_0) + __PROG_SIZE_FOR_CORE__ *__CORE_NUM_ ); __new_lib_start_ = DEFINED(__USE_INTERNAL_MEM_FOR_NEW_LIB_) ? ORIGIN(BANK1_SRAM) : __new_lib_start_external_ ; - NEW_LIB_RO ${RELOCATING+__new_lib_start_} : { lib_a-*.o(.text .rodata ) *.o(libgloss_epiphany) } /* > INTERNAL_RAM*/ + NEW_LIB_RO __new_lib_start_ : { lib_a-*.o(.text .rodata) *.o(libgloss_epiphany) } /* > INTERNAL_RAM */ GNU_C_BUILTIN_LIB_RO ADDR(NEW_LIB_RO) + SIZEOF(NEW_LIB_RO) : { *mulsi3.o(.text .rodata) *modsi3.o(.text .rodata) *divsi3.o(.text .rodata) *udivsi3.o(.text .rodata) @@ -366,8 +367,9 @@ SECTIONS __init_start = DEFINED(__USE_INTERNAL_MEM_) ? ORIGIN(BANK1_SRAM) : (ADDR(NEW_LIB_WR) + SIZEOF(NEW_LIB_WR) ) ; __init_start = DEFINED(__USE_INTERNAL_MEM_FOR_NEW_LIB_) ? ADDR(NEW_LIB_WR) + SIZEOF(NEW_LIB_WR) : __init_start; +EOF - +cat <<EOF /* Read-only sections, merged into text segment: */ /*${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}*/ ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}} @@ -467,12 +469,12 @@ fi cat <<EOF - .init __init_start : + .init ${RELOCATING+__init_start} : { ${RELOCATING+${INIT_START}} KEEP (*(.init)) ${RELOCATING+${INIT_END}} - } /*> INTERNAL_RAM*/ =${NOP-0} + } /* ${RELOCATING+ > INTERNAL_RAM} */ =${NOP-0} ${TEXT_PLT+${PLT}} ${TINY_READONLY_SECTION} @@ -482,7 +484,7 @@ cat <<EOF ${RELOCATING+${FINI_START}} KEEP (*(.fini)) ${RELOCATING+${FINI_END}} - } /*> INTERNAL_RAM*/ =${NOP-0} + } /* ${RELOCATING+ > INTERNAL_RAM} */ =${NOP-0} .text ${RELOCATING+ADDR(.fini)+SIZEOF(.fini)} ${RELOCATING-0} : { @@ -491,7 +493,7 @@ cat <<EOF /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) ${RELOCATING+${OTHER_TEXT_SECTIONS}} - } /*> INTERNAL_RAM */ =${NOP-0} + } /* ${RELOCATING+ > INTERNAL_RAM} */ =${NOP-0} ${RELOCATING+PROVIDE (__${ETEXT_NAME} = .);} ${RELOCATING+PROVIDE (_${ETEXT_NAME} = .);} @@ -503,7 +505,7 @@ cat <<EOF ${OTHER_READONLY_SECTIONS} .eh_frame_hdr : { *(.eh_frame_hdr) } .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame)) } - .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } + .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) } /* Adjust the address for the data segment. We want to adjust up to the same address within the page on the next page up. */ @@ -513,7 +515,7 @@ cat <<EOF /* Exception handling */ .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame)) } - .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } + .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) } /* Thread Local Storage sections */ .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) } @@ -528,7 +530,7 @@ cat <<EOF .init_array ${RELOCATING-0} : { ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}} - KEEP (*(SORT(.init_array.*))) + ${RELOCATING+KEEP (*(SORT(.init_array.*)))} KEEP (*(.init_array)) ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}} } @@ -536,7 +538,7 @@ cat <<EOF { ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}} KEEP (*(.fini_array)) - KEEP (*(SORT(.fini_array.*))) + ${RELOCATING+KEEP (*(SORT(.fini_array.*)))} ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}} } ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}} @@ -560,7 +562,7 @@ cat <<EOF ${RELOCATING+${DATA_START_SYMBOLS}} *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*}) ${CONSTRUCTING+SORT(CONSTRUCTORS)} - } /*> INTERNAL_RAM*/ + } /* ${RELOCATING+ > INTERNAL_RAM} */ .data1 ${RELOCATING-0} : { *(.data1) } ${WRITABLE_RODATA+${RODATA}} ${OTHER_READWRITE_SECTIONS} @@ -583,16 +585,16 @@ cat <<EOF ${BSS_PLT+${PLT}} .bss ${RELOCATING+ADDR(.rodata)+SIZEOF(.rodata)} ${RELOCATING-0} : { - *(.dynbss) + ${RELOCATING+*(.dynbss)} *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*}) - *(COMMON) + ${RELOCATING+*(COMMON) /* Align here to ensure that the .bss section occupies space up to _end. Align after .bss to ensure correct alignment even if the .bss section disappears because there are no input sections. - FIXME: Why do we need it? When there is no .bss section, we don't + FIXME: Why do we need it? When there is no .bss section, we do not pad the .data section. */ - ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);} - } /*> INTERNAL_RAM*/ + . = ALIGN(. != 0 ? ${ALIGNMENT} : 1);} + } /* ${RELOCATING+ > INTERNAL_RAM} */ ${OTHER_BSS_SECTIONS} ${RELOCATING+${OTHER_BSS_END_SYMBOLS}} ${RELOCATING+. = ALIGN(${ALIGNMENT});} @@ -603,11 +605,11 @@ cat <<EOF ${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}} ${RELOCATING+${DATA_SEGMENT_END}} - PROVIDE ( __stack_start_ = ORIGIN(EXTERNAL_DRAM_0) + __PROG_SIZE_FOR_CORE__ * __CORE_NUM_ + __PROG_SIZE_FOR_CORE__ - 0x10) ; + ${RELOCATING+PROVIDE ( __stack_start_ = ORIGIN(EXTERNAL_DRAM_0) + __PROG_SIZE_FOR_CORE__ * __CORE_NUM_ + __PROG_SIZE_FOR_CORE__ - 0x10) ;} .stack ${RELOCATING+__stack_start_} : { ${RELOCATING+___stack = .;} *(.stack) } - PROVIDE ( ___heap_start = ORIGIN(EXTERNAL_DRAM_1) + __HEAP_SIZE_FOR_CORE__ * __CORE_NUM_ ); - PROVIDE ( ___heap_end = ORIGIN(EXTERNAL_DRAM_1) + __HEAP_SIZE_FOR_CORE__ * __CORE_NUM_ + __HEAP_SIZE_FOR_CORE__ - 4 ); + ${RELOCATING+PROVIDE ( ___heap_start = ORIGIN(EXTERNAL_DRAM_1) + __HEAP_SIZE_FOR_CORE__ * __CORE_NUM_ );} + ${RELOCATING+PROVIDE ( ___heap_end = ORIGIN(EXTERNAL_DRAM_1) + __HEAP_SIZE_FOR_CORE__ * __CORE_NUM_ + __HEAP_SIZE_FOR_CORE__ - 4 );} EOF if test -n "${NON_ALLOC_DYN}"; then |