1 /* tc-microblaze.h -- Header file for tc-microblaze.c.
2 
3    Copyright (C) 2009-2018 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 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_MICROBLAZE
23 #define TC_MICROBLAZE 1
24 
25 #define TARGET_ARCH	bfd_arch_microblaze
26 #ifndef TARGET_BYTES_BIG_ENDIAN
27 /* Used to initialise target_big_endian.  */
28 #define TARGET_BYTES_BIG_ENDIAN 1
29 #endif
30 
31 #define IGNORE_NONSTANDARD_ESCAPES
32 
33 #define TC_RELOC_MANGLE(a,b,c) tc_reloc_mangle (a, b, c)
34 
35 /* We need to handle expressions of type "symbol op symbol" and create
36    relocs for such expressions as -relax in linker can change the value
37    of such expressions */
38 #define TC_CONS_FIX_NEW cons_fix_new_microblaze
39 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \
40   parse_cons_expression_microblaze (EXP, NBYTES)
41 extern bfd_reloc_code_real_type parse_cons_expression_microblaze
42   (expressionS *, int);
43 
44 #define TC_FORCE_RELOCATION_SECTION(FIXP,SEG) 1
45 #define UNDEFINED_DIFFERENCE_OK 1
46 
47 #define TC_FORCE_RELOCATION_LOCAL(FIX)				\
48   (GENERIC_FORCE_RELOCATION_LOCAL (FIX)				\
49    || (FIX)->fx_r_type == BFD_RELOC_MICROBLAZE_64_GOT		\
50    || (FIX)->fx_r_type == BFD_RELOC_MICROBLAZE_64_PLT		\
51    || (FIX)->fx_r_type == BFD_RELOC_MICROBLAZE_64_GOTOFF	\
52    || (FIX)->fx_r_type == BFD_RELOC_MICROBLAZE_32_GOTOFF)
53 
54 #define tc_fix_adjustable(X)  tc_microblaze_fix_adjustable(X)
55 extern int tc_microblaze_fix_adjustable (struct fix *);
56 
57 extern const struct relax_type md_relax_table[];
58 #define TC_GENERIC_RELAX_TABLE md_relax_table
59 
60 /* We don't need to handle .word strangely.  */
61 #define WORKING_DOT_WORD
62 
63 #define LISTING_HEADER        	"Xilinx MicroBlaze GAS Listing"
64 #define LISTING_LHS_CONT_LINES	4
65 
66 #define NEED_FX_R_TYPE	1
67 
68 /* We want local label support.  */
69 #define LOCAL_LABELS_FB 1
70 
71 /* Want the section information too... */
72 #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
73 
74 #define MD_APPLY_FIX3  /* We want the segment as well.  */
75 
76 /* We set the fx_done field appropriately in md_apply_fix.  */
77 #define TC_HANDLES_FX_DONE
78 
79 #ifdef OBJ_ELF
80 
81 #define TARGET_FORMAT (target_big_endian ? "elf32-microblaze" : "elf32-microblazeel")
82 
83 #define ELF_TC_SPECIAL_SECTIONS \
84   { ".sdata",		SHT_PROGBITS,	SHF_ALLOC + SHF_WRITE }, \
85   { ".sbss",		SHT_NOBITS,	SHF_ALLOC + SHF_WRITE }, \
86   { ".sdata2",		SHT_PROGBITS,	SHF_ALLOC }, \
87   { ".sbss2",		SHT_PROGBITS,	SHF_ALLOC }, \
88 /* Other special sections not generated by the assembler: .reginfo,
89    .liblist, .conflict, .gptab, .got, .dynamic, .rel.dyn.  */
90 
91 #endif /* OBJ_ELF */
92 
93 #ifndef TARGET_FORMAT
94 # error No target format specified.
95 #endif
96 
97 #include "write.h"        /* For definition of fixS */
98 
99 extern void      md_begin            (void);
100 extern void      md_assemble         (char *);
101 extern symbolS * md_undefined_symbol (char *);
102 extern void      md_show_usage       (FILE *);
103 extern void      md_convert_frag               (bfd *, segT, fragS *);
104 extern void      md_operand                    (expressionS *);
105 extern int       md_estimate_size_before_relax (fragS *, segT);
106 extern void      md_number_to_chars            (char *, valueT, int);
107 extern valueT    md_section_align              (segT, valueT);
108 extern long      md_pcrel_from_section         (fixS *, segT);
109 extern arelent * tc_gen_reloc                  (asection *, fixS *);
110 extern void 	 cons_fix_new_microblaze       (fragS *, int, int,
111 						expressionS *,
112 						bfd_reloc_code_real_type);
113 extern void 	 md_apply_fix3 		       (fixS *, valueT *, segT);
114 
115 #define EXTERN_FORCE_RELOC -1
116 
117 #endif /* TC_MICROBLAZE */
118