include/elf/
[binutils-gdb.git] / gas / config / tc-spu.h
1 /* spu.h -- Assembler for spu
2
3 Copyright 2006, 2007 Free Software Foundation, Inc.
4
5 This file is part of GAS, the GNU Assembler.
6
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
20 02110-1301, USA. */
21
22 #define TC_SPU
23
24 #include "opcode/spu.h"
25
26 #ifdef OBJ_ELF
27 #define TARGET_FORMAT "elf32-spu"
28 #define TARGET_ARCH bfd_arch_spu
29 #define TARGET_NAME "elf32-spu"
30 #endif
31
32 #define TARGET_BYTES_BIG_ENDIAN 1
33
34 #ifndef TARGET_NAME
35 #define TARGET_NAME "coff-spu"
36 #endif
37
38 #ifndef TARGET_ARCH
39 #define TARGET_ARCH bfd_arch_spu
40 #endif
41
42 #define COFF_MAGIC SPU_MAGIC
43 #define BFD_ARCH bfd_arch_spu
44
45 #define NEED_FX_R_TYPE
46 #define TC_KEEP_FX_OFFSET
47 /* #define TC_CONS_RELOC RELOC_32 */
48
49 struct tc_fix_info {
50 unsigned short arg_format;
51 unsigned short insn_tag;
52 };
53
54 /* fixS will have a member named tc_fix_data of this type. */
55 #define TC_FIX_TYPE struct tc_fix_info
56 #define TC_INIT_FIX_DATA(FIXP) \
57 do \
58 { \
59 (FIXP)->tc_fix_data.arg_format = 0; \
60 (FIXP)->tc_fix_data.insn_tag = 0; \
61 } \
62 while (0)
63
64 /* Don't reduce function symbols to section symbols, and don't adjust
65 references to PPU symbols. */
66 #define tc_fix_adjustable(FIXP) \
67 (!(S_IS_FUNCTION ((FIXP)->fx_addsy) \
68 || (FIXP)->fx_r_type == BFD_RELOC_SPU_PPU32 \
69 || (FIXP)->fx_r_type == BFD_RELOC_SPU_PPU64))
70
71 /* Keep relocs on calls. Branches to function symbols are tail or
72 sibling calls. */
73 #define TC_FORCE_RELOCATION(FIXP) \
74 ((FIXP)->tc_fix_data.insn_tag == M_BRSL \
75 || (FIXP)->tc_fix_data.insn_tag == M_BRASL \
76 || (((FIXP)->tc_fix_data.insn_tag == M_BR \
77 || (FIXP)->tc_fix_data.insn_tag == M_BRA) \
78 && (FIXP)->fx_addsy != NULL \
79 && S_IS_FUNCTION ((FIXP)->fx_addsy)) \
80 || (FIXP)->fx_r_type == BFD_RELOC_SPU_PPU32 \
81 || (FIXP)->fx_r_type == BFD_RELOC_SPU_PPU64 \
82 || generic_force_reloc (FIXP))
83
84 /* Values passed to md_apply_fix don't include symbol values. */
85 #define MD_APPLY_SYM_VALUE(FIX) 0
86
87 /* The spu uses pseudo-ops with no leading period. */
88 #define NO_PSEUDO_DOT 1
89
90 /* Don't warn on word overflow; it happens on %hi relocs. */
91 #undef WARN_SIGNED_OVERFLOW_WORD
92
93 #ifdef OBJ_ELF
94 #define DIFF_EXPR_OK
95 #endif
96
97 #define WORKING_DOT_WORD
98
99 #define md_number_to_chars number_to_chars_bigendian
100
101 #define md_convert_frag(b,s,f) {as_fatal (_("spu convert_frag\n"));}
102
103 /* We don't need to do anything special for undefined symbols. */
104 #define md_undefined_symbol(s) 0
105
106 /* We have no special operand handling. */
107 #define md_operand(e)
108
109 /* Fill in rs_align_code fragments. */
110 extern void spu_handle_align PARAMS ((fragS *));
111 #define HANDLE_ALIGN(frag) spu_handle_align (frag)
112
113 #define MAX_MEM_FOR_RS_ALIGN_CODE (7 + 8)
114
115 #ifdef SPUCOFF
116
117 /* Whether a reloc should be output. */
118 #define TC_COUNT_RELOC(fixp) ((fixp)->fx_addsy != NULL || (fixp)->fx_subsy != NULL)
119
120 /* Get the BFD reloc type to use for a gas fixS structure. */
121 #define TC_COFF_FIX2RTYPE(fixp) tc_coff_fix2rtype (fixp)
122
123 /* No special hook needed for symbols. */
124 #define tc_coff_symbol_emit_hook(s)
125
126 /* Align sections to a four byte boundary. */
127 #ifndef max
128 #define max(a,b) (((a) > (b)) ? (a) : (b))
129 #endif
130 #define SUB_SEGMENT_ALIGN(SEG) max (section_alignment[(int) (SEG)], 4)
131
132 #endif /* SPUCOFF */