aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2006-09-16 23:51:50 +0000
committerNick Clifton <nickc@redhat.com>2006-09-16 23:51:50 +0000
commit1c0d3aa6ae7db5d61f1166cf907ed034d0ac4980 (patch)
tree649703aa90d3ccbe80e1442bfbb36380db2c7edd /ld
parent0112cd268b205d8176b8b4d00988a334822956cf (diff)
downloadgdb-1c0d3aa6ae7db5d61f1166cf907ed034d0ac4980.zip
gdb-1c0d3aa6ae7db5d61f1166cf907ed034d0ac4980.tar.gz
gdb-1c0d3aa6ae7db5d61f1166cf907ed034d0ac4980.tar.bz2
Add support for Score target.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog9
-rw-r--r--ld/Makefile.am5
-rw-r--r--ld/Makefile.in5
-rw-r--r--ld/NEWS2
-rw-r--r--ld/configure.tgt1
-rw-r--r--ld/emulparams/scoreelf.sh31
-rw-r--r--ld/emultempl/scoreelf.em74
-rw-r--r--ld/testsuite/ChangeLog6
-rw-r--r--ld/testsuite/ld-elf/merge.d2
-rw-r--r--ld/testsuite/ld-elfcomm/elfcomm.exp9
-rw-r--r--ld/testsuite/ld-srec/srec.exp4
11 files changed, 145 insertions, 3 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 99cc477..281fb56 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2006-09-17 Mei Ligang <ligang@sunnorth.com.cn>
+
+ * emulparams/scoreelf.sh: New file.
+ * emultempl/scoreelf.em: New file.
+ * Makefile.am: Add Score files.
+ * Makefile.in: Regenerate.
+ * configure.tgt: Add Score target.
+ * NEWS: Mention new target support.
+
2006-09-16 Nick Clifton <nickc@redhat.com>
Pedro Alves <pedro_alves@portugalmail.pt>
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 3fad390..34c56ef 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -340,6 +340,7 @@ ALL_EMULATIONS = \
eppcpe.o \
eppclynx.o \
eriscix.o \
+ escoreelf.o \
esh.o \
eshelf32.o \
eshlelf32.o \
@@ -1466,6 +1467,10 @@ eppclynx.c: $(srcdir)/emulparams/ppclynx.sh \
eriscix.c: $(srcdir)/emulparams/riscix.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
${GENSCRIPTS} riscix "$(tdir_riscix)"
+escoreelf.c: $(srcdir)/emulparams/scoreelf.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/scoreelf.em \
+ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} scoreelf "$(tdir_scoreelf)"
esh.c: $(srcdir)/emulparams/sh.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
${GENSCRIPTS} sh "$(tdir_sh)"
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 53aed95..1ac8661 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -564,6 +564,7 @@ ALL_EMULATIONS = \
eppcpe.o \
eppclynx.o \
eriscix.o \
+ escoreelf.o \
esh.o \
eshelf32.o \
eshlelf32.o \
@@ -2277,6 +2278,10 @@ eppclynx.c: $(srcdir)/emulparams/ppclynx.sh \
eriscix.c: $(srcdir)/emulparams/riscix.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
${GENSCRIPTS} riscix "$(tdir_riscix)"
+escoreelf.c: $(srcdir)/emulparams/scoreelf.sh \
+ $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/scoreelf.em \
+ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} scoreelf "$(tdir_scoreelf)"
esh.c: $(srcdir)/emulparams/sh.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/sh.sc ${GEN_DEPENDS}
${GENSCRIPTS} sh "$(tdir_sh)"
diff --git a/ld/NEWS b/ld/NEWS
index 7856bf8..c879293 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -1,4 +1,6 @@
-*- text -*-
+* Add support for Score target.
+
* ELF: Add --dynamic-list option to specify a list of global symbols
whose references shouldn't be bound to the definition within the
shared library, or a list of symbols which should be added to the
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 81ad816..632db8d 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -445,6 +445,7 @@ s390-*-linux*) targ_emul=elf_s390
tdir_elf64_s390=`echo ${targ_alias} | sed -e 's/s390/s390x/'`
fi
;;
+score-*-elf) targ_emul=scoreelf ;;
sh-*-linux*) targ_emul=shlelf_linux
targ_extra_emuls=shelf_linux
targ_extra_libpath=shelf_linux ;;
diff --git a/ld/emulparams/scoreelf.sh b/ld/emulparams/scoreelf.sh
new file mode 100644
index 0000000..e138de2
--- /dev/null
+++ b/ld/emulparams/scoreelf.sh
@@ -0,0 +1,31 @@
+MACHINE=
+SCRIPT_NAME=elf
+TEMPLATE_NAME=elf32
+OUTPUT_FORMAT="elf32-bigscore"
+BIG_OUTPUT_FORMAT="elf32-bigscore"
+LITTLE_OUTPUT_FORMAT="elf32-littlescore"
+GROUP="-lm -lc -lglsim -lgcc -lstdc++"
+
+TEXT_START_ADDR=0x00000000
+MAXPAGESIZE=256
+NONPAGED_TEXT_START_ADDR=0x0400000
+SHLIB_TEXT_START_ADDR=0x5ffe0000
+OTHER_GOT_SYMBOLS='
+ _gp = ALIGN(16) + 0x3ff0;
+'
+
+OTHER_BSS_START_SYMBOLS='_bss_start__ = . + ALIGN(4);'
+OTHER_BSS_END_SYMBOLS='_bss_end__ = . ; __bss_end__ = . ; __end__ = . ;'
+DATA_START_SYMBOLS='_fdata = . ;'
+SDATA_START_SYMBOLS='_sdata_begin = . ;'
+OTHER_BSS_SYMBOLS='
+ _bss_start = ALIGN(4) ;
+'
+# This sets the stack to the top of the simulator memory (2^19 bytes).
+STACK_ADDR=0x8000000
+
+ARCH=score
+MACHINE=
+ENTRY=_start
+EMBEDDED=yes
+GENERATE_SHLIB_SCRIPT=yes
diff --git a/ld/emultempl/scoreelf.em b/ld/emultempl/scoreelf.em
new file mode 100644
index 0000000..a529a1b
--- /dev/null
+++ b/ld/emultempl/scoreelf.em
@@ -0,0 +1,74 @@
+# This shell script emits a C file. -*- C -*-
+# Copyright 2006 Free Software Foundation, Inc.
+# Contributed by:
+# Mei Ligang (ligang@sunnorth.com.cn)
+# Pei-Lin Tsai (pltsai@sunplus.com)
+
+# This file is part of GLD, the Gnu Linker.
+#
+# 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 2 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 score-elf
+# specific routines.
+#
+cat >>e${EMULATION_NAME}.c <<EOF
+
+static void
+gld${EMULATION_NAME}_before_parse ()
+{
+#ifndef TARGET_ /* I.e., if not generic. */
+ ldfile_set_output_arch ("`echo ${ARCH}`");
+#endif /* not TARGET_ */
+ config.dynamic_link = ${DYNAMIC_LINK-true};
+ config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo true ; else echo false ; fi`;
+}
+
+static void
+score_elf_after_open (void)
+{
+ if (strstr (bfd_get_target (output_bfd), "score") == NULL)
+ {
+ /* The score backend needs special fields in the output hash structure.
+ These will only be created if the output format is an score format,
+ hence we do not support linking and changing output formats at the
+ same time. Use a link followed by objcopy to change output formats. */
+ einfo ("%F%X%P: error: cannot change output format whilst linking S+core binaries\n");
+ return;
+ }
+
+ /* Call the standard elf routine. */
+ gld${EMULATION_NAME}_after_open ();
+}
+
+EOF
+
+# Define some shell vars to insert bits of code into the standard elf
+# parse_args and list_options functions.
+#
+PARSE_AND_LIST_PROLOGUE=''
+PARSE_AND_LIST_SHORTOPTS=
+PARSE_AND_LIST_LONGOPTS=''
+PARSE_AND_LIST_OPTIONS=''
+PARSE_AND_LIST_ARGS_CASES=''
+
+# We have our own after_open and before_allocation functions, but they call
+# the standard routines, so give them a different name.
+LDEMUL_AFTER_OPEN=score_elf_after_open
+
+# Replace the elf before_parse function with our own.
+LDEMUL_BEFORE_PARSE=gld"${EMULATION_NAME}"_before_parse
+
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 468c2bd..10cb5f2 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2006-09-17 Mei Ligang <ligang@sunnorth.com.cn>
+
+ * ld-elf/merge.d: Add special case for Score target.
+ * ld-elfcomm/elfcomm.exp: Likewise.
+ * ld-srec/srec.exp: Likewise.
+
2006-09-15 H.J. Lu <hongjiu.lu@intel.com>
* ld-scripts/overlay-size.t: Discard .reginfo sections.
diff --git a/ld/testsuite/ld-elf/merge.d b/ld/testsuite/ld-elf/merge.d
index 12b8458..bc5a7b2 100644
--- a/ld/testsuite/ld-elf/merge.d
+++ b/ld/testsuite/ld-elf/merge.d
@@ -2,7 +2,7 @@
#ld: -T merge.ld
#objdump: -s
#xfail: "arc-*-*" "avr-*-*" "bfin-*-*" "cris*-*-*" "crx-*-*" "d10v-*-*" "d30v-*-*"
-#xfail: "dlx-*-*" "fr30-*-*" "frv-*-*" "hppa*-*-*" "h8300-*-*"
+#xfail: "dlx-*-*" "fr30-*-*" "frv-*-*" "hppa*-*-*" "h8300-*-*" "score-*-*"
#xfail: "i370-*-*" "i860-*-*" "i960-*-*" "ip2k-*-*" "iq2000-*-*"
#xfail: "mcore-*-*" "mn102*-*-*" "mips*-*-*" "ms1-*-*" "msp430-*-*"
#xfail: "or32-*-*" "pj-*-*" "sparc*-*-*" "vax-*-*" "xstormy16-*-*" "xtensa-*-*"
diff --git a/ld/testsuite/ld-elfcomm/elfcomm.exp b/ld/testsuite/ld-elfcomm/elfcomm.exp
index ebcebf1..9b4edb4 100644
--- a/ld/testsuite/ld-elfcomm/elfcomm.exp
+++ b/ld/testsuite/ld-elfcomm/elfcomm.exp
@@ -1,5 +1,5 @@
# Expect script for common symbol tests
-# Copyright 2003, 2005 Free Software Foundation, Inc.
+# Copyright 2003, 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,6 +38,13 @@ if { [which $CC] == 0 } {
untested $test1c2
return
}
+if { [istarget score-*-*] } {
+ untested $test1w1
+ untested $test1w2
+ untested $test1c1
+ untested $test1c2
+ return
+}
proc dump_common1 { testname } {
global exec_output
diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp
index 74e76e6..d98b926 100644
--- a/ld/testsuite/ld-srec/srec.exp
+++ b/ld/testsuite/ld-srec/srec.exp
@@ -1,6 +1,6 @@
# Test linking directly to S-records.
# By Ian Lance Taylor, Cygnus Support.
-# Copyright 1999, 2000, 2001, 2002, 2003
+# Copyright 1999, 2000, 2001, 2002, 2003, 2006
# Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
@@ -391,6 +391,7 @@ setup_xfail "ia64-*-*"
# emulation tries to write pe-specific information to the PE headers
# in the output bfd, but it's not a PE bfd (it's an srec bfd)
setup_xfail "*-*-cygwin*" "*-*-mingw*" "*-*-pe*" "*-*-winnt*"
+setup_xfail "score-*-*"
run_srec_test $test1 "tmpdir/sr1.o tmpdir/sr2.o"
@@ -422,5 +423,6 @@ setup_xfail "alpha*-*-netbsd*"
setup_xfail "hppa*-*-*"
setup_xfail "ia64-*-*"
setup_xfail "*-*-cygwin*" "*-*-mingw*" "*-*-pe*" "*-*-winnt*"
+setup_xfail "score-*-*"
run_srec_test $test2 "tmpdir/sr3.o"