Signed-off-by: LIU Zhiyou <liuzhiyou.cs@xxxxxxxxx> --- ld/Makefile.am | 5 ++++ ld/Makefile.in | 6 ++++ ld/configure.tgt | 1 + ld/emulparams/elf32unicore32.sh | 7 +++++ ld/emultempl/unicore32elf.em | 61 ++++++++++++++++++++++++++++++++++++++++ ld/scripttempl/elf32unicore32.sc | 13 +++++++++ 6 files changed, 93 insertions(+) create mode 100644 ld/emulparams/elf32unicore32.sh create mode 100644 ld/emultempl/unicore32elf.em create mode 100644 ld/scripttempl/elf32unicore32.sc diff --git a/ld/Makefile.am b/ld/Makefile.am index 8c14295..9f28965 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -256,6 +256,7 @@ ALL_EMULATION_SOURCES = \ eelf32tilegx.c \ eelf32tilegx_be.c \ eelf32tilepro.c \ + eelf32unicore32.c \ eelf32vax.c \ eelf32xc16x.c \ eelf32xc16xl.c \ @@ -1199,6 +1200,10 @@ eelf32tilepro.c: $(srcdir)/emulparams/elf32tilepro.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/needrelax.em \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32tilepro "$(tdir_tilepro)" +eelf32unicore32.c: $(srcdir)/emulparams/elf32unicore32.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/unicore32elf.em \ + $(srcdir)/scripttempl/elf32unicore32.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32unicore32 "$(tdir_elf32unicore32)" eelf32vax.c: $(srcdir)/emulparams/elf32vax.sh \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32vax "$(tdir_elf32vax)" diff --git a/ld/Makefile.in b/ld/Makefile.in index 98e8f0d..27f2ddc 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -563,6 +563,7 @@ ALL_EMULATION_SOURCES = \ eelf32tilegx.c \ eelf32tilegx_be.c \ eelf32tilepro.c \ + eelf32unicore32.c \ eelf32vax.c \ eelf32xc16x.c \ eelf32xc16xl.c \ @@ -1187,6 +1188,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32tilegx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32tilegx_be.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32tilepro.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32unicore32.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32vax.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xc16x.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xc16xl.Po@am__quote@ @@ -2672,6 +2674,10 @@ eelf32tilepro.c: $(srcdir)/emulparams/elf32tilepro.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/needrelax.em \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32tilepro "$(tdir_tilepro)" +eelf32unicore32.c: $(srcdir)/emulparams/elf32unicore32.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/unicore32elf.em \ + $(srcdir)/scripttempl/elf32unicore32.sc ${GEN_DEPENDS} + ${GENSCRIPTS} elf32unicore32 "$(tdir_elf32unicore32)" eelf32vax.c: $(srcdir)/emulparams/elf32vax.sh \ $(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} elf32vax "$(tdir_elf32vax)" diff --git a/ld/configure.tgt b/ld/configure.tgt index 61cc346..150d305 100644 --- a/ld/configure.tgt +++ b/ld/configure.tgt @@ -718,6 +718,7 @@ tilegxbe-*-*) targ_emul=elf64tilegx_be targ_extra_emuls="elf64tilegx elf32tilegx elf32tilegx_be" targ_extra_libpath=$targ_extra_emuls ;; tilepro-*-*) targ_emul=elf32tilepro ;; +unicore32-*-*) targ_emul=elf32unicore32 ;; v850*-*-*) targ_emul=v850_rh850 targ_extra_emuls=v850 ;; diff --git a/ld/emulparams/elf32unicore32.sh b/ld/emulparams/elf32unicore32.sh new file mode 100644 index 0000000..a9a2c9c --- /dev/null +++ b/ld/emulparams/elf32unicore32.sh @@ -0,0 +1,7 @@ +SCRIPT_NAME=elf32unicore32 +TEMPLATE_NAME=elf32 +OUTPUT_FORMAT="elf32-unicore32" +ARCH=unicore32 +ENTRY=_start +EXTRA_EM_FILE=unicore32elf +EMBEDDED=yes diff --git a/ld/emultempl/unicore32elf.em b/ld/emultempl/unicore32elf.em new file mode 100644 index 0000000..eeac77b --- /dev/null +++ b/ld/emultempl/unicore32elf.em @@ -0,0 +1,61 @@ +# This shell script emits a C file. -*- C -*- +# Copyright 2013 Free Software Foundation, Inc. +# Contributed by LIU Zhiyou <liuzhiyou.cs@xxxxxxxxx> +# +# 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 cr16-elf +# specific routines. +# +fragment <<EOF + +#include "ldctor.h" + +/* This function is run after all the input files have been opened. */ + +static void +unicore32_elf_after_open (void) +{ + /* Call the standard elf routine. */ + gld${EMULATION_NAME}_after_open (); +} + +static void +unicore32elf_after_parse (void) +{ + after_parse_default (); +} + +/* This is called after the sections have been attached to output + sections, but before any sizes or addresses have been set. */ + +static void +unicore32elf_before_allocation (void) +{ + /* Call the default first. */ + gld${EMULATION_NAME}_before_allocation (); +} + +EOF + +# Put these extra unicore32-elf routines in ld_${EMULATION_NAME}_emulation +# +LDEMUL_AFTER_OPEN=unicore32_elf_after_open +LDEMUL_AFTER_PARSE=unicore32elf_after_parse +LDEMUL_BEFORE_ALLOCATION=unicore32elf_before_allocation diff --git a/ld/scripttempl/elf32unicore32.sc b/ld/scripttempl/elf32unicore32.sc new file mode 100644 index 0000000..0257a55 --- /dev/null +++ b/ld/scripttempl/elf32unicore32.sc @@ -0,0 +1,13 @@ +# Linker Script for MPRC's UNICORE32-ELF32. + +# The next line should be uncommented if it is desired to link +# without libstart.o and directly enter main. + +# ENTRY=_main + +test -z "$ENTRY" && ENTRY=_start +cat <<EOF + +/* Example Linker Script for linking NS CR16 elf32 files. */ + +EOF -- 1.8.1.1