tc-alpha.h revision 77298
133965Sjdp/* This file is tc-alpha.h
260484Sobrien   Copyright (C) 1994, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
333965Sjdp   Written by Ken Raeburn <raeburn@cygnus.com>.
433965Sjdp
533965Sjdp   This file is part of GAS, the GNU Assembler.
633965Sjdp
733965Sjdp   GAS is free software; you can redistribute it and/or modify
833965Sjdp   it under the terms of the GNU General Public License as published by
933965Sjdp   the Free Software Foundation; either version 2, or (at your option)
1033965Sjdp   any later version.
1133965Sjdp
1233965Sjdp   GAS is distributed in the hope that it will be useful,
1333965Sjdp   but WITHOUT ANY WARRANTY; without even the implied warranty of
1433965Sjdp   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1533965Sjdp   GNU General Public License for more details.
1633965Sjdp
1733965Sjdp   You should have received a copy of the GNU General Public License
1833965Sjdp   along with GAS; see the file COPYING.  If not, write to the Free
1933965Sjdp   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2033965Sjdp   02111-1307, USA.  */
2133965Sjdp
2233965Sjdp#define TC_ALPHA
2333965Sjdp
2433965Sjdp#define TARGET_BYTES_BIG_ENDIAN 0
2533965Sjdp
2660484Sobrien#define WORKING_DOT_WORD
2760484Sobrien
2833965Sjdp#define TARGET_ARCH			bfd_arch_alpha
2933965Sjdp
3033965Sjdp#define TARGET_FORMAT (OUTPUT_FLAVOR == bfd_target_ecoff_flavour	\
3133965Sjdp		       ? "ecoff-littlealpha"				\
3233965Sjdp		       : OUTPUT_FLAVOR == bfd_target_elf_flavour	\
3333965Sjdp		       ? "elf64-alpha"					\
3433965Sjdp		       : OUTPUT_FLAVOR == bfd_target_evax_flavour	\
3560484Sobrien		       ? "vms-alpha"					\
3633965Sjdp		       : "unknown-format")
3733965Sjdp
3833965Sjdp#define NEED_LITERAL_POOL
3933965Sjdp#define TC_HANDLES_FX_DONE
4033965Sjdp#define REPEAT_CONS_EXPRESSIONS
4133965Sjdp
4233965Sjdpextern int alpha_force_relocation PARAMS ((struct fix *));
4333965Sjdpextern int alpha_fix_adjustable PARAMS ((struct fix *));
4433965Sjdp
4533965Sjdpextern unsigned long alpha_gprmask, alpha_fprmask;
4633965Sjdpextern valueT alpha_gp_value;
4733965Sjdp
4833965Sjdp#define TC_FORCE_RELOCATION(FIXP)	alpha_force_relocation (FIXP)
4933965Sjdp#define tc_fix_adjustable(FIXP)		alpha_fix_adjustable (FIXP)
5033965Sjdp#define RELOC_REQUIRES_SYMBOL
5133965Sjdp
5260484Sobrien/* This expression evaluates to false if the relocation is for a local
5360484Sobrien   object for which we still want to do the relocation at runtime.
5460484Sobrien   True if we are willing to perform this relocation while building
5560484Sobrien   the .o file.  This is only used for pcrel relocations.  */
5660484Sobrien
5760484Sobrien#define TC_RELOC_RTSYM_LOC_FIXUP(FIX)				\
5860484Sobrien  ((FIX)->fx_addsy == NULL					\
5960484Sobrien   || (! S_IS_EXTERNAL ((FIX)->fx_addsy)			\
6060484Sobrien       && ! S_IS_WEAK ((FIX)->fx_addsy)				\
6160484Sobrien       && S_IS_DEFINED ((FIX)->fx_addsy)			\
6260484Sobrien       && ! S_IS_COMMON ((FIX)->fx_addsy)))
6360484Sobrien
6433965Sjdp#define md_convert_frag(b,s,f)		as_fatal ("alpha convert_frag\n")
6533965Sjdp#define md_estimate_size_before_relax(f,s) \
6633965Sjdp			(as_fatal("estimate_size_before_relax called"),1)
6733965Sjdp#define md_operand(x)
6833965Sjdp
6933965Sjdp#ifdef OBJ_EVAX
7033965Sjdp
7133965Sjdp/* This field keeps the symbols position in the link section.  */
7233965Sjdp#define OBJ_SYMFIELD_TYPE valueT
7333965Sjdp
7433965Sjdp#define TC_CONS_FIX_NEW(FRAG,OFF,LEN,EXP) \
7533965Sjdp      fix_new_exp (FRAG, OFF, (int)LEN, EXP, 0, \
7633965Sjdp	LEN == 2 ? BFD_RELOC_16 \
7733965Sjdp	: LEN == 4 ? BFD_RELOC_32 \
7833965Sjdp	: LEN == 8 ? BFD_RELOC_64 \
7933965Sjdp	: BFD_RELOC_ALPHA_LINKAGE);
8033965Sjdp#endif
8133965Sjdp
8233965Sjdp#define md_number_to_chars		number_to_chars_littleendian
8333965Sjdp
8433965Sjdpextern int tc_get_register PARAMS ((int frame));
8533965Sjdpextern void alpha_frob_ecoff_data PARAMS ((void));
8633965Sjdp
8733965Sjdp#define tc_frob_label(sym) alpha_define_label (sym)
8860484Sobrienextern void alpha_define_label PARAMS ((symbolS *));
8933965Sjdp
9033965Sjdp#define md_cons_align(nbytes) alpha_cons_align (nbytes)
9133965Sjdpextern void alpha_cons_align PARAMS ((int));
9233965Sjdp
9377298Sobrien#define HANDLE_ALIGN(fragp) alpha_handle_align (fragp)
9477298Sobrienextern void alpha_handle_align PARAMS ((struct frag *));
9577298Sobrien
9677298Sobrien#define MAX_MEM_FOR_RS_ALIGN_CODE  (3 + 4 + 8)
9777298Sobrien
9833965Sjdp#ifdef OBJ_ECOFF
9933965Sjdp#define tc_frob_file_before_adjust() alpha_frob_file_before_adjust ()
10033965Sjdpextern void alpha_frob_file_before_adjust PARAMS ((void));
10133965Sjdp#endif
10238889Sjdp
10338889Sjdp#define DIFF_EXPR_OK   /* foo-. gets turned into PC relative relocs */
10438889Sjdp
10538889Sjdp#ifdef OBJ_ELF
10638889Sjdp#define ELF_TC_SPECIAL_SECTIONS \
10738889Sjdp  { ".sdata",   SHT_PROGBITS,   SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL  }, \
10838889Sjdp  { ".sbss",    SHT_NOBITS,     SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL  },
10938889Sjdp#endif
11060484Sobrien
11160484Sobrien/* Whether to add support for explict !relocation_op!sequence_number.  At the
11260484Sobrien   moment, only do this for ELF, though ECOFF could use it as well.  */
11360484Sobrien
11460484Sobrien#ifdef OBJ_ELF
11560484Sobrien#define RELOC_OP_P
11660484Sobrien#endif
11760484Sobrien
11860484Sobrien#ifdef RELOC_OP_P
11960484Sobrien/* Before the relocations are written, reorder them, so that user supplied
12060484Sobrien   !lituse relocations follow the appropriate !literal relocations.  Also
12160484Sobrien   convert the gas-internal relocations to the appropriate linker relocations.
12260484Sobrien   */
12360484Sobrien#define tc_adjust_symtab() alpha_adjust_symtab ()
12460484Sobrienextern void alpha_adjust_symtab PARAMS ((void));
12560484Sobrien
12660484Sobrien/* New fields for supporting explicit relocations (such as !literal to mark
12760484Sobrien   where a pointer is loaded from the global table, and !lituse_base to track
12860484Sobrien   all of the normal uses of that pointer).  */
12960484Sobrien
13060484Sobrien#define TC_FIX_TYPE struct alpha_fix_tag
13160484Sobrien
13260484Sobrienstruct alpha_fix_tag
13360484Sobrien{
13460484Sobrien  struct fix *next_lituse;		/* next !lituse */
13560484Sobrien  struct alpha_literal_tag *info;	/* other members with same sequence */
13660484Sobrien};
13760484Sobrien
13860484Sobrien/* Initialize the TC_FIX_TYPE field.  */
13960484Sobrien#define TC_INIT_FIX_DATA(fixP)						\
14060484Sobriendo {									\
14160484Sobrien  fixP->tc_fix_data.next_lituse = (struct fix *)0;			\
14260484Sobrien  fixP->tc_fix_data.info = (struct alpha_literal_tag *)0;		\
14360484Sobrien} while (0)
14460484Sobrien
14560484Sobrien/* Work with DEBUG5 to print fields in tc_fix_type.  */
14660484Sobrien#define TC_FIX_DATA_PRINT(stream,fixP)					\
14760484Sobriendo {									\
14860484Sobrien  if (fixP->tc_fix_data.info)						\
14960484Sobrien    fprintf (stderr, "\tinfo = 0x%lx, next_lituse = 0x%lx\n", \
15060484Sobrien	     (long)fixP->tc_fix_data.info,				\
15160484Sobrien	     (long)fixP->tc_fix_data.next_lituse);			\
15260484Sobrien} while (0)
15360484Sobrien#endif
15477298Sobrien
15577298Sobrien#define DWARF2_LINE_MIN_INSN_LENGTH 4
156