Commit | Line | Data |
---|---|---|
fecd2382 | 1 | /* tc-sparc.h - Macros and type defines for the sparc. |
7532235c | 2 | Copyright (C) 1989, 90-96, 1997 Free Software Foundation, Inc. |
355afbcd | 3 | |
a39116f1 | 4 | This file is part of GAS, the GNU Assembler. |
355afbcd | 5 | |
a39116f1 RP |
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. | |
355afbcd | 10 | |
a39116f1 RP |
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. | |
355afbcd | 15 | |
a39116f1 RP |
16 | You should have received a copy of the GNU General Public |
17 | License along with GAS; see the file COPYING. If not, write | |
7532235c RH |
18 | to the Free Software Foundation, 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. */ | |
fecd2382 | 20 | |
7532235c | 21 | #ifndef TC_SPARC |
fecd2382 RP |
22 | #define TC_SPARC 1 |
23 | ||
7532235c RH |
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 | ||
a2a5a4fa | 31 | #define LOCAL_LABELS_FB 1 |
a39116f1 | 32 | |
25c09bbf | 33 | #define TARGET_ARCH bfd_arch_sparc |
7532235c RH |
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 | |
25c09bbf | 42 | #endif |
7532235c | 43 | |
6868afe6 | 44 | #define WORKING_DOT_WORD |
25c09bbf | 45 | |
25c09bbf | 46 | #define md_convert_frag(b,s,f) {as_fatal ("sparc convert_frag\n");} |
6868afe6 KR |
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) | |
2d97273c | 51 | |
a39116f1 | 52 | #define LISTING_HEADER "SPARC GAS " |
8b228fe9 | 53 | |
7532235c RH |
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 | ||
a2a5a4fa KR |
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 | ||
7532235c | 109 | #define MD_APPLY_FIX3 |
a2a5a4fa KR |
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 | |
7532235c RH |
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 | #endif | |
126 | ||
127 | #ifdef OBJ_AOUT | |
128 | /* When generating PIC code, we must not adjust any reloc which will | |
129 | turn into a reloc against the global offset table. */ | |
130 | #define tc_fix_adjustable(FIX) \ | |
131 | (! sparc_pic_code \ | |
132 | || (FIX)->fx_pcrel \ | |
133 | || (FIX)->fx_r_type == BFD_RELOC_16 \ | |
134 | || (FIX)->fx_r_type == BFD_RELOC_32) | |
a2a5a4fa KR |
135 | #endif |
136 | ||
137 | #define md_operand(x) | |
138 | ||
7532235c RH |
139 | extern void sparc_md_end PARAMS ((void)); |
140 | #define md_end() sparc_md_end () | |
141 | ||
142 | #endif | |
143 | ||
8b228fe9 | 144 | /* end of tc-sparc.h */ |