133965Sjdp/* This file is tc-alpha.h 2218822Sdim Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 3218822Sdim 2005, 2006 478828Sobrien Free Software Foundation, Inc. 533965Sjdp Written by Ken Raeburn <raeburn@cygnus.com>. 633965Sjdp 733965Sjdp This file is part of GAS, the GNU Assembler. 833965Sjdp 933965Sjdp GAS is free software; you can redistribute it and/or modify 1033965Sjdp it under the terms of the GNU General Public License as published by 1133965Sjdp the Free Software Foundation; either version 2, or (at your option) 1233965Sjdp any later version. 1333965Sjdp 1433965Sjdp GAS is distributed in the hope that it will be useful, 1533965Sjdp but WITHOUT ANY WARRANTY; without even the implied warranty of 1633965Sjdp MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1733965Sjdp GNU General Public License for more details. 1833965Sjdp 1933965Sjdp You should have received a copy of the GNU General Public License 2033965Sjdp along with GAS; see the file COPYING. If not, write to the Free 21218822Sdim Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 22218822Sdim 02110-1301, USA. */ 2333965Sjdp 2433965Sjdp#define TC_ALPHA 2533965Sjdp 2633965Sjdp#define TARGET_BYTES_BIG_ENDIAN 0 2733965Sjdp 2860484Sobrien#define WORKING_DOT_WORD 2960484Sobrien 3033965Sjdp#define TARGET_ARCH bfd_arch_alpha 3133965Sjdp 32104834Sobrien#ifdef TE_FreeBSD 33104834Sobrien#define ELF_TARGET_FORMAT "elf64-alpha-freebsd" 34104834Sobrien#endif 35104834Sobrien#ifndef ELF_TARGET_FORMAT 36104834Sobrien#define ELF_TARGET_FORMAT "elf64-alpha" 37104834Sobrien#endif 38104834Sobrien 3933965Sjdp#define TARGET_FORMAT (OUTPUT_FLAVOR == bfd_target_ecoff_flavour \ 4033965Sjdp ? "ecoff-littlealpha" \ 4133965Sjdp : OUTPUT_FLAVOR == bfd_target_elf_flavour \ 42104834Sobrien ? ELF_TARGET_FORMAT \ 4333965Sjdp : OUTPUT_FLAVOR == bfd_target_evax_flavour \ 4460484Sobrien ? "vms-alpha" \ 4533965Sjdp : "unknown-format") 4633965Sjdp 4733965Sjdp#define NEED_LITERAL_POOL 4833965Sjdp#define REPEAT_CONS_EXPRESSIONS 4933965Sjdp 50130561Sobrienstruct fix; 51130561Sobrienstruct alpha_reloc_tag; 52130561Sobrien 53218822Sdimextern int alpha_force_relocation (struct fix *); 54218822Sdimextern int alpha_fix_adjustable (struct fix *); 5533965Sjdp 5633965Sjdpextern unsigned long alpha_gprmask, alpha_fprmask; 5733965Sjdpextern valueT alpha_gp_value; 5833965Sjdp 59130561Sobrien#define TC_FORCE_RELOCATION(FIX) alpha_force_relocation (FIX) 60130561Sobrien#define tc_fix_adjustable(FIX) alpha_fix_adjustable (FIX) 6133965Sjdp#define RELOC_REQUIRES_SYMBOL 6233965Sjdp 63218822Sdim/* Values passed to md_apply_fix don't include the symbol value. */ 64130561Sobrien#define MD_APPLY_SYM_VALUE(FIX) 0 6560484Sobrien 6633965Sjdp#define md_convert_frag(b,s,f) as_fatal ("alpha convert_frag\n") 6733965Sjdp#define md_estimate_size_before_relax(f,s) \ 6889857Sobrien (as_fatal ("estimate_size_before_relax called"),1) 6933965Sjdp#define md_operand(x) 7033965Sjdp 7133965Sjdp#ifdef OBJ_EVAX 7233965Sjdp 7333965Sjdp/* This field keeps the symbols position in the link section. */ 7433965Sjdp#define OBJ_SYMFIELD_TYPE valueT 7533965Sjdp 7633965Sjdp#define TC_CONS_FIX_NEW(FRAG,OFF,LEN,EXP) \ 7733965Sjdp fix_new_exp (FRAG, OFF, (int)LEN, EXP, 0, \ 7833965Sjdp LEN == 2 ? BFD_RELOC_16 \ 7933965Sjdp : LEN == 4 ? BFD_RELOC_32 \ 8033965Sjdp : LEN == 8 ? BFD_RELOC_64 \ 8133965Sjdp : BFD_RELOC_ALPHA_LINKAGE); 8233965Sjdp#endif 8333965Sjdp 84130561Sobrien#ifndef VMS 85130561Sobrien#define TC_IMPLICIT_LCOMM_ALIGNMENT(size, align) \ 86130561Sobrien do \ 87130561Sobrien { \ 88130561Sobrien align = 0; \ 89130561Sobrien if (size > 1) \ 90130561Sobrien { \ 91130561Sobrien addressT temp = 1; \ 92130561Sobrien while ((size & temp) == 0) \ 93130561Sobrien ++align, temp <<= 1; \ 94130561Sobrien } \ 95130561Sobrien } \ 96130561Sobrien while (0) 97130561Sobrien#endif 98130561Sobrien 9933965Sjdp#define md_number_to_chars number_to_chars_littleendian 10033965Sjdp 101218822Sdimextern int tc_get_register (int); 102218822Sdimextern void alpha_frob_ecoff_data (void); 10333965Sjdp 10433965Sjdp#define tc_frob_label(sym) alpha_define_label (sym) 105218822Sdimextern void alpha_define_label (symbolS *); 10633965Sjdp 10733965Sjdp#define md_cons_align(nbytes) alpha_cons_align (nbytes) 108218822Sdimextern void alpha_cons_align (int); 10933965Sjdp 11077298Sobrien#define HANDLE_ALIGN(fragp) alpha_handle_align (fragp) 111218822Sdimextern void alpha_handle_align (struct frag *); 11277298Sobrien 11377298Sobrien#define MAX_MEM_FOR_RS_ALIGN_CODE (3 + 4 + 8) 11477298Sobrien 11533965Sjdp#ifdef OBJ_ECOFF 11633965Sjdp#define tc_frob_file_before_adjust() alpha_frob_file_before_adjust () 117218822Sdimextern void alpha_frob_file_before_adjust (void); 11833965Sjdp#endif 11938889Sjdp 120218822Sdim#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs. */ 12138889Sjdp 12238889Sjdp#ifdef OBJ_ELF 12389857Sobrien#define md_elf_section_letter alpha_elf_section_letter 124218822Sdimextern int alpha_elf_section_letter (int, char **); 12589857Sobrien#define md_elf_section_flags alpha_elf_section_flags 126218822Sdimextern flagword alpha_elf_section_flags (flagword, int, int); 12738889Sjdp#endif 12860484Sobrien 129130561Sobrien/* Whether to add support for explicit !relocation_op!sequence_number. At the 13060484Sobrien moment, only do this for ELF, though ECOFF could use it as well. */ 13160484Sobrien 13260484Sobrien#ifdef OBJ_ELF 13360484Sobrien#define RELOC_OP_P 13460484Sobrien#endif 13560484Sobrien 13689857Sobrien/* Before the relocations are written, reorder them, so that user 13789857Sobrien supplied !lituse relocations follow the appropriate !literal 13889857Sobrien relocations. Also convert the gas-internal relocations to the 13989857Sobrien appropriate linker relocations. */ 140130561Sobrien#define tc_frob_file_before_fix() alpha_before_fix () 141218822Sdimextern void alpha_before_fix (void); 14260484Sobrien 143130561Sobrien#ifdef OBJ_ELF 144130561Sobrien#define md_end alpha_elf_md_end 145218822Sdimextern void alpha_elf_md_end (void); 146130561Sobrien#endif 147130561Sobrien 14860484Sobrien/* New fields for supporting explicit relocations (such as !literal to mark 14960484Sobrien where a pointer is loaded from the global table, and !lituse_base to track 15060484Sobrien all of the normal uses of that pointer). */ 15160484Sobrien 15260484Sobrien#define TC_FIX_TYPE struct alpha_fix_tag 15360484Sobrien 15460484Sobrienstruct alpha_fix_tag 15560484Sobrien{ 156218822Sdim struct fix *next_reloc; /* Next !lituse or !gpdisp. */ 157218822Sdim struct alpha_reloc_tag *info; /* Other members with same sequence. */ 15860484Sobrien}; 15960484Sobrien 16060484Sobrien/* Initialize the TC_FIX_TYPE field. */ 161130561Sobrien#define TC_INIT_FIX_DATA(FIX) \ 16260484Sobriendo { \ 163218822Sdim FIX->tc_fix_data.next_reloc = NULL; \ 164218822Sdim FIX->tc_fix_data.info = NULL; \ 16560484Sobrien} while (0) 16660484Sobrien 16760484Sobrien/* Work with DEBUG5 to print fields in tc_fix_type. */ 168130561Sobrien#define TC_FIX_DATA_PRINT(STREAM, FIX) \ 16960484Sobriendo { \ 170130561Sobrien if (FIX->tc_fix_data.info) \ 171130561Sobrien fprintf (STREAM, "\tinfo = 0x%lx, next_reloc = 0x%lx\n", \ 172130561Sobrien (long) FIX->tc_fix_data.info, \ 173130561Sobrien (long) FIX->tc_fix_data.next_reloc); \ 17460484Sobrien} while (0) 17577298Sobrien 176130561Sobrien#define TARGET_USE_CFIPOP 1 177130561Sobrien 178130561Sobrien#define tc_cfi_frame_initial_instructions alpha_cfi_frame_initial_instructions 179218822Sdimextern void alpha_cfi_frame_initial_instructions (void); 180130561Sobrien 181130561Sobrien#define DWARF2_LINE_MIN_INSN_LENGTH 4 182130561Sobrien#define DWARF2_DEFAULT_RETURN_COLUMN 26 183218822Sdim#define DWARF2_CIE_DATA_ALIGNMENT (-8) 184