aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorSergey Belyashov <sergey.belyashov@gmail.com>2020-02-19 17:46:10 +0000
committerNick Clifton <nickc@redhat.com>2020-02-19 17:46:10 +0000
commitfcaaac0a0d3d46e3c59f87c1445852ac77b6c118 (patch)
tree9d63c6fc90566b5e2110d4e3bef593c1f91f205e /ld
parentd3c22fa82e2f9098ad5a0158a73f07db12426fff (diff)
downloadgdb-fcaaac0a0d3d46e3c59f87c1445852ac77b6c118.zip
gdb-fcaaac0a0d3d46e3c59f87c1445852ac77b6c118.tar.gz
gdb-fcaaac0a0d3d46e3c59f87c1445852ac77b6c118.tar.bz2
Various fixes for the Z80 support.
PR 25537 ld * emultempl/z80.em: Remove machine compatability checking. PR 25517 * testsuite/ld-z80/arch_ez80_adl.d: Update command line. * testsuite/ld-z80/arch_ez80_z80.d: Likewise. * testsuite/ld-z80/arch_r800.d: Likewise. * testsuite/ld-z80/arch_z180.d: Likewise. * testsuite/ld-z80/arch_z80n.d: Likewise. * testsuite/ld-z80/comb_arch_ez80_z80.d: Likewise. * testsuite/ld-z80/comb_arch_z180_z80.d: Likewise. * testsuite/ld-z80/comb_arch_z80_ez80.d: Likewise. * testsuite/ld-z80/comb_arch_z80_z180.d: Likewise. * testsuite/ld-z80/comb_arch_z80_z80n.d: Likewise. * testsuite/ld-z80/relocs_b_ez80.d: Likewise. * testsuite/ld-z80/relocs_b_z80.d: Likewise. * testsuite/ld-z80/relocs_f_ez80.d: Likewise. * testsuite/ld-z80/relocs_f_z80.d: Likewise. * testsuite/ld-z80/relocs_f_z80n.d: Likewise. bfd * cpu-z80.c: Add machine type compatibility checking. gas * config/tc-z80.c (md_parse_option): Do not use an underscore prefix for local labels in SDCC compatability mode. (z80_start_line_hook): Remove SDCC dollar label support. * testsuite/gas/z80/sdcc.d: Update expected disassembly. * testsuite/gas/z80/sdcc.s: Likewise. * config/tc-z80.c: Add -march option. * doc/as.texi: Update Z80 documentation. * doc/c-z80.texi: Likewise. * testsuite/gas/z80/ez80_adl_all.d: Update command line. * testsuite/gas/z80/ez80_adl_suf.d: Likewise. * testsuite/gas/z80/ez80_pref_dis.d: Likewise. * testsuite/gas/z80/ez80_z80_all.d: Likewise. * testsuite/gas/z80/ez80_z80_suf.d: Likewise. * testsuite/gas/z80/gbz80_all.d: Likewise. * testsuite/gas/z80/r800_extra.d: Likewise. * testsuite/gas/z80/r800_ii8.d: Likewise. * testsuite/gas/z80/r800_z80_doc.d: Likewise. * testsuite/gas/z80/sdcc.d: Likewise. * testsuite/gas/z80/z180.d: Likewise. * testsuite/gas/z80/z180_z80_doc.d: Likewise. * testsuite/gas/z80/z80_doc.d: Likewise. * testsuite/gas/z80/z80_ii8.d: Likewise. * testsuite/gas/z80/z80_in_f_c.d: Likewise. * testsuite/gas/z80/z80_op_ii_ld.d: Likewise. * testsuite/gas/z80/z80_out_c_0.d: Likewise. * testsuite/gas/z80/z80_sli.d: Likewise. * testsuite/gas/z80/z80n_all.d: Likewise. * testsuite/gas/z80/z80n_reloc.d: Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog24
-rw-r--r--ld/emultempl/z80.em122
-rw-r--r--ld/testsuite/ld-z80/arch_ez80_adl.d5
-rw-r--r--ld/testsuite/ld-z80/arch_ez80_z80.d5
-rw-r--r--ld/testsuite/ld-z80/arch_r800.d5
-rw-r--r--ld/testsuite/ld-z80/arch_z180.d5
-rw-r--r--ld/testsuite/ld-z80/arch_z80n.d5
-rw-r--r--ld/testsuite/ld-z80/comb_arch_ez80_z80.d4
-rw-r--r--ld/testsuite/ld-z80/comb_arch_z180_z80.d4
-rw-r--r--ld/testsuite/ld-z80/comb_arch_z80_ez80.d4
-rw-r--r--ld/testsuite/ld-z80/comb_arch_z80_z180.d4
-rw-r--r--ld/testsuite/ld-z80/comb_arch_z80_z80n.d4
-rw-r--r--ld/testsuite/ld-z80/relocs_b_ez80.d5
-rw-r--r--ld/testsuite/ld-z80/relocs_b_z80.d4
-rw-r--r--ld/testsuite/ld-z80/relocs_f_ez80.d5
-rw-r--r--ld/testsuite/ld-z80/relocs_f_z80.d6
-rw-r--r--ld/testsuite/ld-z80/relocs_f_z80n.d2
17 files changed, 77 insertions, 136 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index aa655d7..29348f1 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,27 @@
+2020-02-19 Sergey Belyashov <sergey.belyashov@gmail.com>
+
+ PR 25537
+ * emultempl/z80.em: Remove machine compatability checking.
+
+2020-02-19 Sergey Belyashov <sergey.belyashov@gmail.com>
+
+ PR 25517
+ * testsuite/ld-z80/arch_ez80_adl.d: Update command line.
+ * testsuite/ld-z80/arch_ez80_z80.d: Likewise.
+ * testsuite/ld-z80/arch_r800.d: Likewise.
+ * testsuite/ld-z80/arch_z180.d: Likewise.
+ * testsuite/ld-z80/arch_z80n.d: Likewise.
+ * testsuite/ld-z80/comb_arch_ez80_z80.d: Likewise.
+ * testsuite/ld-z80/comb_arch_z180_z80.d: Likewise.
+ * testsuite/ld-z80/comb_arch_z80_ez80.d: Likewise.
+ * testsuite/ld-z80/comb_arch_z80_z180.d: Likewise.
+ * testsuite/ld-z80/comb_arch_z80_z80n.d: Likewise.
+ * testsuite/ld-z80/relocs_b_ez80.d: Likewise.
+ * testsuite/ld-z80/relocs_b_z80.d: Likewise.
+ * testsuite/ld-z80/relocs_f_ez80.d: Likewise.
+ * testsuite/ld-z80/relocs_f_z80.d: Likewise.
+ * testsuite/ld-z80/relocs_f_z80n.d: Likewise.
+
2020-02-19 Alan Modra <amodra@gmail.com>
* testsuite/ld-plugin/pr25355.d: Allow alpha-linux nm result.
diff --git a/ld/emultempl/z80.em b/ld/emultempl/z80.em
index 81385e7..8894ffe 100644
--- a/ld/emultempl/z80.em
+++ b/ld/emultempl/z80.em
@@ -19,135 +19,45 @@
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
-fragment <<EOF
-/* --- \begin{z80.em} */
-
+if [ x"${EMULATION_NAME}" = x"elf32z80" ]; then
+ fragment <<EOF
#include "elf/z80.h"
-
+EOF
+else
+ fragment <<EOF
static void
-gld${EMULATION_NAME}_after_open (void);
-
-static int result_mach_type;
-
-struct z80_mach_info
-{
- unsigned eflags;
- unsigned bfd_mach;
- const int *compat; /* back compatible machines */
-};
-
-static const int
-back_compat_z80[] = {bfd_mach_z80, -1};
-
-static const int
-back_compat_z180[] = {bfd_mach_z180, bfd_mach_z80, -1};
-
-static const int
-back_compat_ez80[] = {bfd_mach_ez80_z80, bfd_mach_z180, bfd_mach_z80, -1};
-
-static const struct z80_mach_info
-z80_mach_info[] =
-{
- { EF_Z80_MACH_Z80, bfd_mach_z80, NULL },
- { EF_Z80_MACH_Z80, bfd_mach_z80strict, back_compat_z80 },
- { EF_Z80_MACH_Z80, bfd_mach_z80full, back_compat_z80 },
- { EF_Z80_MACH_Z180, bfd_mach_z180, back_compat_z80 },
- { EF_Z80_MACH_EZ80_Z80, bfd_mach_ez80_z80, back_compat_z180 },
- { EF_Z80_MACH_EZ80_ADL, bfd_mach_ez80_adl, back_compat_ez80 },
- { EF_Z80_MACH_Z80N, bfd_mach_z80n, back_compat_z80 },
- { EF_Z80_MACH_GBZ80, bfd_mach_gbz80, NULL },
- { EF_Z80_MACH_R800, bfd_mach_r800, back_compat_z80 }
-};
-/*
-static const struct z80_mach_info *
-z80_mach_info_by_eflags (unsigned int eflags)
-{
- const struct z80_mach_info *p;
- const struct z80_mach_info *e;
-
- eflags &= EF_Z80_MACH_MSK;
- p = &z80_mach_info[0];
- e = &z80_mach_info[sizeof(z80_mach_info)/sizeof(*z80_mach_info)];
- for (; p != e; ++p)
- if (eflags == p->eflags)
- return p;
- return NULL;
-}*/
-
-static const struct z80_mach_info *
-z80_mach_info_by_mach (unsigned int bfd_mach)
+gld${EMULATION_NAME}_after_open (void)
{
- const struct z80_mach_info *p;
- const struct z80_mach_info *e;
-
- p = &z80_mach_info[0];
- e = &z80_mach_info[sizeof(z80_mach_info)/sizeof(*z80_mach_info)];
- for (; p != e; ++p)
- if (bfd_mach == p->bfd_mach)
- return p;
- return NULL;
}
+EOF
+fi
-static const struct z80_mach_info *
-z80_combine_mach (const struct z80_mach_info *m1,
- const struct z80_mach_info *m2)
-{
- int i;
- int mach;
- if (m1->compat != NULL)
- for (i = 0; (mach = m1->compat[i]) >= 0; ++i)
- if ((unsigned)mach == m2->bfd_mach)
- return m1;
- if (m2->compat != NULL)
- for (i = 0; (mach = m2->compat[i]) >= 0; ++i)
- if ((unsigned)mach == m1->bfd_mach)
- return m2;
- /* incompatible mach */
- return NULL;
-}
+fragment <<EOF
+/* --- \begin{z80.em} */
-/* Set the machine type of the output file based on result_mach_type. */
+/* Set the machine type of the output file based on types of inputs. */
static void
z80_after_open (void)
{
- const struct z80_mach_info *mach = NULL;
bfd *abfd;
/* For now, make sure all object files are of the same architecture.
We may try to merge object files with different architecture together. */
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
{
- const struct z80_mach_info *new_mach;
- /*new_mach = z80_mach_info_by_eflags (elf_elfheader (abfd)->e_flags);*/
- new_mach = z80_mach_info_by_mach(bfd_get_mach (abfd));
- if (mach == NULL)
- mach = new_mach;
- else if (mach != new_mach)
- mach = z80_combine_mach (mach, new_mach);
- if (mach == NULL)
+ const bfd_arch_info_type *info;
+ info = bfd_arch_get_compatible (link_info.output_bfd, abfd, FALSE);
+ if (info == NULL)
einfo (_("%F%P: %pB: Instruction sets of object files incompatible\n"),
abfd);
+ else
+ bfd_set_arch_info (link_info.output_bfd, info);
}
- if (mach != NULL)
- {
- bfd_set_arch_mach (link_info.output_bfd, bfd_arch_z80, mach->bfd_mach);
- result_mach_type = mach->bfd_mach;
- }
- else
- einfo (_("%F%P: %pB: Unknown machine type\n"),
- abfd);
/* Call the standard elf routine. */
gld${EMULATION_NAME}_after_open ();
}
-#ifndef TARGET_IS_elf32z80
-static void
-gld${EMULATION_NAME}_after_open (void)
-{
-}
-#endif
-
/* --- \end{z80.em} */
EOF
diff --git a/ld/testsuite/ld-z80/arch_ez80_adl.d b/ld/testsuite/ld-z80/arch_ez80_adl.d
index aa9bd443..8a05785 100644
--- a/ld/testsuite/ld-z80/arch_ez80_adl.d
+++ b/ld/testsuite/ld-z80/arch_ez80_adl.d
@@ -1,6 +1,7 @@
#name: eZ80 ADL mode arch test
-#source: dummy1.s -ez80-adl
-#source: dummy2.s -ez80-adl
+#source: dummy1.s
+#source: dummy2.s
+#as: -march=ez80+adl
#ld: -e 0
#objdump: -f
diff --git a/ld/testsuite/ld-z80/arch_ez80_z80.d b/ld/testsuite/ld-z80/arch_ez80_z80.d
index 72c03e8..e7e865b 100644
--- a/ld/testsuite/ld-z80/arch_ez80_z80.d
+++ b/ld/testsuite/ld-z80/arch_ez80_z80.d
@@ -1,6 +1,7 @@
#name: eZ80 Z80 mode arch test
-#source: dummy1.s -ez80
-#source: dummy2.s -ez80
+#source: dummy1.s
+#source: dummy2.s
+#as: -march=ez80
#ld: -e 0
#objdump: -f
diff --git a/ld/testsuite/ld-z80/arch_r800.d b/ld/testsuite/ld-z80/arch_r800.d
index c079be1..7af2523 100644
--- a/ld/testsuite/ld-z80/arch_r800.d
+++ b/ld/testsuite/ld-z80/arch_r800.d
@@ -1,6 +1,7 @@
#name: R800 arch test
-#source: dummy1.s -r800
-#source: dummy2.s -r800
+#source: dummy1.s
+#source: dummy2.s
+#as: -march=r800
#ld: -e 0
#objdump: -f
diff --git a/ld/testsuite/ld-z80/arch_z180.d b/ld/testsuite/ld-z80/arch_z180.d
index d63ce23..171d891 100644
--- a/ld/testsuite/ld-z80/arch_z180.d
+++ b/ld/testsuite/ld-z80/arch_z180.d
@@ -1,6 +1,7 @@
#name: Z180 arch test
-#source: dummy1.s -z180
-#source: dummy2.s -z180
+#source: dummy1.s
+#source: dummy2.s
+#as: -march=z180
#ld: -e 0
#objdump: -f
diff --git a/ld/testsuite/ld-z80/arch_z80n.d b/ld/testsuite/ld-z80/arch_z80n.d
index 69754b3..7f43c1c 100644
--- a/ld/testsuite/ld-z80/arch_z80n.d
+++ b/ld/testsuite/ld-z80/arch_z80n.d
@@ -1,6 +1,7 @@
#name: Z80N arch test
-#source: dummy1.s -z80n
-#source: dummy2.s -z80n
+#source: dummy1.s
+#source: dummy2.s
+#as: -march=z80n
#ld: -e 0
#objdump: -f
diff --git a/ld/testsuite/ld-z80/comb_arch_ez80_z80.d b/ld/testsuite/ld-z80/comb_arch_ez80_z80.d
index 318a055..a91bd80 100644
--- a/ld/testsuite/ld-z80/comb_arch_ez80_z80.d
+++ b/ld/testsuite/ld-z80/comb_arch_ez80_z80.d
@@ -1,6 +1,6 @@
#name: eZ80/Z80 arch combination test
-#source: dummy1.s -ez80
-#source: dummy2.s -z80
+#source: dummy1.s -march=ez80
+#source: dummy2.s -march=z80
#ld: -e 0
#objdump: -f
diff --git a/ld/testsuite/ld-z80/comb_arch_z180_z80.d b/ld/testsuite/ld-z80/comb_arch_z180_z80.d
index f7a420c..acaac6e 100644
--- a/ld/testsuite/ld-z80/comb_arch_z180_z80.d
+++ b/ld/testsuite/ld-z80/comb_arch_z180_z80.d
@@ -1,6 +1,6 @@
#name: Z180/Z80 arch combination test
-#source: dummy1.s -z180
-#source: dummy2.s -z80
+#source: dummy1.s -march=z180
+#source: dummy2.s -march=z80
#ld: -e 0
#objdump: -f
diff --git a/ld/testsuite/ld-z80/comb_arch_z80_ez80.d b/ld/testsuite/ld-z80/comb_arch_z80_ez80.d
index 18f9f0b..aea784b 100644
--- a/ld/testsuite/ld-z80/comb_arch_z80_ez80.d
+++ b/ld/testsuite/ld-z80/comb_arch_z80_ez80.d
@@ -1,6 +1,6 @@
#name: Z80/eZ80 arch combination test
-#source: dummy1.s -z80
-#source: dummy2.s -ez80
+#source: dummy1.s -march=z80
+#source: dummy2.s -march=ez80
#ld: -e 0
#objdump: -f
diff --git a/ld/testsuite/ld-z80/comb_arch_z80_z180.d b/ld/testsuite/ld-z80/comb_arch_z80_z180.d
index 1f3e092..a5f9b83 100644
--- a/ld/testsuite/ld-z80/comb_arch_z80_z180.d
+++ b/ld/testsuite/ld-z80/comb_arch_z80_z180.d
@@ -1,6 +1,6 @@
#name: Z80/Z180 arch combination test
-#source: dummy1.s -z80
-#source: dummy2.s -z180
+#source: dummy1.s -march=z80
+#source: dummy2.s -march=z180
#ld: -e 0
#objdump: -f
diff --git a/ld/testsuite/ld-z80/comb_arch_z80_z80n.d b/ld/testsuite/ld-z80/comb_arch_z80_z80n.d
index 96319a2..8ad6432 100644
--- a/ld/testsuite/ld-z80/comb_arch_z80_z80n.d
+++ b/ld/testsuite/ld-z80/comb_arch_z80_z80n.d
@@ -1,6 +1,6 @@
#name: Z80/Z80N arch combination test
-#source: dummy1.s -z80
-#source: dummy2.s -z80n
+#source: dummy1.s -march=z80
+#source: dummy2.s -march=z80n
#ld: -e 0
#objdump: -f
diff --git a/ld/testsuite/ld-z80/relocs_b_ez80.d b/ld/testsuite/ld-z80/relocs_b_ez80.d
index a421ce8..9975b77 100644
--- a/ld/testsuite/ld-z80/relocs_b_ez80.d
+++ b/ld/testsuite/ld-z80/relocs_b_ez80.d
@@ -1,6 +1,7 @@
#name: eZ80 backward relocation in ADL mode
-#source: labels.s -ez80-adl
-#source: relocs.s -ez80-adl --defsym ADLMODE=1
+#source: labels.s
+#source: relocs.s --defsym ADLMODE=1
+#as: -march=ez80+adl
#ld: -e 0 -Ttext 0x100 -Tdata 0x200 -s
#objdump: -d
diff --git a/ld/testsuite/ld-z80/relocs_b_z80.d b/ld/testsuite/ld-z80/relocs_b_z80.d
index 1417650..d003057 100644
--- a/ld/testsuite/ld-z80/relocs_b_z80.d
+++ b/ld/testsuite/ld-z80/relocs_b_z80.d
@@ -1,6 +1,6 @@
#name: Z80 backward relocation
-#source: labels.s -z80
-#source: relocs.s -z80
+#source: labels.s
+#source: relocs.s
#ld: -e 0 -Ttext 0x100 -Tdata 0x200 -s
#objdump: -d
diff --git a/ld/testsuite/ld-z80/relocs_f_ez80.d b/ld/testsuite/ld-z80/relocs_f_ez80.d
index 323156b..cbc1c18 100644
--- a/ld/testsuite/ld-z80/relocs_f_ez80.d
+++ b/ld/testsuite/ld-z80/relocs_f_ez80.d
@@ -1,6 +1,7 @@
#name: eZ80 forward relocation in ADL mode
-#source: relocs.s -ez80-adl --defsym ADLMODE=1
-#source: labels.s -ez80-adl
+#source: relocs.s --defsym ADLMODE=1
+#source: labels.s
+#as: -march=ez80+adl
#ld: -e 0 -Ttext 0x100 -Tdata 0x200
#objdump: -d
diff --git a/ld/testsuite/ld-z80/relocs_f_z80.d b/ld/testsuite/ld-z80/relocs_f_z80.d
index 462da8a..addfde4 100644
--- a/ld/testsuite/ld-z80/relocs_f_z80.d
+++ b/ld/testsuite/ld-z80/relocs_f_z80.d
@@ -1,6 +1,6 @@
-#name: Z80 forward relocation
-#source: relocs.s -z80
-#source: labels.s -z80
+#name: Forward relocation
+#source: relocs.s
+#source: labels.s
#ld: -e 0 -Ttext 0x100 -Tdata 0x200
#objdump: -d
diff --git a/ld/testsuite/ld-z80/relocs_f_z80n.d b/ld/testsuite/ld-z80/relocs_f_z80n.d
index 8cf0ab8..83ec357 100644
--- a/ld/testsuite/ld-z80/relocs_f_z80n.d
+++ b/ld/testsuite/ld-z80/relocs_f_z80n.d
@@ -1,5 +1,5 @@
#name: Z80N forward relocation
-#as: -z80n --defsym Z80N=1
+#as: -march=z80n --defsym Z80N=1
#source: relocs.s
#source: labels.s
#ld: -e 0 -Ttext 0x100 -Tdata 0x200