From 134dcee5bc81ad43fc6596d7d70eab234d1893dc Mon Sep 17 00:00:00 2001 From: Arnold Metselaar Date: Sun, 5 Feb 2006 11:57:35 +0000 Subject: [PATCH] Cleanup of pseudo-ops for constants and new def24,def32 pseudo-ops on z80 --- bfd/ChangeLog | 7 ++ bfd/coff-z80.c | 21 +++++- gas/ChangeLog | 18 +++++ gas/config/tc-z80.c | 173 ++++++++++++++++++++++++++++-------------------- gas/config/tc-z80.h | 2 + gas/doc/c-z80.texi | 14 +++- include/coff/ChangeLog | 4 ++ include/coff/internal.h | 1 + 8 files changed, 167 insertions(+), 73 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f2ca17d..4dcd1e7 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2006-02-05 Arnold Metselaar + + * coff-z80.c (r_imm24): New howto. + (rtype2howto): New case R_IMM24. + (coff_z80_reloc_type_lookup): New case BFD_RELOC_24. + (extra_case): Use bfd_get_8 for R_IMM8, new case R_IMM24. + 2006-02-04 Richard Sandiford * elfxx-mips.c (mips_elf_initialize_tls_index): If a TLS symbol diff --git a/bfd/coff-z80.c b/bfd/coff-z80.c index f39413f..512c2b8 100644 --- a/bfd/coff-z80.c +++ b/bfd/coff-z80.c @@ -34,6 +34,11 @@ HOWTO (R_IMM32, 0, 1, 32, FALSE, 0, complain_overflow_dont, 0, "r_imm32", TRUE, 0xffffffff, 0xffffffff, FALSE); +static reloc_howto_type r_imm24 = +HOWTO (R_IMM24, 0, 1, 24, FALSE, 0, + complain_overflow_dont, 0, "r_imm24", TRUE, 0x00ffffff, 0x00ffffff, + FALSE); + static reloc_howto_type r_imm16 = HOWTO (R_IMM16, 0, 1, 16, FALSE, 0, complain_overflow_dont, 0, "r_imm16", TRUE, 0x0000ffff, 0x0000ffff, @@ -84,6 +89,9 @@ rtype2howto (arelent *internal, struct internal_reloc *dst) case R_IMM16: internal->howto = &r_imm16; break; + case R_IMM24: + internal->howto = &r_imm24; + break; case R_IMM32: internal->howto = &r_imm32; break; @@ -106,6 +114,7 @@ coff_z80_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, { case BFD_RELOC_8: return & r_imm8; case BFD_RELOC_16: return & r_imm16; + case BFD_RELOC_24: return & r_imm24; case BFD_RELOC_32: return & r_imm32; case BFD_RELOC_8_PCREL: return & r_jr; case BFD_RELOC_Z80_DISP8: return & r_off8; @@ -173,7 +182,7 @@ extra_case (bfd *in_abfd, break; case R_IMM8: - val = bfd_get_16 ( in_abfd, data+*src_ptr) + val = bfd_get_8 ( in_abfd, data+*src_ptr) + bfd_coff_reloc16_get_value (reloc, link_info, input_section); bfd_put_8 (in_abfd, val, data + *dst_ptr); (*dst_ptr) += 1; @@ -188,6 +197,16 @@ extra_case (bfd *in_abfd, (*src_ptr) += 2; break; + case R_IMM24: + val = bfd_get_16 ( in_abfd, data+*src_ptr) + + (bfd_get_8 ( in_abfd, data+*src_ptr+2) << 16) + + bfd_coff_reloc16_get_value (reloc, link_info, input_section); + bfd_put_16 (in_abfd, val, data + *dst_ptr); + bfd_put_8 (in_abfd, val >> 16, data + *dst_ptr+2); + (*dst_ptr) += 3; + (*src_ptr) += 3; + break; + case R_IMM32: val = bfd_get_32 ( in_abfd, data+*src_ptr) + bfd_coff_reloc16_get_value (reloc, link_info, input_section); diff --git a/gas/ChangeLog b/gas/ChangeLog index ca85d59..0247c82 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,21 @@ +2006-02-05 Arnold Metselaar + + * config/tc-z80.c (z80_start_line_hook): allow .equ and .defl as + synonyms for equ and defl. + (z80_cons_fix_new): New function. + (emit_byte): Disallow relative jumps to absolute locations. + (emit_data): Only handle defb, prototype changed, because defb is + now handled as pseudo-op rather than an instruction. + (instab): Entries for defb,defw,db,dw moved from here... + (md_pseudo_table): ... to here, use generic cons() for defw,dw. + Add entries for def24,def32,d24,d32. + (md_assemble): Improved error handling. + (md_apply_fix): New case BFD_RELOC_24, set fixP->fx_no_overflow to one. + * config/tc-z80.h (TC_CONS_FIX_NEW): Define. + (z80_cons_fix_new): Declare. + * doc/c-z80.texi (defb, db): Mention warning on overflow. + (def24,d24,def32,d32): New pseudo-ops. + 2006-02-02 Paul Brook * config/tc-arm.c (do_shift): Remove Thumb-1 constraint. diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c index 7aabb8e..76d46f5 100644 --- a/gas/config/tc-z80.c +++ b/gas/config/tc-z80.c @@ -210,16 +210,6 @@ z80_md_end (void) bfd_set_arch_mach (stdoutput, TARGET_ARCH, mach_type); } -/* Port specific features. */ -const pseudo_typeS md_pseudo_table[] = -{ - { "defs", s_space, 1}, /* Synonym for ds on some assemblers. */ - { "ds", s_space, 1}, /* Fill with bytes rather than words. */ - { "psect", obj_coff_section, 0}, /* TODO: Translate attributes. */ - { "set", 0, 0}, /* Real instruction on z80. */ - { NULL, 0, 0 } -} ; - static const char * skip_space (const char *s) { @@ -262,7 +252,7 @@ z80_start_line_hook (void) break; } } - /* Check for