1 /* This file is tc-alpha.h
2    Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
3    2005
4    Free Software Foundation, Inc.
5    Written by Ken Raeburn <raeburn@cygnus.com>.
6 
7    This file is part of GAS, the GNU Assembler.
8 
9    GAS is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2, or (at your option)
12    any later version.
13 
14    GAS is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with GAS; see the file COPYING.  If not, write to the Free
21    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
22    02110-1301, USA.  */
23 
24 #define TC_ALPHA
25 
26 #define TARGET_BYTES_BIG_ENDIAN 0
27 
28 #define WORKING_DOT_WORD
29 
30 #define TARGET_ARCH			bfd_arch_alpha
31 
32 #ifdef TE_FreeBSD
33 #define ELF_TARGET_FORMAT	"elf64-alpha-freebsd"
34 #endif
35 #ifndef ELF_TARGET_FORMAT
36 #define ELF_TARGET_FORMAT	"elf64-alpha"
37 #endif
38 
39 #define TARGET_FORMAT (OUTPUT_FLAVOR == bfd_target_ecoff_flavour	\
40 		       ? "ecoff-littlealpha"				\
41 		       : OUTPUT_FLAVOR == bfd_target_elf_flavour	\
42 		       ? ELF_TARGET_FORMAT				\
43 		       : OUTPUT_FLAVOR == bfd_target_evax_flavour	\
44 		       ? "vms-alpha"					\
45 		       : "unknown-format")
46 
47 #define NEED_LITERAL_POOL
48 #define REPEAT_CONS_EXPRESSIONS
49 
50 struct fix;
51 struct alpha_reloc_tag;
52 
53 extern int alpha_force_relocation (struct fix *);
54 extern int alpha_fix_adjustable   (struct fix *);
55 
56 extern unsigned long alpha_gprmask, alpha_fprmask;
57 extern valueT alpha_gp_value;
58 
59 #define TC_FORCE_RELOCATION(FIX)	alpha_force_relocation (FIX)
60 #define tc_fix_adjustable(FIX)		alpha_fix_adjustable (FIX)
61 #define RELOC_REQUIRES_SYMBOL
62 
63 /* Values passed to md_apply_fix don't include the symbol value.  */
64 #define MD_APPLY_SYM_VALUE(FIX) 0
65 
66 #define md_convert_frag(b,s,f)		as_fatal ("alpha convert_frag\n")
67 #define md_estimate_size_before_relax(f,s) \
68 			(as_fatal ("estimate_size_before_relax called"),1)
69 #define md_operand(x)
70 
71 #ifdef OBJ_EVAX
72 
73 /* This field keeps the symbols position in the link section.  */
74 #define OBJ_SYMFIELD_TYPE valueT
75 
76 #define TC_CONS_FIX_NEW(FRAG,OFF,LEN,EXP) \
77       fix_new_exp (FRAG, OFF, (int)LEN, EXP, 0, \
78 	LEN == 2 ? BFD_RELOC_16 \
79 	: LEN == 4 ? BFD_RELOC_32 \
80 	: LEN == 8 ? BFD_RELOC_64 \
81 	: BFD_RELOC_ALPHA_LINKAGE);
82 #endif
83 
84 #ifndef VMS
85 #define TC_IMPLICIT_LCOMM_ALIGNMENT(size, align) \
86   do							\
87     {							\
88       align = 0;					\
89       if (size > 1)					\
90 	{						\
91 	  addressT temp = 1;				\
92 	  while ((size & temp) == 0)			\
93 	    ++align, temp <<= 1;			\
94 	}						\
95     }							\
96   while (0)
97 #endif
98 
99 #define md_number_to_chars		number_to_chars_littleendian
100 
101 extern int tc_get_register (int);
102 extern void alpha_frob_ecoff_data (void);
103 
104 #define tc_frob_label(sym) alpha_define_label (sym)
105 extern void alpha_define_label (symbolS *);
106 
107 #define md_cons_align(nbytes) alpha_cons_align (nbytes)
108 extern void alpha_cons_align (int);
109 
110 #define HANDLE_ALIGN(fragp) alpha_handle_align (fragp)
111 extern void alpha_handle_align (struct frag *);
112 
113 #define MAX_MEM_FOR_RS_ALIGN_CODE  (3 + 4 + 8)
114 
115 #ifdef OBJ_ECOFF
116 #define tc_frob_file_before_adjust() alpha_frob_file_before_adjust ()
117 extern void alpha_frob_file_before_adjust (void);
118 #endif
119 
120 #define DIFF_EXPR_OK   /* foo-. gets turned into PC relative relocs.  */
121 
122 #ifdef OBJ_ELF
123 #define md_elf_section_letter		alpha_elf_section_letter
124 extern int alpha_elf_section_letter (int, char **);
125 #define md_elf_section_flags		alpha_elf_section_flags
126 extern flagword alpha_elf_section_flags (flagword, int, int);
127 #endif
128 
129 /* Whether to add support for explicit !relocation_op!sequence_number.  At the
130    moment, only do this for ELF, though ECOFF could use it as well.  */
131 
132 #ifdef OBJ_ELF
133 #define RELOC_OP_P
134 #endif
135 
136 /* Before the relocations are written, reorder them, so that user
137    supplied !lituse relocations follow the appropriate !literal
138    relocations.  Also convert the gas-internal relocations to the
139    appropriate linker relocations.  */
140 #define tc_frob_file_before_fix() alpha_before_fix ()
141 extern void alpha_before_fix (void);
142 
143 #ifdef OBJ_ELF
144 #define md_end  alpha_elf_md_end
145 extern void alpha_elf_md_end (void);
146 #endif
147 
148 /* New fields for supporting explicit relocations (such as !literal to mark
149    where a pointer is loaded from the global table, and !lituse_base to track
150    all of the normal uses of that pointer).  */
151 
152 #define TC_FIX_TYPE struct alpha_fix_tag
153 
154 struct alpha_fix_tag
155 {
156   struct fix *next_reloc;		/* Next !lituse or !gpdisp.  */
157   struct alpha_reloc_tag *info;		/* Other members with same sequence.  */
158 };
159 
160 /* Initialize the TC_FIX_TYPE field.  */
161 #define TC_INIT_FIX_DATA(FIX)						\
162 do {									\
163   FIX->tc_fix_data.next_reloc = NULL;					\
164   FIX->tc_fix_data.info = NULL;						\
165 } while (0)
166 
167 /* Work with DEBUG5 to print fields in tc_fix_type.  */
168 #define TC_FIX_DATA_PRINT(STREAM, FIX)					\
169 do {									\
170   if (FIX->tc_fix_data.info)						\
171     fprintf (STREAM, "\tinfo = 0x%lx, next_reloc = 0x%lx\n", \
172 	     (long) FIX->tc_fix_data.info,				\
173 	     (long) FIX->tc_fix_data.next_reloc);			\
174 } while (0)
175 
176 #define TARGET_USE_CFIPOP 1
177 
178 #define tc_cfi_frame_initial_instructions alpha_cfi_frame_initial_instructions
179 extern void alpha_cfi_frame_initial_instructions (void);
180 
181 #define DWARF2_LINE_MIN_INSN_LENGTH	4
182 #define DWARF2_DEFAULT_RETURN_COLUMN	26
183 #define DWARF2_CIE_DATA_ALIGNMENT	-8
184