xref: /netbsd/external/gpl3/gdb/dist/gas/config/tc-m32r.h (revision 1424dfb3)
1*1424dfb3Schristos /* tc-m32r.h -- Header file for tc-m32r.c.
2*1424dfb3Schristos    Copyright (C) 1996-2020 Free Software Foundation, Inc.
3*1424dfb3Schristos 
4*1424dfb3Schristos    This file is part of GAS, the GNU Assembler.
5*1424dfb3Schristos 
6*1424dfb3Schristos    GAS is free software; you can redistribute it and/or modify
7*1424dfb3Schristos    it under the terms of the GNU General Public License as published by
8*1424dfb3Schristos    the Free Software Foundation; either version 3, or (at your option)
9*1424dfb3Schristos    any later version.
10*1424dfb3Schristos 
11*1424dfb3Schristos    GAS is distributed in the hope that it will be useful,
12*1424dfb3Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*1424dfb3Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*1424dfb3Schristos    GNU General Public License for more details.
15*1424dfb3Schristos 
16*1424dfb3Schristos    You should have received a copy of the GNU General Public License
17*1424dfb3Schristos    along with GAS; see the file COPYING.  If not, write to
18*1424dfb3Schristos    the Free Software Foundation, 51 Franklin Street - Fifth Floor,
19*1424dfb3Schristos    Boston, MA 02110-1301, USA.  */
20*1424dfb3Schristos 
21*1424dfb3Schristos #define TC_M32R
22*1424dfb3Schristos 
23*1424dfb3Schristos #define LISTING_HEADER \
24*1424dfb3Schristos   (target_big_endian ? "M32R GAS" : "M32R GAS Little Endian")
25*1424dfb3Schristos 
26*1424dfb3Schristos /* The target BFD architecture.  */
27*1424dfb3Schristos #define TARGET_ARCH bfd_arch_m32r
28*1424dfb3Schristos 
29*1424dfb3Schristos /* The endianness of the target format may change based on command
30*1424dfb3Schristos    line arguments.  */
31*1424dfb3Schristos #define TARGET_FORMAT m32r_target_format()
32*1424dfb3Schristos extern const char *m32r_target_format (void);
33*1424dfb3Schristos 
34*1424dfb3Schristos /* Default to big endian.  */
35*1424dfb3Schristos #ifndef TARGET_BYTES_BIG_ENDIAN
36*1424dfb3Schristos #define TARGET_BYTES_BIG_ENDIAN 1
37*1424dfb3Schristos #endif
38*1424dfb3Schristos 
39*1424dfb3Schristos /* Call md_pcrel_from_section, not md_pcrel_from.  */
40*1424dfb3Schristos #define MD_PCREL_FROM_SECTION(FIX, SEC) md_pcrel_from_section(FIX, SEC)
41*1424dfb3Schristos 
42*1424dfb3Schristos /* Permit temporary numeric labels.  */
43*1424dfb3Schristos #define LOCAL_LABELS_FB 1
44*1424dfb3Schristos 
45*1424dfb3Schristos #define DIFF_EXPR_OK		/* .-foo gets turned into PC relative relocs.  */
46*1424dfb3Schristos 
47*1424dfb3Schristos /* We don't need to handle .word strangely.  */
48*1424dfb3Schristos #define WORKING_DOT_WORD
49*1424dfb3Schristos 
50*1424dfb3Schristos /* For 8 vs 16 vs 32 bit branch selection.  */
51*1424dfb3Schristos extern const struct relax_type md_relax_table[];
52*1424dfb3Schristos #define TC_GENERIC_RELAX_TABLE md_relax_table
53*1424dfb3Schristos 
54*1424dfb3Schristos extern long m32r_relax_frag (segT, fragS *, long);
55*1424dfb3Schristos #define md_relax_frag(segment, fragP, stretch) \
56*1424dfb3Schristos   m32r_relax_frag (segment, fragP, stretch)
57*1424dfb3Schristos 
58*1424dfb3Schristos /* Account for nop if 32 bit insn falls on odd halfword boundary.  */
59*1424dfb3Schristos #define TC_CGEN_MAX_RELAX(insn, len)	6
60*1424dfb3Schristos 
61*1424dfb3Schristos /* Fill in rs_align_code fragments.  */
62*1424dfb3Schristos extern void m32r_handle_align (fragS *);
63*1424dfb3Schristos #define HANDLE_ALIGN(f)  m32r_handle_align (f)
64*1424dfb3Schristos 
65*1424dfb3Schristos #define MAX_MEM_FOR_RS_ALIGN_CODE  (1 + 2 + 4)
66*1424dfb3Schristos 
67*1424dfb3Schristos /* Values passed to md_apply_fix don't include the symbol value.  */
68*1424dfb3Schristos #define MD_APPLY_SYM_VALUE(FIX) 0
69*1424dfb3Schristos 
70*1424dfb3Schristos #define md_apply_fix gas_cgen_md_apply_fix
71*1424dfb3Schristos 
72*1424dfb3Schristos #define tc_fix_adjustable(FIX) m32r_fix_adjustable (FIX)
73*1424dfb3Schristos bfd_boolean m32r_fix_adjustable (struct fix *);
74*1424dfb3Schristos 
75*1424dfb3Schristos /* After creating a fixup for an instruction operand, we need to check for
76*1424dfb3Schristos    HI16 relocs and queue them up for later sorting.  */
77*1424dfb3Schristos #define md_cgen_record_fixup_exp m32r_cgen_record_fixup_exp
78*1424dfb3Schristos 
79*1424dfb3Schristos #define TC_HANDLES_FX_DONE
80*1424dfb3Schristos 
81*1424dfb3Schristos extern int pic_code;
82*1424dfb3Schristos 
83*1424dfb3Schristos extern bfd_boolean m32r_fix_adjustable (struct fix *);
84*1424dfb3Schristos 
85*1424dfb3Schristos /* This arranges for gas/write.c to not apply a relocation if
86*1424dfb3Schristos    obj_fix_adjustable() says it is not adjustable.  */
87*1424dfb3Schristos #define TC_FIX_ADJUSTABLE(fixP) obj_fix_adjustable (fixP)
88*1424dfb3Schristos 
89*1424dfb3Schristos #define tc_frob_file_before_fix() m32r_frob_file ()
90*1424dfb3Schristos extern void m32r_frob_file (void);
91*1424dfb3Schristos 
92*1424dfb3Schristos /* No shared lib support, so we don't need to ensure externally
93*1424dfb3Schristos    visible symbols can be overridden.
94*1424dfb3Schristos #define EXTERN_FORCE_RELOC 0 */
95*1424dfb3Schristos 
96*1424dfb3Schristos /* When relaxing, we need to emit various relocs we otherwise wouldn't.  */
97*1424dfb3Schristos #define TC_FORCE_RELOCATION(fix) m32r_force_relocation (fix)
98*1424dfb3Schristos extern int m32r_force_relocation (struct fix *);
99*1424dfb3Schristos 
100*1424dfb3Schristos /* Ensure insns at labels are aligned to 32 bit boundaries.  */
101*1424dfb3Schristos int m32r_fill_insn (int);
102*1424dfb3Schristos #define TC_START_LABEL(STR, NUL_CHAR, NEXT_CHAR)	\
103*1424dfb3Schristos   (NEXT_CHAR == ':' && m32r_fill_insn (0))
104*1424dfb3Schristos 
105*1424dfb3Schristos #define md_cleanup()               m32r_fill_insn (1)
106*1424dfb3Schristos #define md_elf_section_change_hook m32r_elf_section_change_hook
107*1424dfb3Schristos extern void m32r_elf_section_change_hook (void);
108*1424dfb3Schristos 
109*1424dfb3Schristos #define md_flush_pending_output()       m32r_flush_pending_output ()
110*1424dfb3Schristos extern void m32r_flush_pending_output (void);
111*1424dfb3Schristos 
112*1424dfb3Schristos #define elf_tc_final_processing 	m32r_elf_final_processing
113*1424dfb3Schristos extern void m32r_elf_final_processing (void);
114*1424dfb3Schristos 
115*1424dfb3Schristos #define md_parse_name(name, exprP, mode, nextcharP) \
116*1424dfb3Schristos   m32r_parse_name ((name), (exprP), (mode), (nextcharP))
117*1424dfb3Schristos extern int m32r_parse_name (char const *, expressionS *, enum expr_mode, char *);
118*1424dfb3Schristos 
119*1424dfb3Schristos /* This is used to construct expressions out of @GOTOFF, @PLT and @GOT
120*1424dfb3Schristos    symbols.  The relocation type is stored in X_md.  */
121*1424dfb3Schristos #define O_PIC_reloc O_md1
122*1424dfb3Schristos 
123*1424dfb3Schristos #define TC_CGEN_PARSE_FIX_EXP(opinfo, exp) \
124*1424dfb3Schristos   m32r_cgen_parse_fix_exp(opinfo, exp)
125*1424dfb3Schristos extern int m32r_cgen_parse_fix_exp (int, expressionS *);
126