This commit was generated by cvs2svn to track changes on a CVS vendor
[external/binutils.git] / gas / config / tc-sparc.h
1 /* tc-sparc.h - Macros and type defines for the sparc.
2    Copyright (C) 1989, 90-96, 1997 Free Software Foundation, Inc.
3
4    This file is part of GAS, the GNU Assembler.
5
6    GAS is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as
8    published by the Free Software Foundation; either version 2,
9    or (at your option) any later version.
10
11    GAS is distributed in the hope that it will be useful, but
12    WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
14    the GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public
17    License along with GAS; see the file COPYING.  If not, write
18    to the Free Software Foundation, 59 Temple Place - Suite 330,
19    Boston, MA 02111-1307, USA.  */
20
21 #ifndef TC_SPARC
22 #define TC_SPARC 1
23
24 #ifdef ANSI_PROTOTYPES
25 struct frag;
26 #endif
27
28 /* This is used to set the default value for `target_big_endian'.  */
29 #define TARGET_BYTES_BIG_ENDIAN 1
30
31 #define LOCAL_LABELS_FB 1
32
33 #define TARGET_ARCH bfd_arch_sparc
34
35 extern const char *sparc_target_format PARAMS ((void));
36 #define TARGET_FORMAT sparc_target_format ()
37
38 #ifdef TE_SPARCAOUT
39 /* Bi-endian support may eventually be unconditional, but until things are
40    working well it's only provided for targets that need it.  */
41 #define SPARC_BIENDIAN
42 #endif
43
44 #define WORKING_DOT_WORD
45
46 #define md_convert_frag(b,s,f)          {as_fatal ("sparc convert_frag\n");}
47 #define md_create_long_jump(p,f,t,fr,s) as_fatal("sparc_create_long_jump")
48 #define md_create_short_jump(p,f,t,fr,s) as_fatal("sparc_create_short_jump")
49 #define md_estimate_size_before_relax(f,s) \
50                         (as_fatal("estimate_size_before_relax called"),1)
51
52 #define LISTING_HEADER "SPARC GAS "
53
54 extern int sparc_pic_code;
55
56 #define md_do_align(n, fill, len, max, around)                          \
57 if ((n) && (n) <= 10 && !need_pass_2 && !(fill)                         \
58     && now_seg != data_section && now_seg != bss_section)               \
59   {                                                                     \
60     char *p;                                                            \
61     p = frag_var (rs_align_code, 1024, 1, (relax_substateT) 1024,       \
62                   (symbolS *) 0, (offsetT) (n), (char *) 0);            \
63     *p = 0x00;                                                          \
64     goto around;                                                        \
65   }
66
67 /* We require .word, et. al., to be aligned correctly.  */
68 #define md_cons_align(nbytes) sparc_cons_align (nbytes)
69 extern void sparc_cons_align PARAMS ((int));
70 #define HANDLE_ALIGN(fragp) sparc_handle_align (fragp)
71 extern void sparc_handle_align PARAMS ((struct frag *));
72
73 #if defined (OBJ_ELF) || defined (OBJ_AOUT)
74
75 /* This expression evaluates to false if the relocation is for a local
76    object for which we still want to do the relocation at runtime.
77    True if we are willing to perform this relocation while building
78    the .o file.
79
80    If the reloc is against an externally visible symbol, then the
81    a.out assembler should not do the relocation if generating PIC, and
82    the ELF assembler should never do the relocation.  */
83
84 #ifdef OBJ_ELF
85 #define obj_relocate_extern 0
86 #else
87 #define obj_relocate_extern (! sparc_pic_code)
88 #endif
89
90 #define TC_RELOC_RTSYM_LOC_FIXUP(FIX)  \
91   (obj_relocate_extern \
92    || (FIX)->fx_addsy == NULL \
93    || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
94        && ! S_IS_WEAK ((FIX)->fx_addsy) \
95        && S_IS_DEFINED ((FIX)->fx_addsy) \
96        && ! S_IS_COMMON ((FIX)->fx_addsy)))
97 #endif
98
99 /* I know that "call 0" fails in sparc-coff if this doesn't return 1.  I
100    don't know about other relocation types, or other formats, yet.  */
101 #ifdef OBJ_COFF
102 #define TC_FORCE_RELOCATION(FIXP)       \
103         ((FIXP)->fx_r_type == BFD_RELOC_32_PCREL_S2 \
104          && ((FIXP)->fx_addsy == 0 \
105              || S_GET_SEGMENT ((FIXP)->fx_addsy) == absolute_section))
106 #define RELOC_REQUIRES_SYMBOL
107 #endif
108
109 #define MD_APPLY_FIX3
110 #define TC_HANDLES_FX_DONE
111
112 #ifdef OBJ_ELF
113 /* Keep relocations against global symbols.  Don't turn them into
114    relocations against sections.  This is required for the dynamic
115    linker to operate properly.  When generating PIC, we need to keep
116    any non PC relative reloc.  */
117 #define tc_fix_adjustable(FIX)                                          \
118   (! S_IS_EXTERNAL ((FIX)->fx_addsy)                                    \
119    && ! S_IS_WEAK ((FIX)->fx_addsy)                                     \
120    && (! sparc_pic_code                                                 \
121        || (FIX)->fx_pcrel                                               \
122        || ((FIX)->fx_subsy != NULL                                      \
123            && (S_GET_SEGMENT ((FIX)->fx_subsy)                          \
124                == S_GET_SEGMENT ((FIX)->fx_addsy)))                     \
125        || strchr (S_GET_NAME ((FIX)->fx_addsy), '\001') != NULL         \
126        || strchr (S_GET_NAME ((FIX)->fx_addsy), '\002') != NULL))
127 #endif
128
129 #ifdef OBJ_AOUT
130 /* When generating PIC code, we must not adjust any reloc which will
131    turn into a reloc against the global offset table.  */
132 #define tc_fix_adjustable(FIX) \
133   (! sparc_pic_code \
134    || (FIX)->fx_pcrel \
135    || (FIX)->fx_r_type == BFD_RELOC_16 \
136    || (FIX)->fx_r_type == BFD_RELOC_32)
137 #endif
138
139 #define elf_tc_final_processing sparc_elf_final_processing
140 extern void sparc_elf_final_processing PARAMS ((void));
141
142 #define md_operand(x)
143
144 extern void sparc_md_end PARAMS ((void));
145 #define md_end() sparc_md_end ()
146
147 #endif
148
149 /* end of tc-sparc.h */