z80.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* coff information for Zilog Z80
  2. Copyright (C) 2005-2015 Free Software Foundation, Inc.
  3. Contributed by Arnold Metselaar <arnold_m@operamail.com>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
  15. #define L_LNNO_SIZE 4
  16. #include "coff/external.h"
  17. /* z80 backend does not use dots in section names. */
  18. #undef _TEXT
  19. #define _TEXT "text"
  20. #undef _DATA
  21. #define _DATA "data"
  22. #undef _BSS
  23. #define _BSS "bss"
  24. /* Type of cpu is stored in flags. */
  25. #define F_MACHMASK 0xF000
  26. /* Z80 COFF encodes the section alignment in the section header flags */
  27. #define COFF_ALIGN_IN_SECTION_HEADER 1
  28. #define COFF_ALIGN_IN_S_FLAGS 1
  29. #define F_ALGNMASK 0x0F00
  30. /* requires a power-of-two argument */
  31. #define COFF_ENCODE_ALIGNMENT(S,X) ((S).s_flags |= (((unsigned)(X)&0xF)<<8))
  32. /* result is a power of two */
  33. #define COFF_DECODE_ALIGNMENT(X) (((X)>>8)&0xF)
  34. #define Z80MAGIC 0x805A
  35. #define Z80BADMAG(x) (((x).f_magic != Z80MAGIC))
  36. /* Relocation directives. */
  37. /* This format actually has more bits than we need. */
  38. struct external_reloc
  39. {
  40. char r_vaddr[4];
  41. char r_symndx[4];
  42. char r_offset[4];
  43. char r_type[2];
  44. char r_stuff[2];
  45. };
  46. #define RELOC struct external_reloc
  47. #define RELSZ 16