xref: /netbsd-src/external/gpl3/binutils/dist/gas/config/tc-z80.h (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1 /* this is tc-z80.h
2    Copyright (C) 2005-2024 Free Software Foundation, Inc.
3 
4    Contributed by Arnold Metselaar <arnold_m@operamail.com>
5 
6    This file is part of GAS, the GNU Assembler.
7 
8    GAS is free software; you can redistribute it and/or modify
9    it under the terms of .the GNU General Public License as published by
10    the Free Software Foundation; either version 3, or (at your option)
11    any later version.
12 
13    GAS is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with GAS; see the file COPYING.  If not, write to the Free
20    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
21    02110-1301, USA.  */
22 
23 #ifndef TC_Z80
24 #define TC_Z80
25 
26 #define TARGET_ARCH   bfd_arch_z80
27 #ifndef OBJ_COFF
28 #define TARGET_FORMAT "elf32-z80"
29 #endif
30 #define BFD_ARCH      TARGET_ARCH
31 #define TARGET_BYTES_BIG_ENDIAN  0
32 
33 /* If you define this macro, GAS will warn about the
34    use of nonstandard escape sequences in a string.  */
35 #define ONLY_STANDARD_ESCAPES
36 
37 /* GAS will call this function for any expression that can not be
38    recognized.  When the function is called, `input_line_pointer'
39    will point to the start of the expression.  */
40 #define md_operand(x)
41 
42 /* This should just call either `number_to_chars_bigendian' or
43    `number_to_chars_littleendian', whichever is appropriate.  On
44    targets like the MIPS which support options to change the
45    endianness, which function to call is a runtime decision.  On
46    other targets, `md_number_to_chars' can be a simple macro.  */
47 #define md_number_to_chars number_to_chars_littleendian
48 
49 #define TC_COUNT_RELOC(x) 1
50 
51 #define TC_COFF_FIX2RTYPE(fixP) tc_coff_fix2rtype (fixP)
52 #define md_convert_frag(b,s,f)   as_fatal ("convert_frag called\n")
53 #define md_estimate_size_before_relax(f,s) \
54   (as_fatal (_("estimate_size_before_relax called")), 1)
55 
56 /* Define some functions to be called by generic code.  */
57 #define md_finish               z80_md_finish
58 #define md_start_line_hook() { if (z80_start_line_hook ()) continue; }
59 #define TC_CONS_FIX_NEW(f,w,s,e,r)  z80_cons_fix_new ((f), (w), (s), (e))
60 
61 extern void z80_md_finish (void);
62 extern int z80_start_line_hook (void);
63 extern void z80_cons_fix_new (fragS *, int, int, expressionS *);
64 
65 #define WORKING_DOT_WORD
66 
67 /* If you define this macro, it means that `tc_gen_reloc' may return
68    multiple relocation entries for a single fixup.  In this case, the
69    return value of `tc_gen_reloc' is a pointer to a null terminated
70    array.  */
71 #undef RELOC_EXPANSION_POSSIBLE
72 
73 /* No shared lib support, so we don't need to ensure
74    externally visible symbols can be overridden.  */
75 #define EXTERN_FORCE_RELOC 0
76 
77 /* Values passed to md_apply_fix3 don't include the symbol value.  */
78 #define MD_APPLY_SYM_VALUE(FIX) 0
79 
80 #define LISTING_WORD_SIZE 1
81 
82 /* A single '=' is accepted as a comparison operator.  */
83 #define O_SINGLE_EQ O_eq
84 
85 /* A '$' is used to refer to the current location or as a hex. prefix.  */
86 #define DOLLAR_DOT
87 #define DOLLAR_AMBIGU                1
88 #define LOCAL_LABEL_PREFIX           '.'
89 #define LOCAL_LABELS_FB              1
90 #define LOCAL_LABELS_DOLLAR          1
91 #define LITERAL_PREFIXPERCENT_BIN
92 #define NUMBERS_WITH_SUFFIX          1
93 #define NO_PSEUDO_DOT                1
94 /* We allow single quotes to delimit character constants as
95    well, but it is cleaner to handle that in tc-z80.c.  */
96 #define SINGLE_QUOTE_STRINGS
97 
98 #define LABELS_WITHOUT_COLONS (z80_tc_labels_without_colon())
99 extern int z80_tc_labels_without_colon (void);
100 
101 /* An `.lcomm' directive with no explicit alignment parameter will
102    use this macro to set P2VAR to the alignment that a request for
103    SIZE bytes will have.  The alignment is expressed as a power of
104    two.  If no alignment should take place, the macro definition
105    should do nothing.  Some targets define a `.bss' directive that is
106    also affected by this macro.  The default definition will set
107    P2VAR to the truncated power of two of sizes up to eight bytes.  */
108 #define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) (P2VAR) = 0
109 
110 /* It does not make any sense to perform arithmetic on the numbers
111    we use to identify registers.  */
112 #define md_register_arithmetic 0
113 
114 #define TC_LABEL_IS_LOCAL z80_tc_label_is_local
115 extern int z80_tc_label_is_local (const char *name);
116 
117 #define elf_tc_final_processing	z80_elf_final_processing
118 extern void z80_elf_final_processing (void);
119 
120 /* Define the column that represents the PC.  */
121 #define DWARF2_DEFAULT_RETURN_COLUMN	5
122 
123 /* The stack grows down, and is only byte aligned.  */
124 #define DWARF2_CIE_DATA_ALIGNMENT	-1
125 
126 /* Z80 instructions are 1 or 4 bytes long.  */
127 #define DWARF2_LINE_MIN_INSN_LENGTH	1
128 
129 /* 16 bits addresses are used on Z80.  */
130 #define DWARF2_ADDR_SIZE(bfd)		z80_dwarf2_addr_size(bfd)
131 extern int z80_dwarf2_addr_size (const bfd *abfd);
132 
133 /* CFI hooks.  */
134 #define tc_cfi_frame_initial_instructions z80_tc_frame_initial_instructions
135 extern void z80_tc_frame_initial_instructions (void);
136 
137 #define tc_regname_to_dw2regnum z80_tc_regname_to_dw2regnum
138 extern int z80_tc_regname_to_dw2regnum (const char *regname);
139 
140 #endif
141