# # Unusual variables checked by this code: # NOP - four byte opcode for no-op (defaults to 0) # NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not # empty. # OTHER_READONLY_SECTIONS - other than .text .init .rodata ... # (e.g., .PARISC.milli) # When adding sections, do note that the names of some sections are used # when specifying the start address of the next. # test -z "$ENTRY" && ENTRY=start test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT} test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT} # If we request a big endian toolchain, give a big endian linker test -z "$GOT" && GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt)} *(.got) } ${RELOCATING+ > ${DATA_MEMORY}}" test "${ARC_ENDIAN}" = "big" && OUTPUT_FORMAT=${BIG_OUTPUT_FORMAT} if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi test -z "${ELFSIZE}" && ELFSIZE=32 test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8" test "$LD_FLAG" = "N" && DATA_ADDR=. CTOR=".ctors ${CONSTRUCTING-0} : { ${CONSTRUCTING+${CTOR_START}} /* 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 $OTHER_EXCLUDE_FILES) .ctors)) KEEP (*(SORT(.ctors.*))) KEEP (*(.ctors)) ${CONSTRUCTING+${CTOR_END}} } ${RELOCATING+ > ${DATA_MEMORY}}" DTOR=".dtors ${CONSTRUCTING-0} : { ${CONSTRUCTING+${DTOR_START}} KEEP (*crtbegin*.o(.dtors)) KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) ${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} : { ${RELOCATING+PROVIDE (__sbss_start = .);} ${RELOCATING+PROVIDE (___sbss_start = .);} *(.dynsbss) *(.sbss${RELOCATING+ .sbss.* .gnu.linkonce.sb.*}) *(.scommon) ${RELOCATING+PROVIDE (__sbss_end = .);} ${RELOCATING+PROVIDE (___sbss_end = .);} } ${RELOCATING+ > ${SDATA_MEMORY}}" SBSS2=".sbss2 ${RELOCATING-0} : { *(.sbss2${RELOCATING+ .sbss2.* .gnu.linkonce.sb2.*}) } ${RELOCATING+ > ${SDATA_MEMORY}}" SDATA="/* We want the small data sections together, so single-instruction offsets can access them all, and initialized data all before uninitialized, so we can shorten the on-disk segment size. */ .sdata ${RELOCATING-0} : { ${RELOCATING+${SDATA_START_SYMBOLS}} *(.sdata${RELOCATING+ .sdata.* .gnu.linkonce.s.*}) ${RELOCATING+_edata = .;} ${RELOCATING+PROVIDE (edata = .);} } ${RELOCATING+ > ${SDATA_MEMORY}}" SDATA2=".sdata2 ${RELOCATING-0} : { *(.sdata2${RELOCATING+ .sdata2.* .gnu.linkonce.s2.*}) } ${RELOCATING+ > ${SDATA_MEMORY}}" REL_SDATA=".rel.sdata ${RELOCATING-0} : { *(.rel.sdata${RELOCATING+ .rel.sdata.* .rel.gnu.linkonce.s.*}) } .rela.sdata ${RELOCATING-0} : { *(.rela.sdata${RELOCATING+ .rela.sdata.* .rela.gnu.linkonce.s.*}) }" REL_SBSS=".rel.sbss ${RELOCATING-0} : { *(.rel.sbss${RELOCATING+ .rel.sbss.* .rel.gnu.linkonce.sb.*}) } .rela.sbss ${RELOCATING-0} : { *(.rela.sbss${RELOCATING+ .rela.sbss.* .rela.gnu.linkonce.sb.*}) }" REL_SDATA2=".rel.sdata2 ${RELOCATING-0} : { *(.rel.sdata2${RELOCATING+ .rel.sdata2.* .rel.gnu.linkonce.s2.*}) } .rela.sdata2 ${RELOCATING-0} : { *(.rela.sdata2${RELOCATING+ .rela.sdata2.* .rela.gnu.linkonce.s2.*}) }" REL_SBSS2=".rel.sbss2 ${RELOCATING-0} : { *(.rel.sbss2${RELOCATING+ .rel.sbss2.* .rel.gnu.linkonce.sb2.*}) } .rela.sbss2 ${RELOCATING-0} : { *(.rela.sbss2${RELOCATING+ .rela.sbss2.* .rela.gnu.linkonce.sb2.*}) }" fi # # We provide two emulations: a fixed on that defines some memory banks # and a configurable one that includes a user provided memory definition. # case $GENERIC_BOARD in yes|1|YES) MEMORY_DEF=" /* Get memory banks definition from some user configuration file. This file must be located in some linker directory (search path with -L