ce16e97c521c5b10531c7edaef6a0f8851644d6e
[external/binutils.git] / gas / config / tc-cris.h
1 /* tc-cris.h -- Header file for tc-cris.c, the CRIS GAS port.
2    Copyright (C) 2000-2016 Free Software Foundation, Inc.
3
4    Contributed by Axis Communications AB, Lund, Sweden.
5    Originally written for GAS 1.38.1 by Mikael Asker.
6    Updates, BFDizing, GNUifying and ELF by Hans-Peter Nilsson.
7
8    This file is part of GAS, the GNU Assembler.
9
10    GAS is free software; you can redistribute it and/or modify
11    it under the terms of the GNU General Public License as published by
12    the Free Software Foundation; either version 3, or (at your option)
13    any later version.
14
15    GAS is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with GAS; see the file COPYING.  If not, write to the
22    Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
23    MA 02110-1301, USA.  */
24
25 /* See the GAS "internal" document for general documentation on this.
26    It is called internals.texi (internals.info when makeinfo:d), but is
27    not installed or makeinfo:d by "make info".  */
28
29 /* Functions and variables that aren't declared in tc.h are declared here,
30    with the type/prototype that is used in the local extern-declaration of
31    their usage.  */
32
33 #ifndef TC_CRIS
34 #define TC_CRIS
35
36 /* Multi-target support is always on.  */
37 extern const char *cris_target_format (void);
38 #define TARGET_FORMAT cris_target_format ()
39
40 #define TARGET_ARCH bfd_arch_cris
41
42 extern unsigned int cris_mach (void);
43 #define TARGET_MACH (cris_mach ())
44
45 #define TARGET_BYTES_BIG_ENDIAN 0
46
47 extern const char *md_shortopts;
48 extern struct option md_longopts[];
49 extern size_t md_longopts_size;
50
51 extern const pseudo_typeS md_pseudo_table[];
52
53 #define tc_comment_chars cris_comment_chars
54 extern const char cris_comment_chars[];
55 extern const char line_comment_chars[];
56 extern const char line_separator_chars[];
57
58 /* This should be optional, since it is ignored as an escape (assumed to
59    be itself) if it is not recognized.  */
60 #define ONLY_STANDARD_ESCAPES
61
62 /* Note that we do not define TC_EQUAL_IN_INSN, since its current use is
63    in the instruction rather than the operand, and thus does not come to
64    use for side-effect assignments such as "and.d [r0 = r1 + 42], r3".  */
65 #define md_operand(x)
66
67 #define md_number_to_chars number_to_chars_littleendian
68 extern const struct relax_type md_cris_relax_table[];
69 #define TC_GENERIC_RELAX_TABLE md_cris_relax_table
70
71 long cris_relax_frag (segT, fragS *, long);
72
73 /* GAS only handles relaxations for pc-relative data targeting addresses
74    in the same segment, so we have to handle the rest on our own.  */
75 #define md_relax_frag(SEG, FRAGP, STRETCH)              \
76  ((FRAGP)->fr_symbol != NULL                            \
77   && S_GET_SEGMENT ((FRAGP)->fr_symbol) == (SEG)        \
78   ? relax_frag (SEG, FRAGP, STRETCH)                    \
79   : cris_relax_frag (SEG, FRAGP, STRETCH))
80
81 #define TC_FORCE_RELOCATION(FIX) md_cris_force_relocation (FIX)
82 extern int md_cris_force_relocation (struct fix *);
83
84 #define IS_CRIS_PIC_RELOC(RTYPE)                        \
85   ((RTYPE) == BFD_RELOC_CRIS_16_GOT                     \
86    || (RTYPE) == BFD_RELOC_CRIS_32_GOT                  \
87    || (RTYPE) == BFD_RELOC_CRIS_16_GOTPLT               \
88    || (RTYPE) == BFD_RELOC_CRIS_32_GOTPLT               \
89    || (RTYPE) == BFD_RELOC_CRIS_32_GOTREL               \
90    || (RTYPE) == BFD_RELOC_CRIS_32_PLT_GOTREL           \
91    || (RTYPE) == BFD_RELOC_CRIS_32_PLT_PCREL)
92
93 /* Make sure we don't resolve fixups for which we want to emit dynamic
94    relocations.  */
95 #define TC_FORCE_RELOCATION_LOCAL(FIX)                  \
96   (!(FIX)->fx_pcrel                                     \
97    || IS_CRIS_PIC_RELOC ((FIX)->fx_r_type)              \
98    || TC_FORCE_RELOCATION (FIX))
99
100 /* For some reloc types, don't adjust fixups by reducing to a section
101    symbol.  */
102 #define tc_fix_adjustable(FIX)                          \
103  ((FIX)->fx_r_type != BFD_RELOC_VTABLE_INHERIT          \
104   && (FIX)->fx_r_type != BFD_RELOC_VTABLE_ENTRY         \
105   && (! IS_CRIS_PIC_RELOC ((FIX)->fx_r_type)            \
106       || (FIX)->fx_r_type == BFD_RELOC_CRIS_32_GOTREL))
107
108 /* FIXME: This *should* be a redundant definition, as the
109    TC_FORCE_RELOCATION* definitions already told about the cases where
110    we *don't* want the symbol value calculated.  Here we seem to answer
111    the "are you sure" question.  It certainly has very little to do with
112    whether the symbol value is passed to md_apply_fix.  */
113 #define MD_APPLY_SYM_VALUE(FIX) 0
114
115 /* When we have fixups against constant expressions, we get a GAS-specific
116    section symbol at no extra charge for obscure reasons in
117    adjust_reloc_syms.  Since ELF outputs section symbols, it gladly
118    outputs this "*ABS*" symbol in every object.  Avoid that.
119    Also, don't emit undefined symbols (that aren't used in relocations).
120    They pop up when tentatively parsing register names as symbols.  */
121 #define tc_frob_symbol(symp, punt)                      \
122  do {                                                   \
123   if ((OUTPUT_FLAVOR == bfd_target_elf_flavour          \
124        && (symp) == section_symbol (absolute_section))  \
125       || ! S_IS_DEFINED (symp))                         \
126     (punt) = 1;                                         \
127  } while (0)
128
129 #define LISTING_HEADER "GAS for CRIS"
130
131 #if 0
132 /* The testsuite does not let me define these, although they IMHO should
133    be preferred over the default.  */
134 #define LISTING_WORD_SIZE 2
135 #define LISTING_LHS_WIDTH 4
136 #define LISTING_LHS_WIDTH_SECOND 4
137 #endif
138
139 /* END of declaration and definitions described in the "internals"
140    document.  */
141
142 /* Do this, or we will never know what hit us when the
143    broken-word-fixes break.  Do _not_ use WARN_SIGNED_OVERFLOW_WORD,
144    it is only for use with WORKING_DOT_WORD and warns about most stuff.
145    (still in 2.9.1).  */
146 struct broken_word;
147 extern void tc_cris_check_adjusted_broken_word (offsetT,
148                                                 struct broken_word *);
149 #define TC_CHECK_ADJUSTED_BROKEN_DOT_WORD(new_offset, brokw) \
150  tc_cris_check_adjusted_broken_word ((offsetT) (new_offset), brokw)
151
152 /* We don't want any implicit alignment, so we do nothing.  */
153 #define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) do { } while (0)
154
155 /* CRIS instructions, with operands and prefixes included, are a multiple
156    of two bytes long.  */
157 #define DWARF2_LINE_MIN_INSN_LENGTH 2
158
159 /* Make port immune to unwanted difference in te-generic.h vs. te-linux.h.  */
160 #define LOCAL_LABELS_DOLLAR 1
161
162 #endif /* TC_CRIS */
163 /*
164  * Local variables:
165  * eval: (c-set-style "gnu")
166  * indent-tabs-mode: t
167  * End:
168  */