aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2005-10-25 17:40:19 +0000
committerNick Clifton <nickc@redhat.com>2005-10-25 17:40:19 +0000
commit3c9b82baee30a1d3cfeb419643c6363dc9267208 (patch)
treee967c167366034d2a3bef0221e40d5abe7b999b6 /ld
parentfcfa13d2b2b18f83382c2a0cb82c9c7d21be10cb (diff)
downloadgdb-3c9b82baee30a1d3cfeb419643c6363dc9267208.zip
gdb-3c9b82baee30a1d3cfeb419643c6363dc9267208.tar.gz
gdb-3c9b82baee30a1d3cfeb419643c6363dc9267208.tar.bz2
Add support for the Z80 processor family
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog10
-rw-r--r--ld/Makefile.am5
-rw-r--r--ld/Makefile.in5
-rw-r--r--ld/NEWS2
-rw-r--r--ld/configure.tgt2
-rw-r--r--ld/emulparams/z80.sh6
-rw-r--r--ld/emultempl/z80.em85
-rw-r--r--ld/scripttempl/z80.sc35
-rw-r--r--ld/testsuite/ld-checks/checks.exp1
-rw-r--r--ld/testsuite/ld-scripts/align.exp4
10 files changed, 155 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 24ed370..6a395b6 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,13 @@
+2005-10-25 Arnold Metselaar <arnold.metselaar@planet.nl>
+
+ * Makefile.am: Add support for Z80
+ * Makefile.in: Regenerated
+ * configure.tgt: Add z80-*-coff
+ * emulparams/z80.sh: New file.
+ * emultempl/z80.em: New file.
+ * scripttempl/z80.sc New file.
+ * NEWS: Mention this new support.
+
2005-10-25 Alan Modra <amodra@bigpond.net.au>
* po/ld.pot: Regenerate.
diff --git a/ld/Makefile.am b/ld/Makefile.am
index bada2c3..85d04bf 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -372,6 +372,7 @@ ALL_EMULATIONS = \
ew65.o \
ez8001.o \
eelf32frvfd.o \
+ ez80.o \
ez8002.o
ALL_64_EMULATIONS = \
@@ -1537,6 +1538,10 @@ ev850.c: $(srcdir)/emulparams/v850.sh \
ew65.c: $(srcdir)/emulparams/w65.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/w65.sc ${GEN_DEPENDS}
${GENSCRIPTS} w65 "$(tdir_w65)"
+ez80.c: $(srcdir)/emulparams/z80.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/emultempl/z80.em \
+ $(srcdir)/scripttempl/z80.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} z80 "$(tdir_z80)"
ez8001.c: $(srcdir)/emulparams/z8001.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8000.sc ${GEN_DEPENDS}
${GENSCRIPTS} z8001 "$(tdir_z8001)"
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 0acc191..8cda161 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -595,6 +595,7 @@ ALL_EMULATIONS = \
ew65.o \
ez8001.o \
eelf32frvfd.o \
+ ez80.o \
ez8002.o
ALL_64_EMULATIONS = \
@@ -2341,6 +2342,10 @@ ev850.c: $(srcdir)/emulparams/v850.sh \
ew65.c: $(srcdir)/emulparams/w65.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/w65.sc ${GEN_DEPENDS}
${GENSCRIPTS} w65 "$(tdir_w65)"
+ez80.c: $(srcdir)/emulparams/z80.sh \
+ $(srcdir)/emultempl/generic.em $(srcdir)/emultempl/z80.em \
+ $(srcdir)/scripttempl/z80.sc ${GEN_DEPENDS}
+ ${GENSCRIPTS} z80 "$(tdir_z80)"
ez8001.c: $(srcdir)/emulparams/z8001.sh \
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/z8000.sc ${GEN_DEPENDS}
${GENSCRIPTS} z8001 "$(tdir_z8001)"
diff --git a/ld/NEWS b/ld/NEWS
index bd4e14d..f38fb18 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -1,5 +1,7 @@
-*- text -*-
+* Support for the Z80 processor family has been added.
+
* Add support for the "@<file>" syntax to the command line, so that extra
switches can be read from <file>.
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 23c7b2d..9f1dc8e 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -555,6 +555,8 @@ xstormy16-*-*) targ_emul=elf32xstormy16
;;
xtensa-*-*) targ_emul=elf32xtensa
;;
+z80-*-coff) targ_emul=z80
+ ;;
z8k-*-coff) targ_emul=z8002; targ_extra_emuls=z8001
;;
*-*-ieee*) targ_emul=vanilla
diff --git a/ld/emulparams/z80.sh b/ld/emulparams/z80.sh
new file mode 100644
index 0000000..a4fdbd5
--- /dev/null
+++ b/ld/emulparams/z80.sh
@@ -0,0 +1,6 @@
+SCRIPT_NAME=z80
+OUTPUT_FORMAT="coff-z80"
+OUTPUT_ARCH="z80"
+TEXT_START_ADDR=0x100
+EXTRA_EM_FILE=z80
+ARCH=z80
diff --git a/ld/emultempl/z80.em b/ld/emultempl/z80.em
new file mode 100644
index 0000000..d36c943
--- /dev/null
+++ b/ld/emultempl/z80.em
@@ -0,0 +1,85 @@
+# This shell script emits C code -*- C -*-
+# to keep track of the machine type of Z80 object files
+# It does some substitutions.
+
+LDEMUL_BEFORE_PARSE=gldz80_before_parse
+LDEMUL_RECOGNIZED_FILE=gldz80_recognized_file
+LDEMUL_AFTER_OPEN=gldz80_after_open
+
+cat >>e${EMULATION_NAME}.c <<EOF
+/* --- \begin{z80.em} */
+/* Codes for machine types, bitwise or gives the code to use for the
+ output. */
+#define M_Z80STRICT 1
+#define M_Z80 3
+#define M_Z80FULL 7
+#define M_R800 11
+#define M_Z80ANY 15
+
+/* Bitwise or of the machine types seen so far. */
+static int result_mach_type;
+
+static void
+${LDEMUL_BEFORE_PARSE} (void)
+{
+#ifndef TARGET_ /* I.e., if not generic. */
+ ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown);
+#endif /* not TARGET_ */
+ result_mach_type = M_Z80STRICT;
+}
+
+
+/* Update result_mach_type. */
+static bfd_boolean
+${LDEMUL_RECOGNIZED_FILE} (lang_input_statement_type *entry)
+{
+ unsigned long mach_type;
+
+ mach_type = bfd_get_mach (entry->the_bfd);
+ switch (mach_type)
+ {
+ case bfd_mach_z80strict:
+ result_mach_type |= M_Z80STRICT;
+ break;
+ case bfd_mach_z80:
+ result_mach_type |= M_Z80;
+ break;
+ case bfd_mach_z80full:
+ result_mach_type |= M_Z80FULL;
+ break;
+ case bfd_mach_r800:
+ result_mach_type |= M_R800;
+ break;
+ default:
+ result_mach_type |= M_Z80ANY;
+ }
+ return FALSE;
+}
+
+/* Set the machine type of the output file based on result_mach_type. */
+static void
+gldz80_after_open (void)
+{
+ unsigned long mach_type;
+
+ switch (result_mach_type)
+ {
+ case M_Z80STRICT:
+ mach_type = bfd_mach_z80strict;
+ break;
+ case M_Z80:
+ mach_type = bfd_mach_z80;
+ break;
+ case M_Z80FULL:
+ mach_type = bfd_mach_z80full;
+ break;
+ case M_R800:
+ mach_type = bfd_mach_r800;
+ break;
+ default:
+ mach_type = 0;
+ }
+ bfd_set_arch_mach (output_bfd, bfd_arch_z80, mach_type);
+}
+/* --- \end{z80.em} */
+EOF
diff --git a/ld/scripttempl/z80.sc b/ld/scripttempl/z80.sc
new file mode 100644
index 0000000..8c004da
--- /dev/null
+++ b/ld/scripttempl/z80.sc
@@ -0,0 +1,35 @@
+if [ x${LD_FLAG} = x ]
+then
+cat << EOF
+/* Create a cp/m executable; load and execute at 0x100. */
+OUTPUT_FORMAT("binary")
+. = 0x100;
+__Ltext = .;
+ENTRY (__Ltext)
+EOF
+else
+ echo "OUTPUT_FORMAT(\"${OUTPUT_FORMAT}\")"
+fi
+cat <<EOF
+OUTPUT_ARCH("${OUTPUT_ARCH}")
+SECTIONS
+{
+.text : {
+ *(.text)
+ *(text)
+ ${RELOCATING+ __Htext = .;}
+ }
+.data : {
+ ${RELOCATING+ __Ldata = .;}
+ *(.data)
+ *(data)
+ ${RELOCATING+ __Hdata = .;}
+ }
+.bss : {
+ ${RELOCATING+ __Lbss = .;}
+ *(.bss)
+ *(bss)
+ ${RELOCATING+ __Hbss = .;}
+ }
+}
+EOF
diff --git a/ld/testsuite/ld-checks/checks.exp b/ld/testsuite/ld-checks/checks.exp
index f18baca..5e2750d 100644
--- a/ld/testsuite/ld-checks/checks.exp
+++ b/ld/testsuite/ld-checks/checks.exp
@@ -54,6 +54,7 @@ proc section_check {} {
# Perform the equivalent of invoking ld_simple_link
# except that we need to massage the output futher.
+ verbose -log "$ld -o tmpdir/asm.x $ldflags tmpdir/asm.o"
catch "exec $ld -o tmpdir/asm.x $ldflags tmpdir/asm.o" exec_output
set exec_output [prune_warnings $exec_output]
diff --git a/ld/testsuite/ld-scripts/align.exp b/ld/testsuite/ld-scripts/align.exp
index 8bcd222..43369d0 100644
--- a/ld/testsuite/ld-scripts/align.exp
+++ b/ld/testsuite/ld-scripts/align.exp
@@ -42,7 +42,11 @@ if ![ld_simple_link $ld tmpdir/align "-T $srcdir/$subdir/align.t tmpdir/align.o"
}
if ![is_aout_format] {
+ # The z80-coff port defaults to a "binary" like output
+ # file format which does not include a data section.
+ setup_xfail "z80-*-coff"
run_dump_test align2a
+ setup_xfail "z80-*-coff"
run_dump_test align2b
}
run_dump_test align2c