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