tc-alpha.h revision 107492
1/* This file is tc-alpha.h
2   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
3   Free Software Foundation, Inc.
4   Written by Ken Raeburn <raeburn@cygnus.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 2, 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
19   along with GAS; see the file COPYING.  If not, write to the Free
20   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21   02111-1307, USA.  */
22
23#define TC_ALPHA
24
25#define TARGET_BYTES_BIG_ENDIAN 0
26
27#define WORKING_DOT_WORD
28
29#define TARGET_ARCH			bfd_arch_alpha
30
31#ifdef TE_FreeBSD
32#define ELF_TARGET_FORMAT	"elf64-alpha-freebsd"
33#endif
34#ifndef ELF_TARGET_FORMAT
35#define ELF_TARGET_FORMAT	"elf64-alpha"
36#endif
37
38#define TARGET_FORMAT (OUTPUT_FLAVOR == bfd_target_ecoff_flavour	\
39		       ? "ecoff-littlealpha"				\
40		       : OUTPUT_FLAVOR == bfd_target_elf_flavour	\
41		       ? ELF_TARGET_FORMAT				\
42		       : OUTPUT_FLAVOR == bfd_target_evax_flavour	\
43		       ? "vms-alpha"					\
44		       : "unknown-format")
45
46#define NEED_LITERAL_POOL
47#define REPEAT_CONS_EXPRESSIONS
48
49extern int alpha_force_relocation PARAMS ((struct fix *));
50extern int alpha_fix_adjustable PARAMS ((struct fix *));
51
52extern unsigned long alpha_gprmask, alpha_fprmask;
53extern valueT alpha_gp_value;
54
55#define TC_FORCE_RELOCATION(FIXP)	alpha_force_relocation (FIXP)
56#define tc_fix_adjustable(FIXP)		alpha_fix_adjustable (FIXP)
57#define RELOC_REQUIRES_SYMBOL
58
59/* This expression evaluates to false if the relocation is for a local
60   object for which we still want to do the relocation at runtime.
61   True if we are willing to perform this relocation while building
62   the .o file.  This is only used for pcrel relocations.  */
63
64#define TC_RELOC_RTSYM_LOC_FIXUP(FIX)				\
65  ((FIX)->fx_addsy == NULL					\
66   || (! S_IS_EXTERNAL ((FIX)->fx_addsy)			\
67       && ! S_IS_WEAK ((FIX)->fx_addsy)				\
68       && S_IS_DEFINED ((FIX)->fx_addsy)			\
69       && ! S_IS_COMMON ((FIX)->fx_addsy)))
70
71#define md_convert_frag(b,s,f)		as_fatal ("alpha convert_frag\n")
72#define md_estimate_size_before_relax(f,s) \
73			(as_fatal ("estimate_size_before_relax called"),1)
74#define md_operand(x)
75
76#ifdef OBJ_EVAX
77
78/* This field keeps the symbols position in the link section.  */
79#define OBJ_SYMFIELD_TYPE valueT
80
81#define TC_CONS_FIX_NEW(FRAG,OFF,LEN,EXP) \
82      fix_new_exp (FRAG, OFF, (int)LEN, EXP, 0, \
83	LEN == 2 ? BFD_RELOC_16 \
84	: LEN == 4 ? BFD_RELOC_32 \
85	: LEN == 8 ? BFD_RELOC_64 \
86	: BFD_RELOC_ALPHA_LINKAGE);
87#endif
88
89#define md_number_to_chars		number_to_chars_littleendian
90
91extern int tc_get_register PARAMS ((int frame));
92extern void alpha_frob_ecoff_data PARAMS ((void));
93
94#define tc_frob_label(sym) alpha_define_label (sym)
95extern void alpha_define_label PARAMS ((symbolS *));
96
97#define md_cons_align(nbytes) alpha_cons_align (nbytes)
98extern void alpha_cons_align PARAMS ((int));
99
100#define HANDLE_ALIGN(fragp) alpha_handle_align (fragp)
101extern void alpha_handle_align PARAMS ((struct frag *));
102
103#define MAX_MEM_FOR_RS_ALIGN_CODE  (3 + 4 + 8)
104
105#ifdef OBJ_ECOFF
106#define tc_frob_file_before_adjust() alpha_frob_file_before_adjust ()
107extern void alpha_frob_file_before_adjust PARAMS ((void));
108#endif
109
110#define DIFF_EXPR_OK   /* foo-. gets turned into PC relative relocs */
111
112#ifdef OBJ_ELF
113#define ELF_TC_SPECIAL_SECTIONS \
114  { ".sdata",   SHT_PROGBITS,   SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL  }, \
115  { ".sbss",    SHT_NOBITS,     SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL  },
116
117#define md_elf_section_letter		alpha_elf_section_letter
118extern int alpha_elf_section_letter PARAMS ((int, char **));
119#define md_elf_section_flags		alpha_elf_section_flags
120extern flagword alpha_elf_section_flags PARAMS ((flagword, int, int));
121#endif
122
123/* Whether to add support for explict !relocation_op!sequence_number.  At the
124   moment, only do this for ELF, though ECOFF could use it as well.  */
125
126#ifdef OBJ_ELF
127#define RELOC_OP_P
128#endif
129
130/* Before the relocations are written, reorder them, so that user
131   supplied !lituse relocations follow the appropriate !literal
132   relocations.  Also convert the gas-internal relocations to the
133   appropriate linker relocations.  */
134#define tc_adjust_symtab() alpha_adjust_symtab ()
135extern void alpha_adjust_symtab PARAMS ((void));
136
137/* New fields for supporting explicit relocations (such as !literal to mark
138   where a pointer is loaded from the global table, and !lituse_base to track
139   all of the normal uses of that pointer).  */
140
141#define TC_FIX_TYPE struct alpha_fix_tag
142
143struct alpha_fix_tag
144{
145  struct fix *next_reloc;		/* next !lituse or !gpdisp */
146  struct alpha_reloc_tag *info;		/* other members with same sequence */
147};
148
149/* Initialize the TC_FIX_TYPE field.  */
150#define TC_INIT_FIX_DATA(fixP)						\
151do {									\
152  fixP->tc_fix_data.next_reloc = (struct fix *)0;			\
153  fixP->tc_fix_data.info = (struct alpha_reloc_tag *)0;			\
154} while (0)
155
156/* Work with DEBUG5 to print fields in tc_fix_type.  */
157#define TC_FIX_DATA_PRINT(stream,fixP)					\
158do {									\
159  if (fixP->tc_fix_data.info)						\
160    fprintf (stderr, "\tinfo = 0x%lx, next_reloc = 0x%lx\n", \
161	     (long)fixP->tc_fix_data.info,				\
162	     (long)fixP->tc_fix_data.next_reloc);			\
163} while (0)
164
165#define DWARF2_LINE_MIN_INSN_LENGTH 4
166