* Many files: Added gettext invocations around user-visible
[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, 97, 1998 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 #if 0
39 #ifdef TE_SPARCAOUT
40 /* Bi-endian support may eventually be unconditional, but until things are
41    working well it's only provided for targets that need it.  */
42 #define SPARC_BIENDIAN
43 #endif
44 #endif
45 /* Make it unconditional and check if -EL is valid after option parsing */
46 #define SPARC_BIENDIAN
47
48 #define WORKING_DOT_WORD
49
50 #define md_convert_frag(b,s,f)          {as_fatal (_("sparc convert_frag\n"));}
51 #define md_create_long_jump(p,f,t,fr,s) as_fatal(_("sparc_create_long_jump"))
52 #define md_create_short_jump(p,f,t,fr,s) as_fatal(_("sparc_create_short_jump"))
53 #define md_estimate_size_before_relax(f,s) \
54                         (as_fatal(_("estimate_size_before_relax called")),1)
55
56 #define LISTING_HEADER "SPARC GAS "
57
58 extern int sparc_pic_code;
59
60 #define md_do_align(n, fill, len, max, around)                          \
61 if ((n) && (n) <= 10 && !need_pass_2 && !(fill)                         \
62     && now_seg != data_section && now_seg != bss_section)               \
63   {                                                                     \
64     char *p;                                                            \
65     p = frag_var (rs_align_code, 1024, 1, (relax_substateT) 1024,       \
66                   (symbolS *) 0, (offsetT) (n), (char *) 0);            \
67     *p = 0x00;                                                          \
68     goto around;                                                        \
69   }
70
71 /* We require .word, et. al., to be aligned correctly.  */
72 #define md_cons_align(nbytes) sparc_cons_align (nbytes)
73 extern void sparc_cons_align PARAMS ((int));
74 #define HANDLE_ALIGN(fragp) sparc_handle_align (fragp)
75 extern void sparc_handle_align PARAMS ((struct frag *));
76
77 #if defined (OBJ_ELF) || defined (OBJ_AOUT)
78
79 /* This expression evaluates to false if the relocation is for a local
80    object for which we still want to do the relocation at runtime.
81    True if we are willing to perform this relocation while building
82    the .o file.
83
84    If the reloc is against an externally visible symbol, then the
85    a.out assembler should not do the relocation if generating PIC, and
86    the ELF assembler should never do the relocation.  */
87
88 #ifdef OBJ_ELF
89 #define obj_relocate_extern 0
90 #else
91 #define obj_relocate_extern (! sparc_pic_code)
92 #endif
93
94 #define TC_RELOC_RTSYM_LOC_FIXUP(FIX)  \
95   (obj_relocate_extern \
96    || (FIX)->fx_addsy == NULL \
97    || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
98        && ! S_IS_WEAK ((FIX)->fx_addsy) \
99        && S_IS_DEFINED ((FIX)->fx_addsy) \
100        && ! S_IS_COMMON ((FIX)->fx_addsy)))
101 #endif
102
103 /* I know that "call 0" fails in sparc-coff if this doesn't return 1.  I
104    don't know about other relocation types, or other formats, yet.  */
105 #ifdef OBJ_COFF
106 #define TC_FORCE_RELOCATION(FIXP)       \
107         ((FIXP)->fx_r_type == BFD_RELOC_32_PCREL_S2 \
108          && ((FIXP)->fx_addsy == 0 \
109              || S_GET_SEGMENT ((FIXP)->fx_addsy) == absolute_section))
110 #define RELOC_REQUIRES_SYMBOL
111 #endif
112
113 #define MD_APPLY_FIX3
114 #define TC_HANDLES_FX_DONE
115
116 #ifdef OBJ_ELF
117 /* Keep relocations against global symbols.  Don't turn them into
118    relocations against sections.  This is required for the dynamic
119    linker to operate properly.  When generating PIC, we need to keep
120    any non PC relative reloc.  */
121 #define tc_fix_adjustable(FIX)                                          \
122   (! S_IS_EXTERNAL ((FIX)->fx_addsy)                                    \
123    && ! S_IS_WEAK ((FIX)->fx_addsy)                                     \
124    && (! sparc_pic_code                                                 \
125        || (FIX)->fx_pcrel                                               \
126        || ((FIX)->fx_subsy != NULL                                      \
127            && (S_GET_SEGMENT ((FIX)->fx_subsy)                          \
128                == S_GET_SEGMENT ((FIX)->fx_addsy)))                     \
129        || strchr (S_GET_NAME ((FIX)->fx_addsy), '\001') != NULL         \
130        || strchr (S_GET_NAME ((FIX)->fx_addsy), '\002') != NULL))
131 #endif
132
133 #ifdef OBJ_AOUT
134 /* When generating PIC code, we must not adjust any reloc which will
135    turn into a reloc against the global offset table.  */
136 #define tc_fix_adjustable(FIX) \
137   (! sparc_pic_code \
138    || (FIX)->fx_pcrel \
139    || (FIX)->fx_r_type == BFD_RELOC_16 \
140    || (FIX)->fx_r_type == BFD_RELOC_32)
141 #endif
142
143 #define elf_tc_final_processing sparc_elf_final_processing
144 extern void sparc_elf_final_processing PARAMS ((void));
145
146 #define md_operand(x)
147
148 extern void sparc_md_end PARAMS ((void));
149 #define md_end() sparc_md_end ()
150
151 #endif
152
153 /* end of tc-sparc.h */