1 /* tc-ft32.h -- Header file for tc-ft32.c.
2 
3    Copyright (C) 2013-2020 Free Software Foundation, Inc.
4    Contributed by FTDI (support@ftdichip.com)
5 
6    This file is part of GAS, the GNU Assembler.
7 
8    GAS is free software; you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation; either version 3, or (at your option)
11    any later version.
12 
13    GAS is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License along
19    with GAS; see the file COPYING.  If not, write to the Free Software
20    Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
21 
22 #define TC_FT32 1
23 #define TARGET_BYTES_BIG_ENDIAN 0
24 #define WORKING_DOT_WORD
25 
26 /* This macro is the BFD architecture to pass to `bfd_set_arch_mach'.  */
27 #define TARGET_FORMAT  "elf32-ft32"
28 
29 #define TARGET_ARCH bfd_arch_ft32
30 
31 #define md_undefined_symbol(NAME)           0
32 
33 /* These macros must be defined, but is will be a fatal assembler
34    error if we ever hit them.  */
35 #define md_estimate_size_before_relax(A, B) (as_fatal (_("estimate size\n")), 0)
36 #define md_convert_frag(B, S, F)            (as_fatal (_("convert_frag\n")))
37 
38 /* PC relative operands are relative to the start of the opcode, and
39    the operand is always one byte into the opcode.  */
40 #define md_pcrel_from(FIX)						\
41 	((FIX)->fx_where + (FIX)->fx_frag->fr_address - 1)
42 
43 #define md_section_align(SEGMENT, SIZE)     (SIZE)
44 
45 /* If this macro returns non-zero, it guarantees that a relocation will be emitted
46    even when the value can be resolved locally. Do that if linkrelax is turned on */
47 #define TC_FORCE_RELOCATION(fix)	ft32_force_relocation (fix)
48 #define TC_FORCE_RELOCATION_SUB_SAME(fix, seg) \
49   (! SEG_NORMAL (seg) || ft32_force_relocation (fix))
50 extern int ft32_force_relocation (struct fix *);
51 
52 #define TC_LINKRELAX_FIXUP(seg) \
53   ((seg->flags & SEC_CODE) || (seg->flags & SEC_DEBUGGING))
54 
55 /* This macro is evaluated for any fixup with a fx_subsy that
56    fixup_segment cannot reduce to a number.  If the macro returns
57    false an error will be reported. */
58 #define TC_VALIDATE_FIX_SUB(fix, seg)   ft32_validate_fix_sub (fix)
59 extern int ft32_validate_fix_sub (struct fix *);
60 
61 /* The difference between same-section symbols may be affected by linker
62    relaxation, so do not resolve such expressions in the assembler.  */
63 #define md_allow_local_subtract(l,r,s) ft32_allow_local_subtract (l, r, s)
64 extern bfd_boolean ft32_allow_local_subtract (expressionS *,
65                                               expressionS *,
66                                               segT);
67 
68 #define md_operand(x)
69