diff options
author | Sergey Belyashov <sergey.belyashov@gmail.com> | 2020-02-07 14:53:46 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-02-07 14:53:46 +0000 |
commit | 9fc0b501af78bc4a92f53ec712e1aaa123e0224c (patch) | |
tree | f3ef7a39227828252a1878f1a526b3df19ec7c65 /ld | |
parent | adb8754e48d53b219ddaa9e8368e4b1acb9db53a (diff) | |
download | fsf-binutils-gdb-9fc0b501af78bc4a92f53ec712e1aaa123e0224c.zip fsf-binutils-gdb-9fc0b501af78bc4a92f53ec712e1aaa123e0224c.tar.gz fsf-binutils-gdb-9fc0b501af78bc4a92f53ec712e1aaa123e0224c.tar.bz2 |
Add support for the GBZ80 and Z80N variants of the Z80 architecture, and add DWARF debug info support to the Z80 assembler.
PR 25469
bfd * archures.c: Add GBZ80 and Z80N machine values.
* reloc.c: Add BFD_RELOC_Z80_16_BE.
* coff-z80.c: Add support for new reloc.
* coffcode.h: Add support for new machine values.
* cpu-z80.c: Add support for new machine names.
* elf32-z80.c: Add support for new reloc.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
binutils* readelf.c (get_machine_flags): Add support for Z80N machine
number.
gas * config/tc-z80.c: Add -gbz80 command line option to generate code
for the GameBoy Z80. Add support for generating DWARF.
* config/tc-z80.h: Add support for DWARF debug information
generation.
* doc/c-z80.texi: Document new command line option.
* testsuite/gas/z80/gbz80_all.d: New file.
* testsuite/gas/z80/gbz80_all.s: New file.
* testsuite/gas/z80/z80.exp: Run the new tests.
* testsuite/gas/z80/z80n_all.d: New file.
* testsuite/gas/z80/z80n_all.s: New file.
* testsuite/gas/z80/z80n_reloc.d: New file.
include * coff/internal.h (R_IMM16BE): Define.
* elf/z80.h (EF_Z80_MACH_Z80N): Define.
(R_Z80_16_BE): New reloc.
ld * emulparams/elf32z80.sh: Use z80 emulation.
* emultempl/z80.em: Make generic to both COFF and ELF Z80 emulations.
* emultempl/z80elf.em: Delete.
* testsuite/ld-elf/pr22450.d: Expect to fail for the Z80.
* testsuite/ld-elf/sec64k.exp: Fix Z80 assembly.
* testsuite/ld-unique/pr21529.s: Avoid register name conflict.
* testsuite/ld-unique/unique.s: Likewise.
* testsuite/ld-unique/unique_empty.s: Likewise.
* testsuite/ld-unique/unique_shared.s: Likewise.
* testsuite/ld-unique/unique.d: Updated expected output.
* testsuite/ld-z80/arch_z80n.d: New file.
* testsuite/ld-z80/comb_arch_z80_z80n.d: New file.
* testsuite/ld-z80/labels.s: Add more labels.
* testsuite/ld-z80/relocs.s: Add more reloc tests.
* testsuite/ld-z80/relocs_f_z80n.d: New file
opcodes * z80-dis.c: Add support for GBZ80 opcodes.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 19 | ||||
-rw-r--r-- | ld/emulparams/elf32z80.sh | 2 | ||||
-rw-r--r-- | ld/emultempl/z80.em | 215 | ||||
-rw-r--r-- | ld/emultempl/z80elf.em | 133 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr22450.d | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/sec64k.exp | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-unique/pr21529.s | 8 | ||||
-rw-r--r-- | ld/testsuite/ld-unique/unique.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-unique/unique.s | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-unique/unique_empty.s | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-unique/unique_shared.s | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/arch_z80n.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/comb_arch_z80_z80n.d | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/labels.s | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/relocs.s | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-z80/relocs_f_z80n.d | 86 |
16 files changed, 277 insertions, 250 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index b03c0fb..44a6887 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,22 @@ +2020-02-07 Sergey Belyashov <sergey.belyashov@gmail.com> + + PR 25469 + * emulparams/elf32z80.sh: Use z80 emulation. + * emultempl/z80.em: Make generic to both COFF and ELF Z80 emulations. + * emultempl/z80elf.em: Delete. + * testsuite/ld-elf/pr22450.d: Expect to fail for the Z80. + * testsuite/ld-elf/sec64k.exp: Fix Z80 assembly. + * testsuite/ld-unique/pr21529.s: Avoid register name conflict. + * testsuite/ld-unique/unique.s: Likewise. + * testsuite/ld-unique/unique_empty.s: Likewise. + * testsuite/ld-unique/unique_shared.s: Likewise. + * testsuite/ld-unique/unique.d: Updated expected output. + * testsuite/ld-z80/arch_z80n.d: New file. + * testsuite/ld-z80/comb_arch_z80_z80n.d: New file. + * testsuite/ld-z80/labels.s: Add more labels. + * testsuite/ld-z80/relocs.s: Add more reloc tests. + * testsuite/ld-z80/relocs_f_z80n.d: New file + 2020-02-07 H.J. Lu <hongjiu.lu@intel.com> PR ld/25022 diff --git a/ld/emulparams/elf32z80.sh b/ld/emulparams/elf32z80.sh index c4aa444..45a1112 100644 --- a/ld/emulparams/elf32z80.sh +++ b/ld/emulparams/elf32z80.sh @@ -11,7 +11,7 @@ TEXT_START_ADDR=0x100 #TEXT_LENGTH=0 #DATA_ORIGIN=0 #DATA_LENGTH=0 -EXTRA_EM_FILE=z80elf +EXTRA_EM_FILE=z80 #FUSE_NAME=fuse diff --git a/ld/emultempl/z80.em b/ld/emultempl/z80.em index 4c36cd8..81385e7 100644 --- a/ld/emultempl/z80.em +++ b/ld/emultempl/z80.em @@ -19,129 +19,136 @@ # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, # MA 02110-1301, USA. -LDEMUL_BEFORE_PARSE=gldz80_before_parse -LDEMUL_RECOGNIZED_FILE=gldz80_recognized_file -LDEMUL_AFTER_OPEN=gldz80_after_open - fragment <<EOF /* --- \begin{z80.em} */ -/* Codes for machine types, bitwise or gives the code to use for the - output. */ -#define M_Z80STRICT 0x01 -#define M_Z80 0x03 -#define M_Z80FULL 0x07 -#define M_R800 0x10 -#define M_Z80ANY 0x0f -#define M_GBZ80 0x20 -#define M_Z180 0x40 -#define M_EZ80_Z80 0x80 -#define M_EZ80_ADL 0x100 -#define M_ARCH_MASK 0xFF0 - -/* Bitwise or of the machine types seen so far. */ -static int result_mach_type; + +#include "elf/z80.h" static void -${LDEMUL_BEFORE_PARSE} (void) +gld${EMULATION_NAME}_after_open (void); + +static int result_mach_type; + +struct z80_mach_info { -#ifndef TARGET_ /* I.e., if not generic. */ - ldfile_set_output_arch ("`echo ${ARCH}`", bfd_arch_unknown); -#endif /* not TARGET_ */ - result_mach_type = 0; -} + unsigned eflags; + unsigned bfd_mach; + const int *compat; /* back compatible machines */ +}; +static const int +back_compat_z80[] = {bfd_mach_z80, -1}; -/* Update result_mach_type. */ -static bfd_boolean -${LDEMUL_RECOGNIZED_FILE} (lang_input_statement_type *entry) +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[] = { - unsigned long mach_type; + { 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; - 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; - case bfd_mach_gbz80: - result_mach_type |= M_GBZ80; - break; - case bfd_mach_z180: - result_mach_type |= M_Z180; - break; - case bfd_mach_ez80_z80: - result_mach_type |= M_EZ80_Z80; - break; - case bfd_mach_ez80_adl: - result_mach_type |= M_EZ80_ADL; - break; - default: - einfo (_("%P: warning: unknown machine type %u"), (unsigned)mach_type); - result_mach_type |= M_Z80ANY; - } - return FALSE; + 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) +{ + 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; +} + +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; } /* Set the machine type of the output file based on result_mach_type. */ static void -gldz80_after_open (void) +z80_after_open (void) { - unsigned long mach_type; + const struct z80_mach_info *mach = NULL; + bfd *abfd; - after_open_default (); - - switch (result_mach_type & M_ARCH_MASK) + /* 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) { - case M_Z80 & M_ARCH_MASK: - case M_R800: - case M_Z180: - case M_GBZ80: - case M_EZ80_Z80: - case M_EZ80_ADL: - case M_EZ80_Z80 | M_Z180: - /* valid combination */ - break; - case M_EZ80_Z80 | M_EZ80_ADL: - case M_EZ80_Z80 | M_EZ80_ADL | M_Z180: - case M_EZ80_ADL | M_Z180: - /* combination may cause invalid objdump output */ - /* but it is possible for mixed ADL/Z80 code */ - einfo (_("%P: warning: mixing ADL and Z80 mode binaries, objdump may generate invalid output")); - break; - default: - /* invalid combination: for example Z180 + R800 */ - einfo (_("%P: warning: incompatible object files linked, result code might not work")); + 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) + einfo (_("%F%P: %pB: Instruction sets of object files incompatible\n"), + abfd); + } + if (mach != NULL) + { + bfd_set_arch_mach (link_info.output_bfd, bfd_arch_z80, mach->bfd_mach); + result_mach_type = mach->bfd_mach; } - - if ((result_mach_type & M_EZ80_ADL) == M_EZ80_ADL) - mach_type = bfd_mach_ez80_adl; - else if ((result_mach_type & M_EZ80_Z80) == M_EZ80_Z80) - mach_type = bfd_mach_ez80_z80; - else if ((result_mach_type & M_Z180) == M_Z180) - mach_type = bfd_mach_z180; - else if ((result_mach_type & M_R800) == M_R800) - mach_type = bfd_mach_r800; - else if ((result_mach_type & M_GBZ80) == M_GBZ80) - mach_type = bfd_mach_gbz80; - else if ((result_mach_type & M_Z80FULL) == M_Z80FULL) - mach_type = bfd_mach_z80full; /* TODO: remove it */ - else if ((result_mach_type & M_Z80) == M_Z80) - mach_type = bfd_mach_z80; - else if ((result_mach_type & M_Z80STRICT) == M_Z80STRICT) - mach_type = bfd_mach_z80strict; /* TODO: remove this */ else - mach_type = bfd_arch_unknown; + einfo (_("%F%P: %pB: Unknown machine type\n"), + abfd); - bfd_set_arch_mach (link_info.output_bfd, bfd_arch_z80, mach_type); + /* 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 + +LDEMUL_AFTER_OPEN=z80_after_open diff --git a/ld/emultempl/z80elf.em b/ld/emultempl/z80elf.em deleted file mode 100644 index 4b03e79..0000000 --- a/ld/emultempl/z80elf.em +++ /dev/null @@ -1,133 +0,0 @@ -# This shell script emits C code -*- C -*- -# to keep track of the machine type of Z80 object files -# It does some substitutions. -# Copyright (C) 2005-2019 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. - -fragment <<EOF -/* --- \begin{z80.em} */ - -#include "elf/z80.h" - -static void -gld${EMULATION_NAME}_after_open (void); - -static int result_mach_type; - -/* Set the machine type of the output file based on result_mach_type. */ -static void -z80_elf_after_open (void) -{ - unsigned int mach = 0; - 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) - { - unsigned long new_mach; - new_mach = elf_elfheader (abfd)->e_flags & 0xff; - if (!mach) - mach = new_mach; - else if (mach != new_mach) - { - if ((new_mach == EF_Z80_MACH_R800 || mach == EF_Z80_MACH_R800) || - (new_mach == EF_Z80_MACH_GBZ80 || mach == EF_Z80_MACH_GBZ80)) - einfo (_("%F%P: %pB: Instruction set of object files mismatched\n"), - abfd); - else if (mach < new_mach) - mach = new_mach; - } - } - switch (mach & 0xff) - { - case EF_Z80_MACH_Z80: - mach = bfd_mach_z80; - break; - case EF_Z80_MACH_Z180: - mach = bfd_mach_z180; - break; - case EF_Z80_MACH_R800: - mach = bfd_mach_r800; - break; - case EF_Z80_MACH_EZ80_Z80: - mach = bfd_mach_ez80_z80; - break; - case EF_Z80_MACH_EZ80_ADL: - mach = bfd_mach_ez80_adl; - break; - case EF_Z80_MACH_GBZ80: - mach = bfd_mach_gbz80; - break; - default: - mach = (unsigned)-1; - } - - bfd_set_arch_mach (link_info.output_bfd, bfd_arch_z80, mach); - result_mach_type = mach; - - /* Call the standard elf routine. */ - gld${EMULATION_NAME}_after_open (); -} - -static void -z80_elf_finish (void) -{ - bfd *abfd; - - abfd = link_info.output_bfd; - - if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) - { - unsigned e_flags; - switch (result_mach_type) - { - case bfd_mach_z80strict: - case bfd_mach_z80: - case bfd_mach_z80full: - e_flags = EF_Z80_MACH_Z80; - break; - case bfd_mach_r800: - e_flags = EF_Z80_MACH_R800; - break; - case bfd_mach_gbz80: - e_flags = EF_Z80_MACH_GBZ80; - break; - case bfd_mach_z180: - e_flags = EF_Z80_MACH_Z180; - break; - case bfd_mach_ez80_z80: - e_flags = EF_Z80_MACH_EZ80_Z80; - break; - case bfd_mach_ez80_adl: - e_flags = EF_Z80_MACH_EZ80_ADL; - break; - default: - e_flags = ~0; - } - elf_elfheader (abfd)->e_flags = (elf_elfheader (abfd)->e_flags & ~0xff) | e_flags; - } - - finish_default (); -} - -/* --- \end{z80.em} */ -EOF - -LDEMUL_AFTER_OPEN=z80_elf_after_open -LDEMUL_FINISH=z80_elf_finish diff --git a/ld/testsuite/ld-elf/pr22450.d b/ld/testsuite/ld-elf/pr22450.d index 5b219b7..30754ec 100644 --- a/ld/testsuite/ld-elf/pr22450.d +++ b/ld/testsuite/ld-elf/pr22450.d @@ -1,6 +1,7 @@ #source: pr22450.s #readelf: --notes --wide #ld: -r +#xfail: z80-*-* # Fails on H8300 because it does not generate the correct relocs for the size fields. # Fails on AVR, IP2K, M68HC11, XC16C because the assembler does not calculate the correct values for the differences of local symbols. # Fails on CRX because readelf does not know how to apply CRX reloc number 20 (R_CRX_SWITCH32). diff --git a/ld/testsuite/ld-elf/sec64k.exp b/ld/testsuite/ld-elf/sec64k.exp index 892f8c4..7c85979 100644 --- a/ld/testsuite/ld-elf/sec64k.exp +++ b/ld/testsuite/ld-elf/sec64k.exp @@ -130,6 +130,10 @@ if { ![istarget "m32r-*-*"] } then { foreach sfile [lrange $sfiles 0 [expr [llength $sfiles] / 2]] { puts $ofd "#source: $sfile" } + #force z80 target to compile for eZ80 in ADL mode + if { [istarget "z80-*-*"] } then { + puts $ofd "#as: -ez80-adl" + } puts $ofd "#ld: -r" puts $ofd "#readelf: -W -Ss" puts $ofd "There are 680.. section headers.*:" @@ -180,6 +184,10 @@ if { ![istarget "d10v-*-*"] } else { puts $ofd "#ld:" } + #force z80 target to compile for eZ80 in ADL mode + if { [istarget "z80-*-*"] } then { + puts $ofd "#as: -ez80-adl" + } puts $ofd "#readelf: -W -Ss" puts $ofd "There are 660.. section headers.*:" puts $ofd "#..." diff --git a/ld/testsuite/ld-unique/pr21529.s b/ld/testsuite/ld-unique/pr21529.s index 4570635..fd09d61 100644 --- a/ld/testsuite/ld-unique/pr21529.s +++ b/ld/testsuite/ld-unique/pr21529.s @@ -1,8 +1,8 @@ - .type a, %gnu_unique_object -a: .long 0 - .size a, .-a + .type a_val, %gnu_unique_object +a_val: .long 0 + .size a_val, .-a_val .type main,"function" .global main main: - .dc.a a + .dc.a a_val diff --git a/ld/testsuite/ld-unique/unique.d b/ld/testsuite/ld-unique/unique.d index 73c939b..77422d5 100644 --- a/ld/testsuite/ld-unique/unique.d +++ b/ld/testsuite/ld-unique/unique.d @@ -5,5 +5,5 @@ #... *OS/ABI: +UNIX - GNU #... - *[0-9]+: +[0-9a-f]+ +[0-9]+ +OBJECT +UNIQUE +DEFAULT +[0-9]+ a + *[0-9]+: +[0-9a-f]+ +[0-9]+ +OBJECT +UNIQUE +DEFAULT +[0-9]+ a_val #pass diff --git a/ld/testsuite/ld-unique/unique.s b/ld/testsuite/ld-unique/unique.s index 7477a69..cd5e64e 100644 --- a/ld/testsuite/ld-unique/unique.s +++ b/ld/testsuite/ld-unique/unique.s @@ -1,6 +1,6 @@ - .type a, %gnu_unique_object -a: .long 0 - .size a, .-a + .type a_val, %gnu_unique_object +a_val: .long 0 + .size a_val, .-a_val .type main,"function" .global main diff --git a/ld/testsuite/ld-unique/unique_empty.s b/ld/testsuite/ld-unique/unique_empty.s index c4c52c2..4896641 100644 --- a/ld/testsuite/ld-unique/unique_empty.s +++ b/ld/testsuite/ld-unique/unique_empty.s @@ -1,4 +1,4 @@ .type main,"function" .global main main: - .dc.a b + .dc.a b_val diff --git a/ld/testsuite/ld-unique/unique_shared.s b/ld/testsuite/ld-unique/unique_shared.s index 8022291..f1914f3 100644 --- a/ld/testsuite/ld-unique/unique_shared.s +++ b/ld/testsuite/ld-unique/unique_shared.s @@ -1,3 +1,3 @@ - .type b, %gnu_unique_object -b: .long 0 - .size b, .-b + .type b_val, %gnu_unique_object +b_val: .long 0 + .size b_val, .-b_val diff --git a/ld/testsuite/ld-z80/arch_z80n.d b/ld/testsuite/ld-z80/arch_z80n.d new file mode 100644 index 0000000..69754b3 --- /dev/null +++ b/ld/testsuite/ld-z80/arch_z80n.d @@ -0,0 +1,11 @@ +#name: Z80N arch test +#source: dummy1.s -z80n +#source: dummy2.s -z80n +#ld: -e 0 +#objdump: -f + +.*:[ ]+file format (coff|elf32)\-z80 +architecture: z80n, flags 0x[0-9a-fA-F]+: +.* +.* + diff --git a/ld/testsuite/ld-z80/comb_arch_z80_z80n.d b/ld/testsuite/ld-z80/comb_arch_z80_z80n.d new file mode 100644 index 0000000..96319a2 --- /dev/null +++ b/ld/testsuite/ld-z80/comb_arch_z80_z80n.d @@ -0,0 +1,11 @@ +#name: Z80/Z80N arch combination test +#source: dummy1.s -z80 +#source: dummy2.s -z80n +#ld: -e 0 +#objdump: -f + +.*:[ ]+file format (coff|elf32)\-z80 +architecture: z80n, flags 0x[0-9a-fA-F]+: +.* +.* + diff --git a/ld/testsuite/ld-z80/labels.s b/ld/testsuite/ld-z80/labels.s index a957fef..395cfb2 100644 --- a/ld/testsuite/ld-z80/labels.s +++ b/ld/testsuite/ld-z80/labels.s @@ -9,6 +9,9 @@ .globl label8 .globl label9 .globl value8 + .globl value8_1 + .globl value8_2 + .globl value8_3 .globl value16 .globl value24 .globl value32 @@ -35,6 +38,9 @@ label9: cpl value8 .equ 0x12 +value8_1 .equ 0xab +value8_2 .equ 0xcd +value8_3 .equ 0xef value16 .equ 0x1234 value24 .equ 0x123456 value32 .equ 0x12345678 diff --git a/ld/testsuite/ld-z80/relocs.s b/ld/testsuite/ld-z80/relocs.s index 131a702..422b067 100644 --- a/ld/testsuite/ld-z80/relocs.s +++ b/ld/testsuite/ld-z80/relocs.s @@ -12,6 +12,9 @@ .globl label9 .globl value8 + .globl value8_1 + .globl value8_2 + .globl value8_3 .globl value16 .globl value24 .globl value32 @@ -74,6 +77,14 @@ field_0_1 .equ field_0+90 ld h,(value32 + 0x12345678) >> 8 ld l,(value32 + 0x12345678) >> 0 + .ifdef Z80N + push label1 + push value16 + nextreg value8_1,value8_2 + nextreg value8_3,a + ld a,a + .endif + .data .db value8 .dw value16 diff --git a/ld/testsuite/ld-z80/relocs_f_z80n.d b/ld/testsuite/ld-z80/relocs_f_z80n.d new file mode 100644 index 0000000..8cf0ab8 --- /dev/null +++ b/ld/testsuite/ld-z80/relocs_f_z80n.d @@ -0,0 +1,86 @@ +#name: Z80N forward relocation +#as: -z80n --defsym Z80N=1 +#source: relocs.s +#source: labels.s +#ld: -e 0 -Ttext 0x100 -Tdata 0x200 +#objdump: -d + + +.*:[ ]+file format (coff|elf32)\-z80 + + +.* \.text: + +0+100 <.*>: +[ ]+100:[ ]+cd 7d 01[ ]+call 0x017d +[ ]+103:[ ]+c4 7e 01[ ]+call nz,0x017e +[ ]+106:[ ]+cc 7f 01[ ]+call z,0x017f +[ ]+109:[ ]+d4 80 01[ ]+call nc,0x0180 +[ ]+10c:[ ]+dc 81 01[ ]+call c,0x0181 +[ ]+10f:[ ]+e4 82 01[ ]+call po,0x0182 +[ ]+112:[ ]+ec 83 01[ ]+call pe,0x0183 +[ ]+115:[ ]+f4 84 01[ ]+call p,0x0184 +[ ]+118:[ ]+fc 85 01[ ]+call m,0x0185 +[ ]+11b:[ ]+c3 7d 01[ ]+jp 0x017d +[ ]+11e:[ ]+c2 7e 01[ ]+jp nz,0x017e +[ ]+121:[ ]+ca 7f 01[ ]+jp z,0x017f +[ ]+124:[ ]+d2 80 01[ ]+jp nc,0x0180 +[ ]+127:[ ]+da 81 01[ ]+jp c,0x0181 +[ ]+12a:[ ]+e2 82 01[ ]+jp po,0x0182 +[ ]+12d:[ ]+ea 83 01[ ]+jp pe,0x0183 +[ ]+130:[ ]+f2 84 01[ ]+jp p,0x0184 +[ ]+133:[ ]+fa 85 01[ ]+jp m,0x0185 +[ ]+136:[ ]+dd 6e 05[ ]+ld l,\(ix\+5\) +[ ]+139:[ ]+dd 7e 03[ ]+ld a,\(ix\+3\) +[ ]+13c:[ ]+dd 4e fa[ ]+ld c,\(ix\-6\) +[ ]+13f:[ ]+dd 46 f9[ ]+ld b,\(ix\-7\) +[ ]+142:[ ]+fd 75 fb[ ]+ld \(iy\-5\),l +[ ]+145:[ ]+fd 77 03[ ]+ld \(iy\+3\),a +[ ]+148:[ ]+fd 71 0e[ ]+ld \(iy\+14\),c +[ ]+14b:[ ]+fd 70 0f[ ]+ld \(iy\+15\),b +[ ]+14e:[ ]+fd 66 5d[ ]+ld h,\(iy\+93\) +[ ]+151:[ ]+11 34 12[ ]+ld de,0x1234 +[ ]+154:[ ]+21 78 56[ ]+ld hl,0x5678 +[ ]+157:[ ]+11 68 24[ ]+ld de,0x2468 +[ ]+15a:[ ]+21 f0 ac[ ]+ld hl,0xacf0 +[ ]+15d:[ ]+16 12[ ]+ld d,0x12 +[ ]+15f:[ ]+1e 34[ ]+ld e,0x34 +[ ]+161:[ ]+26 56[ ]+ld h,0x56 +[ ]+163:[ ]+2e 78[ ]+ld l,0x78 +[ ]+165:[ ]+16 24[ ]+ld d,0x24 +[ ]+167:[ ]+1e 68[ ]+ld e,0x68 +[ ]+169:[ ]+26 ac[ ]+ld h,0xac +[ ]+16b:[ ]+2e f0[ ]+ld l,0xf0 +[ ]+16d:[ ]+ed 8a 01 7d[ ]+push 0x017d +[ ]+171:[ ]+ed 8a 12 34[ ]+push 0x1234 +[ ]+175:[ ]+ed 91 ab cd[ ]+nextreg 0xab,0xcd +[ ]+179:[ ]+ed 92 ef[ ]+nextreg 0xef,a +[ ]+17c:[ ]+7f[ ]+ld a,a + +0+17d <label1>: +[ ]+17d:[ ]+78[ ]+ld a,b + +0+17e <label2>: +[ ]+17e:[ ]+79[ ]+ld a,c + +0+17f <label3>: +[ ]+17f:[ ]+7a[ ]+ld a,d + +0+180 <label4>: +[ ]+180:[ ]+7b[ ]+ld a,e + +0+181 <label5>: +[ ]+181:[ ]+7c[ ]+ld a,h + +0+182 <label6>: +[ ]+182:[ ]+7d[ ]+ld a,l + +0+183 <label7>: +[ ]+183:[ ]+7e[ ]+ld a,\(hl\) + +0+184 <label8>: +[ ]+184:[ ]+7f[ ]+ld a,a + +0+185 <label9>: +[ ]+185:[ ]+2f[ ]+cpl +#pass |