From: Joern Rennecke Date: Fri, 30 Nov 2012 18:28:38 +0000 (+0000) Subject: * scripttempl/epiphany_4x4.sc, emulparams/elf32epiphany_4x4.sh: Add. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f204ddb8a84caa7133a20bf63a5cec8d422d52ca;p=binutils-gdb.git * scripttempl/epiphany_4x4.sc, emulparams/elf32epiphany_4x4.sh: Add. * emultempl/epiphanyelf_4x4.em: Likewise. * configure.tgt: Add elf32epiphany_4x4 support. * Makefile.am: Likewise. * Makefile.in: Regenerate. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index fbfff20c63c..4befee4dead 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,11 @@ +2012-11-30 Joern Rennecke + + * scripttempl/epiphany_4x4.sc, emulparams/elf32epiphany_4x4.sh: Add. + * emultempl/epiphanyelf_4x4.em: Likewise. + * configure.tgt: Add elf32epiphany_4x4 support. + * Makefile.am: Likewise. + * Makefile.in: Regenerate. + 2012-11-29 Maciej W. Rozycki * Makefile.in: Regenerate. diff --git a/ld/Makefile.am b/ld/Makefile.am index bda68a80370..8c14295ce17 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -214,6 +214,7 @@ ALL_EMULATION_SOURCES = \ eelf32elmip.c \ eelf32elmipvxworks.c \ eelf32epiphany.c \ + eelf32epiphany_4x4.c \ eelf32fr30.c \ eelf32frv.c \ eelf32frvfd.c \ @@ -1024,6 +1025,10 @@ eelf32elmipvxworks.c: $(srcdir)/emulparams/elf32elmipvxworks.sh \ eelf32epiphany.c: $(srcdir)/emulparams/elf32epiphany.sh \ $(ELF_DEPS) ${GEN_DEPENDS} ${GENSCRIPTS} elf32epiphany "$(tdir_epiphany)" +eelf32epiphany_4x4.c: $(srcdir)/emulparams/elf32epiphany_4x4.sh \ + $(srcdir)/emultempl/elf32.em \ + $(ELF_DEPS) $(srcdir)/scripttempl/epiphany_4x4.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32epiphany_4x4 "$(tdir_epiphany_4x4)" eelf32fr30.c: $(srcdir)/emulparams/elf32fr30.sh \ $(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32fr30 "$(tdir_fr30)" diff --git a/ld/Makefile.in b/ld/Makefile.in index 76c85d11976..98e8f0d82df 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -521,6 +521,7 @@ ALL_EMULATION_SOURCES = \ eelf32elmip.c \ eelf32elmipvxworks.c \ eelf32epiphany.c \ + eelf32epiphany_4x4.c \ eelf32fr30.c \ eelf32frv.c \ eelf32frvfd.c \ @@ -1144,6 +1145,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32elmip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32elmipvxworks.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32epiphany.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32epiphany_4x4.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32fr30.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32frv.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32frvfd.Po@am__quote@ @@ -2496,6 +2498,10 @@ eelf32elmipvxworks.c: $(srcdir)/emulparams/elf32elmipvxworks.sh \ eelf32epiphany.c: $(srcdir)/emulparams/elf32epiphany.sh \ $(ELF_DEPS) ${GEN_DEPENDS} ${GENSCRIPTS} elf32epiphany "$(tdir_epiphany)" +eelf32epiphany_4x4.c: $(srcdir)/emulparams/elf32epiphany_4x4.sh \ + $(srcdir)/emultempl/elf32.em \ + $(ELF_DEPS) $(srcdir)/scripttempl/epiphany_4x4.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32epiphany_4x4 "$(tdir_epiphany_4x4)" eelf32fr30.c: $(srcdir)/emulparams/elf32fr30.sh \ $(ELF_GEN_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32fr30 "$(tdir_fr30)" diff --git a/ld/configure.tgt b/ld/configure.tgt index 3504ee6dc7a..0339754fba7 100644 --- a/ld/configure.tgt +++ b/ld/configure.tgt @@ -158,6 +158,7 @@ d30v-*-*) targ_emul=d30velf; targ_extra_emuls="d30v_e d30v_o" dlx-*-elf*) targ_emul=elf32_dlx ;; epiphany-*-elf) targ_emul=elf32epiphany + targ_extra_emuls="elf32epiphany_4x4" ;; fido*-*-elf*) targ_emul=m68kelf ;; fr30-*-*) targ_emul=elf32fr30 diff --git a/ld/emulparams/elf32epiphany_4x4.sh b/ld/emulparams/elf32epiphany_4x4.sh new file mode 100644 index 00000000000..be03d40c013 --- /dev/null +++ b/ld/emulparams/elf32epiphany_4x4.sh @@ -0,0 +1,53 @@ +MACHINE= +SCRIPT_NAME=epiphany_4x4 +OUTPUT_FORMAT="elf32-epiphany" +TEXT_START_ADDR=0x40 +TEMPLATE_NAME=elf32 +EXTRA_EM_FILE=epiphanyelf_4x4 +OTHER_TEXT_SECTIONS= +OTHER_BSS_SYMBOLS= +OTHER_BSS_END_SYMBOLS= +OTHER_END_SYMBOLS= + +DATA_START_SYMBOLS= + +ARCH=epiphany + +MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" +ENTRY=_start +EMBEDDED=yes + + +NOP=0x01a2 + +#STACK_ADDR=0x72fffff0 +#HEAP_ADDR=0x92100000 +# EPIPHANY does not support .s* sections. +NO_SMALL_DATA=yes + +NO_REL_RELOCS=yes +# See also `include/elf/epiphany.h' + +IVT_ADDR=0x00000000 +IVT_LEN=0x040 + +# ??? This fails: 'Not enough room for program headers, try linking with -N' +#TEXT_START_ADDR=0x00000040 + +#TEXT_START_ADDR=0x72000000 + + +ELFSIZE=32 +MAXPAGESIZE=1 +WRITABLE_RODATA= +#OTHER_RELOCATING_SECTIONS= +#OTHER_READONLY_SECTIONS= +#OTHER_READWRITE_SECTIONS= + +#TEXT_START_SYMBOLS=__INIT_START_ + + + + + + diff --git a/ld/emultempl/epiphanyelf_4x4.em b/ld/emultempl/epiphanyelf_4x4.em new file mode 100644 index 00000000000..9f913ea75c0 --- /dev/null +++ b/ld/emultempl/epiphanyelf_4x4.em @@ -0,0 +1,32 @@ +# This shell script emits a C file. -*- C -*- +# Copyright 1991, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, +# 2004, 2005, 2007, 2008 +# Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +# This file is sourced from elf32.em, and defines extra epiphany-elf +# specific routines. +# + +fragment < RESERVED_CRT0_RAM + RESERVED_CRT0 : {*.o(RESERVED_CRT0) } > RESERVED_CRT0_RAM + RESERVED_CRT0 : {*.o(reserved_crt0) } > RESERVED_CRT0_RAM + + CORE_RAM_0 : {*.o(core_ram_0) } > BANK0_SRAM + CORE_RAM_1 : {*.o(core_ram_1) } > BANK1_SRAM + CORE_RAM_2 : {*.o(core_ram_2) } > BANK2_SRAM + CORE_RAM_3 : {*.o(core_ram_3) } > BANK3_SRAM + + SRAM_SOUTH : {*.o(sram) } > EXTERNAL_SRAM + DRAM_WEST : {*.o(dram) } > EXTERNAL_DRAM_1 + + CORE_INTERNAL : {*.o(core_ram_internal) } /*> INTERNAL_RAM*/ + + /* the newlib (libc and libm) library is maped to the dedicated section */ + + __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*/ + 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) + *umodsi3.o(.text .rodata) _*.o(.text .rodata) + } + + NEW_LIB_WR ADDR(GNU_C_BUILTIN_LIB_RO) + SIZEOF(GNU_C_BUILTIN_LIB_RO) : { lib_a-*.o(.data ) } /* > INTERNAL_RAM*/ + + + __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; + + + /* 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;}} + ${CREATE_PIE+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR:-0} + SIZEOF_HEADERS;}} + ${INITIAL_READONLY_SECTIONS} + .note.gnu.build-id : { *(.note.gnu.build-id) } +EOF + +test -n "${RELOCATING+0}" || unset NON_ALLOC_DYN +test -z "${NON_ALLOC_DYN}" || TEXT_DYNAMIC= +cat > ldscripts/dyntmp.$$ <> ldscripts/dyntmp.$$ <> ldscripts/dyntmp.$$ +cat >> ldscripts/dyntmp.$$ <> ldscripts/dyntmp.$$ +cat >> ldscripts/dyntmp.$$ <> ldscripts/dyntmp.$$ < INTERNAL_RAM*/ =${NOP-0} + + ${TEXT_PLT+${PLT}} + ${TINY_READONLY_SECTION} + + .fini ${RELOCATING+ADDR(.init)+SIZEOF(.init)} ${RELOCATING-0} : + { + ${RELOCATING+${FINI_START}} + KEEP (*(.fini)) + ${RELOCATING+${FINI_END}} + } /*> INTERNAL_RAM*/ =${NOP-0} + + .text ${RELOCATING+ADDR(.fini)+SIZEOF(.fini)} ${RELOCATING-0} : + { + ${RELOCATING+${TEXT_START_SYMBOLS}} + *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*}) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + ${RELOCATING+${OTHER_TEXT_SECTIONS}} + } /*> INTERNAL_RAM */ =${NOP-0} + + ${RELOCATING+PROVIDE (__${ETEXT_NAME} = .);} + ${RELOCATING+PROVIDE (_${ETEXT_NAME} = .);} + ${RELOCATING+PROVIDE (${ETEXT_NAME} = .);} + ${WRITABLE_RODATA-${RODATA}} + .rodata1 ${RELOCATING-0} : { *(.rodata1) } + ${CREATE_SHLIB-${SDATA2}} + ${CREATE_SHLIB-${SBSS2}} + ${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.*) } + + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}} + ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}} + ${CREATE_PIE+${RELOCATING+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}} + + /* 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.*) } + + /* Thread Local Storage sections */ + .tdata ${RELOCATING-0} : { *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*}) } + .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} } + + .preinit_array ${RELOCATING-0} : + { + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_start = .);}} + KEEP (*(.preinit_array)) + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}} + } + .init_array ${RELOCATING-0} : + { + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}} + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}} + } + .fini_array ${RELOCATING-0} : + { + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}} + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}} + } + ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}} + ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}} + .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) } + + ${RELOCATING+${DATARELRO}} + ${OTHER_RELRO_SECTIONS} + ${TEXT_DYNAMIC-${DYNAMIC}} + ${DATA_GOT+${RELRO_NOW+${GOT}}} + ${DATA_GOT+${RELRO_NOW+${GOTPLT}}} + ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}} + ${RELOCATING+${DATA_SEGMENT_RELRO_END}} + ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}} + ${DATA_GOT+${RELRO_NOW-${GOTPLT}}} + + ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}} + + .data ${RELOCATING+ADDR(.dtors)+SIZEOF(.dtors)} ${RELOCATING-0} : + { + ${RELOCATING+${DATA_START_SYMBOLS}} + *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*}) + ${CONSTRUCTING+SORT(CONSTRUCTORS)} + } /*> INTERNAL_RAM*/ + .data1 ${RELOCATING-0} : { *(.data1) } + ${WRITABLE_RODATA+${RODATA}} + ${OTHER_READWRITE_SECTIONS} + ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}} + ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}} + ${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}} + ${SDATA_GOT+${RELOCATING+${OTHER_GOT_SYMBOLS}}} + ${SDATA_GOT+${GOT}} + ${SDATA_GOT+${OTHER_GOT_SECTIONS}} + ${SDATA} + ${OTHER_SDATA_SECTIONS} + ${RELOCATING+${DATA_END_SYMBOLS-${USER_LABEL_PREFIX}_edata = .; PROVIDE (${USER_LABEL_PREFIX}edata = .);}} + /* Align ___bss_start and _end to a multiple of 8 so that we can use strd + to clear bss. N.B., without adding any extra alignment, we would have + to clear the bss byte by byte. */ + ${RELOCATING+. = ALIGN(8);} + ${RELOCATING+___bss_start = .;} + ${RELOCATING+${OTHER_BSS_SYMBOLS}} + ${SBSS} + ${BSS_PLT+${PLT}} + .bss ${RELOCATING+ADDR(.rodata)+SIZEOF(.rodata)} ${RELOCATING-0} : + { + *(.dynbss) + *(.bss${RELOCATING+ .bss.* .gnu.linkonce.b.*}) + *(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 + pad the .data section. */ + ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);} + } /*> INTERNAL_RAM*/ + ${OTHER_BSS_SECTIONS} + ${RELOCATING+${OTHER_BSS_END_SYMBOLS}} + ${RELOCATING+. = ALIGN(${ALIGNMENT});} + ${LARGE_SECTIONS} + ${RELOCATING+. = ALIGN(${ALIGNMENT});} + ${RELOCATING+. = ALIGN(8);} + ${RELOCATING+${OTHER_END_SYMBOLS}} + ${RELOCATING+${END_SYMBOLS-${USER_LABEL_PREFIX}_end = .; PROVIDE (${USER_LABEL_PREFIX}end = .);}} + ${RELOCATING+${DATA_SEGMENT_END}} +EOF + +if test -n "${NON_ALLOC_DYN}"; then + if test -z "${NO_REL_RELOCS}${NO_RELA_RELOCS}"; then + cat ldscripts/dyntmp.$$ + else + if test -z "${NO_REL_RELOCS}"; then + sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d' -e '/^[ ]*\.rela\./d' ldscripts/dyntmp.$$ + fi + if test -z "${NO_RELA_RELOCS}"; then + sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d' -e '/^[ ]*\.rel\./d' ldscripts/dyntmp.$$ + fi + fi + rm -f ldscripts/dyntmp.$$ +fi + +cat <