1*3d8817e4Smiod /* tc-mn10300.h -- Header file for tc-mn10300.c.
2*3d8817e4Smiod    Copyright 1996, 1997, 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 the Free
19*3d8817e4Smiod    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20*3d8817e4Smiod    02110-1301, USA.  */
21*3d8817e4Smiod 
22*3d8817e4Smiod #define TC_MN10300
23*3d8817e4Smiod 
24*3d8817e4Smiod #define TARGET_BYTES_BIG_ENDIAN 0
25*3d8817e4Smiod 
26*3d8817e4Smiod #define DIFF_EXPR_OK
27*3d8817e4Smiod #define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_"
28*3d8817e4Smiod 
29*3d8817e4Smiod #define TC_RELOC_RTSYM_LOC_FIXUP(FIX)				\
30*3d8817e4Smiod   ((FIX)->fx_r_type != BFD_RELOC_32_PLT_PCREL			\
31*3d8817e4Smiod    && (FIX)->fx_r_type != BFD_RELOC_MN10300_GOT32		\
32*3d8817e4Smiod    && (FIX)->fx_r_type != BFD_RELOC_32_GOT_PCREL		\
33*3d8817e4Smiod    && ((FIX)->fx_addsy == NULL					\
34*3d8817e4Smiod        || (! S_IS_EXTERNAL ((FIX)->fx_addsy)			\
35*3d8817e4Smiod 	   && ! S_IS_WEAK ((FIX)->fx_addsy)			\
36*3d8817e4Smiod 	   && S_IS_DEFINED ((FIX)->fx_addsy)			\
37*3d8817e4Smiod 	   && ! S_IS_COMMON ((FIX)->fx_addsy))))
38*3d8817e4Smiod 
39*3d8817e4Smiod #define md_parse_name(name, exprP, mode, nextcharP) \
40*3d8817e4Smiod     mn10300_parse_name ((name), (exprP), (mode), (nextcharP))
41*3d8817e4Smiod int mn10300_parse_name PARAMS ((char const *, expressionS *,
42*3d8817e4Smiod 				enum expr_mode, char *));
43*3d8817e4Smiod 
44*3d8817e4Smiod #define TC_CONS_FIX_NEW(FRAG, OFF, LEN, EXP) \
45*3d8817e4Smiod      mn10300_cons_fix_new ((FRAG), (OFF), (LEN), (EXP))
46*3d8817e4Smiod void mn10300_cons_fix_new PARAMS ((fragS *, int, int, expressionS *));
47*3d8817e4Smiod 
48*3d8817e4Smiod /* This is used to construct expressions out of @GOTOFF, @PLT and @GOT
49*3d8817e4Smiod    symbols.  The relocation type is stored in X_md.  */
50*3d8817e4Smiod #define O_PIC_reloc O_md1
51*3d8817e4Smiod 
52*3d8817e4Smiod /* The target BFD architecture.  */
53*3d8817e4Smiod #define TARGET_ARCH bfd_arch_mn10300
54*3d8817e4Smiod 
55*3d8817e4Smiod #ifdef TE_LINUX
56*3d8817e4Smiod #define TARGET_FORMAT "elf32-am33lin"
57*3d8817e4Smiod #else
58*3d8817e4Smiod #define TARGET_FORMAT "elf32-mn10300"
59*3d8817e4Smiod #endif
60*3d8817e4Smiod 
61*3d8817e4Smiod 
62*3d8817e4Smiod /* Do not adjust relocations involving symbols in code sections,
63*3d8817e4Smiod    because it breaks linker relaxations.  This could be fixed in the
64*3d8817e4Smiod    linker, but this fix is simpler, and it pretty much only affects
65*3d8817e4Smiod    object size a little bit.  */
66*3d8817e4Smiod #define TC_FORCE_RELOCATION_SUB_SAME(FIX, SEC)	\
67*3d8817e4Smiod   (((SEC)->flags & SEC_CODE) != 0		\
68*3d8817e4Smiod    || ! SEG_NORMAL (SEC)			\
69*3d8817e4Smiod    || TC_FORCE_RELOCATION (FIX))
70*3d8817e4Smiod 
71*3d8817e4Smiod /* We validate subtract arguments within tc_gen_reloc(), so don't
72*3d8817e4Smiod    report errors at this point.  */
73*3d8817e4Smiod #define TC_VALIDATE_FIX_SUB(FIX) 1
74*3d8817e4Smiod 
75*3d8817e4Smiod /* Fixup debug sections since we will never relax them.  Ideally, we
76*3d8817e4Smiod    could do away with this and instead check every single fixup with
77*3d8817e4Smiod    TC_FORCE_RELOCATION and TC_FORCE_RELOCATION_SUB_NAME, verifying
78*3d8817e4Smiod    that the sections of the referenced symbols (and not the sections
79*3d8817e4Smiod    in which the fixup appears) may be subject to relaxation.  We'd
80*3d8817e4Smiod    still have to check the section in which the fixup appears, because
81*3d8817e4Smiod    we want to do some simplifications in debugging info that might
82*3d8817e4Smiod    break in real code.
83*3d8817e4Smiod 
84*3d8817e4Smiod    Using the infrastructure in write.c to simplify subtraction fixups
85*3d8817e4Smiod    would enable us to remove a lot of code from tc_gen_reloc(), but
86*3d8817e4Smiod    this is simpler, faster, and produces almost the same effect.
87*3d8817e4Smiod    Also, in the macros above, we can't check whether the fixup is in a
88*3d8817e4Smiod    debugging section or not, so we have to use this for now.  */
89*3d8817e4Smiod #define TC_LINKRELAX_FIXUP(seg) (seg->flags & SEC_ALLOC)
90*3d8817e4Smiod 
91*3d8817e4Smiod #define md_operand(x)
92*3d8817e4Smiod 
93*3d8817e4Smiod /* Permit temporary numeric labels.  */
94*3d8817e4Smiod #define LOCAL_LABELS_FB 1
95*3d8817e4Smiod 
96*3d8817e4Smiod /* We don't need to handle .word strangely.  */
97*3d8817e4Smiod #define WORKING_DOT_WORD
98*3d8817e4Smiod 
99*3d8817e4Smiod #define md_number_to_chars number_to_chars_littleendian
100*3d8817e4Smiod 
101*3d8817e4Smiod /* Don't bother to adjust relocs.  */
102*3d8817e4Smiod /* #define tc_fix_adjustable(FIX) 0 */
103*3d8817e4Smiod #define tc_fix_adjustable(FIX) mn10300_fix_adjustable (FIX)
104*3d8817e4Smiod extern bfd_boolean mn10300_fix_adjustable PARAMS ((struct fix *));
105*3d8817e4Smiod 
106*3d8817e4Smiod /* We do relaxing in the assembler as well as the linker.  */
107*3d8817e4Smiod extern const struct relax_type md_relax_table[];
108*3d8817e4Smiod #define TC_GENERIC_RELAX_TABLE md_relax_table
109*3d8817e4Smiod 
110*3d8817e4Smiod #define DWARF2_LINE_MIN_INSN_LENGTH 1
111