tc-sparc.h revision 59024
159024Sobrien/* tc-sparc.h - Macros and type defines for the sparc.
259024Sobrien   Copyright (C) 1989, 90-96, 97, 1998 Free Software Foundation, Inc.
359024Sobrien
459024Sobrien   This file is part of GAS, the GNU Assembler.
559024Sobrien
659024Sobrien   GAS is free software; you can redistribute it and/or modify
759024Sobrien   it under the terms of the GNU General Public License as
859024Sobrien   published by the Free Software Foundation; either version 2,
959024Sobrien   or (at your option) any later version.
1059024Sobrien
1159024Sobrien   GAS is distributed in the hope that it will be useful, but
1259024Sobrien   WITHOUT ANY WARRANTY; without even the implied warranty of
1359024Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
1459024Sobrien   the GNU General Public License for more details.
1559024Sobrien
1659024Sobrien   You should have received a copy of the GNU General Public
1759024Sobrien   License along with GAS; see the file COPYING.  If not, write
1859024Sobrien   to the Free Software Foundation, 59 Temple Place - Suite 330,
1959024Sobrien   Boston, MA 02111-1307, USA.  */
2059024Sobrien
2159024Sobrien#ifndef TC_SPARC
2259024Sobrien#define TC_SPARC 1
2359024Sobrien
2459024Sobrien#ifdef ANSI_PROTOTYPES
2559024Sobrienstruct frag;
2659024Sobrien#endif
2759024Sobrien
2859024Sobrien/* This is used to set the default value for `target_big_endian'.  */
2959024Sobrien#define TARGET_BYTES_BIG_ENDIAN 1
3059024Sobrien
3159024Sobrien#define LOCAL_LABELS_FB 1
3259024Sobrien
3359024Sobrien#define TARGET_ARCH bfd_arch_sparc
3459024Sobrien
3559024Sobrienextern const char *sparc_target_format PARAMS ((void));
3659024Sobrien#define TARGET_FORMAT sparc_target_format ()
3759024Sobrien
3859024Sobrien#ifdef TE_SPARCAOUT
3959024Sobrien/* Bi-endian support may eventually be unconditional, but until things are
4059024Sobrien   working well it's only provided for targets that need it.  */
4159024Sobrien#define SPARC_BIENDIAN
4259024Sobrien#endif
4359024Sobrien
4459024Sobrien#define WORKING_DOT_WORD
4559024Sobrien
4659024Sobrien#define md_convert_frag(b,s,f)		{as_fatal ("sparc convert_frag\n");}
4759024Sobrien#define md_create_long_jump(p,f,t,fr,s)	as_fatal("sparc_create_long_jump")
4859024Sobrien#define md_create_short_jump(p,f,t,fr,s) as_fatal("sparc_create_short_jump")
4959024Sobrien#define md_estimate_size_before_relax(f,s) \
5059024Sobrien			(as_fatal("estimate_size_before_relax called"),1)
5159024Sobrien
5259024Sobrien#define LISTING_HEADER "SPARC GAS "
5359024Sobrien
5459024Sobrienextern int sparc_pic_code;
5559024Sobrien
5659024Sobrien#define md_do_align(n, fill, len, max, around)				\
5759024Sobrienif ((n) && (n) <= 10 && !need_pass_2 && !(fill)				\
5859024Sobrien    && now_seg != data_section && now_seg != bss_section)		\
5959024Sobrien  {									\
6059024Sobrien    char *p;								\
6159024Sobrien    p = frag_var (rs_align_code, 1024, 1, (relax_substateT) 1024,	\
6259024Sobrien                  (symbolS *) 0, (offsetT) (n), (char *) 0);		\
6359024Sobrien    *p = 0x00;								\
6459024Sobrien    goto around;							\
6559024Sobrien  }
6659024Sobrien
6759024Sobrien/* We require .word, et. al., to be aligned correctly.  */
6859024Sobrien#define md_cons_align(nbytes) sparc_cons_align (nbytes)
6959024Sobrienextern void sparc_cons_align PARAMS ((int));
7059024Sobrien#define HANDLE_ALIGN(fragp) sparc_handle_align (fragp)
7159024Sobrienextern void sparc_handle_align PARAMS ((struct frag *));
7259024Sobrien
7359024Sobrien#if defined (OBJ_ELF) || defined (OBJ_AOUT)
7459024Sobrien
7559024Sobrien/* This expression evaluates to false if the relocation is for a local
7659024Sobrien   object for which we still want to do the relocation at runtime.
7759024Sobrien   True if we are willing to perform this relocation while building
7859024Sobrien   the .o file.
7959024Sobrien
8059024Sobrien   If the reloc is against an externally visible symbol, then the
8159024Sobrien   a.out assembler should not do the relocation if generating PIC, and
8259024Sobrien   the ELF assembler should never do the relocation.  */
8359024Sobrien
8459024Sobrien#ifdef OBJ_ELF
8559024Sobrien#define obj_relocate_extern 0
8659024Sobrien#else
8759024Sobrien#define obj_relocate_extern (! sparc_pic_code)
8859024Sobrien#endif
8959024Sobrien
9059024Sobrien#define TC_RELOC_RTSYM_LOC_FIXUP(FIX)  \
9159024Sobrien  (obj_relocate_extern \
9259024Sobrien   || (FIX)->fx_addsy == NULL \
9359024Sobrien   || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
9459024Sobrien       && ! S_IS_WEAK ((FIX)->fx_addsy) \
9559024Sobrien       && S_IS_DEFINED ((FIX)->fx_addsy) \
9659024Sobrien       && ! S_IS_COMMON ((FIX)->fx_addsy)))
9759024Sobrien#endif
9859024Sobrien
9959024Sobrien/* I know that "call 0" fails in sparc-coff if this doesn't return 1.  I
10059024Sobrien   don't know about other relocation types, or other formats, yet.  */
10159024Sobrien#ifdef OBJ_COFF
10259024Sobrien#define TC_FORCE_RELOCATION(FIXP)	\
10359024Sobrien	((FIXP)->fx_r_type == BFD_RELOC_32_PCREL_S2 \
10459024Sobrien	 && ((FIXP)->fx_addsy == 0 \
10559024Sobrien	     || S_GET_SEGMENT ((FIXP)->fx_addsy) == absolute_section))
10659024Sobrien#define RELOC_REQUIRES_SYMBOL
10759024Sobrien#endif
10859024Sobrien
10959024Sobrien#define MD_APPLY_FIX3
11059024Sobrien#define TC_HANDLES_FX_DONE
11159024Sobrien
11259024Sobrien#ifdef OBJ_ELF
11359024Sobrien/* Keep relocations against global symbols.  Don't turn them into
11459024Sobrien   relocations against sections.  This is required for the dynamic
11559024Sobrien   linker to operate properly.  When generating PIC, we need to keep
11659024Sobrien   any non PC relative reloc.  */
11759024Sobrien#define tc_fix_adjustable(FIX)						\
11859024Sobrien  (! S_IS_EXTERNAL ((FIX)->fx_addsy)					\
11959024Sobrien   && ! S_IS_WEAK ((FIX)->fx_addsy)					\
12059024Sobrien   && (! sparc_pic_code							\
12159024Sobrien       || (FIX)->fx_pcrel						\
12259024Sobrien       || ((FIX)->fx_subsy != NULL					\
12359024Sobrien	   && (S_GET_SEGMENT ((FIX)->fx_subsy)				\
12459024Sobrien	       == S_GET_SEGMENT ((FIX)->fx_addsy)))			\
12559024Sobrien       || strchr (S_GET_NAME ((FIX)->fx_addsy), '\001') != NULL		\
12659024Sobrien       || strchr (S_GET_NAME ((FIX)->fx_addsy), '\002') != NULL))
12759024Sobrien#endif
12859024Sobrien
12959024Sobrien#ifdef OBJ_AOUT
13059024Sobrien/* When generating PIC code, we must not adjust any reloc which will
13159024Sobrien   turn into a reloc against the global offset table.  */
13259024Sobrien#define tc_fix_adjustable(FIX) \
13359024Sobrien  (! sparc_pic_code \
13459024Sobrien   || (FIX)->fx_pcrel \
13559024Sobrien   || (FIX)->fx_r_type == BFD_RELOC_16 \
13659024Sobrien   || (FIX)->fx_r_type == BFD_RELOC_32)
13759024Sobrien#endif
13859024Sobrien
13959024Sobrien#define elf_tc_final_processing sparc_elf_final_processing
14059024Sobrienextern void sparc_elf_final_processing PARAMS ((void));
14159024Sobrien
14259024Sobrien#define md_operand(x)
14359024Sobrien
14459024Sobrienextern void sparc_md_end PARAMS ((void));
14559024Sobrien#define md_end() sparc_md_end ()
14659024Sobrien
14759024Sobrien#endif
14859024Sobrien
14959024Sobrien/* end of tc-sparc.h */
150