1/* tc-csky.h -- Header file for tc-csky.c
2   Copyright (C) 1989-2020 Free Software Foundation, Inc.
3   Contributed by C-SKY Microsystems and Mentor Graphics.
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 3, 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#ifndef TC_CSKY
23#define TC_CSKY 1
24
25#define WORKING_DOT_WORD
26
27#define TARGET_ARCH    bfd_arch_csky
28
29#define LISTING_HEADER "CSKY GAS"
30
31#ifdef OBJ_ELF
32#define TARGET_FORMAT elf32_csky_target_format ()
33#endif
34
35#define TARGET_BYTES_BIG_ENDIAN 0
36
37#define MD_PCREL_FROM_SECTION(F,S) md_pcrel_from_section (F, S)
38
39#define TC_GENERIC_RELAX_TABLE     csky_relax_table
40
41#define md_end                        md_csky_end
42#define md_relax_frag                 csky_relax_frag
43#define DOUBLESLASH_LINE_COMMENTS
44#define LOCAL_LABELS_FB     1
45#define PAD_LITERAL_LENGTH  6
46#define PAD_FILL_CONTENT    0x1c00
47
48/* Reloc API.  */
49#define EXTERN_FORCE_RELOC  1
50#define TC_CONS_FIX_NEW               csky_cons_fix_new
51#define TC_FORCE_RELOCATION(fix)      csky_force_relocation (fix)
52#define tc_fix_adjustable(FIX)        csky_fix_adjustable (FIX)
53#define TC_SEGMENT_INFO_TYPE          csky_segment_info_type
54
55/* Dwarf API.  */
56#define DWARF2_LINE_MIN_INSN_LENGTH   2
57#define DWARF2_ADDR_SIZE(bfd)   4
58#define DWARF2_FDE_RELOC_SIZE   4
59#define TARGET_USE_CFIPOP 1
60#define tc_cfi_frame_initial_instructions csky_cfi_frame_initial_instructions
61#define tc_regname_to_dw2regnum tc_csky_regname_to_dw2regnum
62#define DWARF2_DEFAULT_RETURN_COLUMN 15
63#define DWARF2_CIE_DATA_ALIGNMENT (-4)
64
65/* .-foo gets turned into PC relative relocs.  */
66#define DIFF_EXPR_OK 1
67
68typedef enum
69{
70  MAP_UNDEFINED = 0,
71  MAP_DATA,
72  MAP_TEXT,
73} map_state;
74
75typedef struct
76{
77  map_state current_state;
78} csky_segment_info_type;
79
80struct tls_addend
81{
82  fragS *frag;
83  offsetT offset;
84};
85
86#define TC_FIX_TYPE struct tls_addend
87#define TC_INIT_FIX_DATA(FIX) \
88  { (FIX)->tc_fix_data.frag = NULL; (FIX)->tc_fix_data.offset = 0; }
89
90#include "write.h"
91extern const relax_typeS csky_relax_table [];
92
93extern void md_csky_end (void);
94extern void csky_cons_fix_new (fragS *,
95			       unsigned int off,
96			       unsigned int len,
97			       expressionS *,
98			       bfd_reloc_code_real_type);
99extern int csky_force_relocation (fixS *);
100extern bfd_boolean csky_fix_adjustable (fixS *);
101extern void csky_cfi_frame_initial_instructions (void);
102extern int tc_csky_regname_to_dw2regnum (char *);
103extern long csky_relax_frag (segT, fragS *, long);
104
105#ifdef OBJ_ELF
106const char * elf32_csky_target_format (void);
107#endif
108
109#endif
110