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