1 /* tc-hppa.h -- Header file for the PA */
3 /* Copyright (C) 1989 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler.
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 1, or (at your option)
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
23 HP PA-RISC support was contributed by the Center for Software Science
24 at the University of Utah.
34 #define TARGET_ARCH bfd_arch_hppa
35 #define TARGET_FORMAT "elf32-hppa"
37 #define ASEC_NULL (asection *)0
39 /* We can do sym1 - sym2 as long as sym2 is $global$ */
41 #define SEG_DIFF_ALLOWED
45 SGL
, DBL
, ILLEGAL_FMT
, QUAD
48 extern char *expr_end
;
50 extern void s_globl (), s_long (), s_short (), s_space (), cons ();
51 extern void stringer ();
52 extern unsigned int next_char_of_string ();
54 extern void pa_big_cons ();
55 extern void pa_cons ();
56 extern void pa_data ();
57 extern void pa_desc ();
58 extern void pa_float_cons ();
59 extern void pa_fill ();
60 extern void pa_lcomm ();
61 extern void pa_lsym ();
62 extern void pa_stringer ();
63 extern void pa_text ();
64 extern void pa_version ();
66 int pa_parse_number ();
68 int pa_parse_fp_cmp_cond ();
70 FP_Operand_Format
pa_parse_fp_format ();
73 int getExpression (char *str
);
78 int getAbsoluteExpression ();
80 int evaluateAbsolute ();
82 int pa_build_arg_reloc ();
84 unsigned int pa_align_arg_reloc ();
88 int pa_parse_nullif ();
90 int pa_parse_nonneg_cmpsub_cmpltr ();
92 int pa_parse_neg_cmpsub_cmpltr ();
94 int pa_parse_nonneg_add_cmpltr ();
96 int pa_parse_neg_add_cmpltr ();
98 int pa_build_arg_reloc ();
100 void s_seg (), s_proc (), s_data1 ();
102 void pa_block (), pa_call (), pa_call_args (), pa_callinfo ();
103 void pa_code (), pa_comm (), pa_copyright (), pa_end ();
105 void pa_entry (), pa_equ (), pa_exit (), pa_export ();
106 void pa_export_args (), pa_import (), pa_label (), pa_leave ();
107 void pa_origin (), pa_proc (), pa_procend (), pa_space ();
108 void pa_spnum (), pa_subspace (), pa_version ();
110 extern const pseudo_typeS md_pseudo_table
[];
113 PA-89 floating point registers are arranged like this:
116 +--------------+--------------+
117 | 0 or 16L | 16 or 16R |
118 +--------------+--------------+
119 | 1 or 17L | 17 or 17R |
120 +--------------+--------------+
128 +--------------+--------------+
129 | 14 or 30L | 30 or 30R |
130 +--------------+--------------+
131 | 15 or 31L | 31 or 31R |
132 +--------------+--------------+
135 The following is a version of pa_parse_number that
136 handles the L/R notation and returns the correct
137 value to put into the instruction register field.
138 The correct value to put into the instruction is
139 encoded in the structure 'pa_89_fp_reg_struct'.
143 struct pa_89_fp_reg_struct
149 int need_89_opcode ();
150 int pa_89_parse_number ();
153 /* pa-ctrl-func.h -- Control Structures and Functions for the PA */
155 extern unsigned int assemble_3 ( /* unsigned int x; */ );
157 extern void dis_assemble_3 ( /* unsigned int x, *r; */ );
159 extern unsigned int assemble_12 ( /* unsigned int x,y; */ );
161 extern void dis_assemble_12 ( /* unsigned int as12, *x,*y */ );
163 extern unsigned long assemble_17 ( /* unsigned int x,y,z */ );
165 extern void dis_assemble_17 ( /* unsigned int as17, *x,*y,*z */ );
167 extern unsigned long assemble_21 ( /* unsigned int x; */ );
169 extern void dis_assemble_21 ( /* unsigned int as21,*x; */ );
171 extern void sign_unext ( /* unsigned int x,len; unsigned int *result */ );
173 extern void low_sign_unext ( /* unsigned int x,len; unsigned int *result */ );
177 unsigned int arg_reloc
;
178 unsigned int arg_count
;
181 typedef struct call_desc call_descS
;
183 extern call_descS last_call_desc
;
185 /* GDB debug support */
187 #if defined(OBJ_SOME)
188 #define GDB_DEBUG_SPACE_NAME "$GDB_DEBUG$"
189 #define GDB_STRINGS_SUBSPACE_NAME "$GDB_STRINGS$"
190 #define GDB_SYMBOLS_SUBSPACE_NAME "$GDB_SYMBOLS$"
192 #define GDB_DEBUG_SPACE_NAME ".stab"
193 #define GDB_STRINGS_SUBSPACE_NAME ".stabstr"
194 #define GDB_SYMBOLS_SUBSPACE_NAME ".stab"
196 /* pre-defined subsegments (subspaces) for the HP 9000 Series 800 */
198 #define SUBSEG_CODE 0
199 #define SUBSEG_DATA 0
202 #define SUBSEG_UNWIND 3
203 #define SUBSEG_GDB_STRINGS 0
204 #define SUBSEG_GDB_SYMBOLS 1
206 #define UNWIND_SECTION_NAME ".hppa_unwind"
207 /* subspace dictionary chain entry structure */
209 struct subspace_dictionary_chain
211 #if defined(OBJ_OSFROSE) | defined(OBJ_ELF)
213 region_command_t
*ssd_entry
;/* XXX: not sure this is what we need here */
215 Elf_Internal_Shdr
*ssd_entry
;
216 unsigned long ssd_vm_addr
;
218 char *ssd_name
; /* used until time of writing object file */
219 /* then we use ssd_entry->regc_region_name */
220 unsigned char ssd_quadrant
;
221 unsigned char ssd_sort_key
;
222 unsigned char ssd_common
;
223 unsigned char ssd_dup_common
;
224 unsigned char ssd_loadable
;
225 unsigned char ssd_code_only
;
227 subspace_dictS
*ssd_entry
; /* this dictionary */
229 int ssd_defined
; /* this subspace has been used */
230 int ssd_space_number
; /* space # this subspace is in */
231 asection
*ssd_seg
; /* this subspace = this seg */
232 int ssd_subseg
; /* and subseg */
234 int object_file_index
; /* index of this entry within
235 the subspace dictionary of
236 the object file (not used until
237 the object file is written */
238 int ssd_last_align
; /* the size of the last alignment
239 request for this subspace */
240 symbolS
*ssd_start_sym
; /* a symbol whose value is the
241 start of this subspace */
242 struct subspace_dictionary_chain
*ssd_next
; /* next subspace dict. entry */
245 typedef struct subspace_dictionary_chain subspace_dict_chainS
;
247 /* space dictionary chain entry structure */
249 struct space_dictionary_chain
252 region_command_t
*sd_entry
; /* XXX: not sure this is what we need here */
253 char *sd_name
; /* used until time of writing object file */
254 /* then we use sd_entry->regc_region_name */
255 unsigned int sd_loadable
;
256 unsigned int sd_private
;
257 unsigned int sd_spnum
;
258 unsigned char sd_sort_key
;
261 Elf_Internal_Shdr
*sd_entry
;
262 char *sd_name
; /* used until time of writing object file */
263 /* then we use sd_entry->sh_name */
264 unsigned int sd_loadable
;
265 unsigned int sd_private
;
266 unsigned int sd_spnum
;
267 unsigned char sd_sort_key
;
269 space_dictS
*sd_entry
; /* this dictionary */
272 int sd_defined
; /* this space has been used */
273 asection
*sd_seg
; /* GAS segment to which this space corresponds */
274 int sd_last_subseg
; /* current subsegment number we are using */
275 subspace_dict_chainS
*sd_subspaces
; /* all subspaces in this space */
276 struct space_dictionary_chain
*sd_next
; /* the next space dict. entry */
279 typedef struct space_dictionary_chain space_dict_chainS
;
282 Macros to maintain spaces and subspaces
286 #define SPACE_DEFINED(space_chain) (space_chain)->sd_defined
287 #define SPACE_PRIVATE(space_chain) (space_chain)->sd_private
288 #define SPACE_LOADABLE(space_chain) (space_chain)->sd_loadable
289 #define SPACE_SPNUM(space_chain) (space_chain)->sd_spnum
290 #define SPACE_SORT(space_chain) (space_chain)->sd_sort_key
291 #define SPACE_NAME(space_chain) (space_chain)->sd_name
293 #define SUBSPACE_QUADRANT(ss_chain) (ss_chain)->ssd_quadrant
294 #define SUBSPACE_ALIGN(ss_chain) (ss_chain)->ssd_entry->regc_addralign
295 #define SUBSPACE_ACCESS(ss_chain) (ss_chain)->ssd_entry->regc_initprot
296 #define SUBSPACE_SORT(ss_chain) (ss_chain)->ssd_sort_key
297 #define SUBSPACE_COMMON(ss_chain) (ss_chain)->ssd_common
298 #define SUBSPACE_ZERO(ss_chain) (ss_chain)->ssd_zero
299 #define SUBSPACE_DUP_COMM(ss_chain) (ss_chain)->ssd_dup_common
300 #define SUBSPACE_CODE_ONLY(ssch) ((ssch)->ssd_entry->regc_flags & REG_TEXT_T)
301 #define SET_SUBSPACE_CODE_ONLY(ssch,val) (ssch)->ssd_entry->regc_flags |= ((val) ? REG_TEXT_T : 0)
302 #define SUBSPACE_LOADABLE(ss_chain) (ss_chain)->ssd_loadable
303 #define SUBSPACE_SUBSPACE_START(ss_chain) (ss_chain)->ssd_entry->regc_addr.vm_addr
304 #define SUBSPACE_SUBSPACE_LENGTH(ss_chain) (ss_chain)->ssd_entry->regc_vm_size
305 #define SUBSPACE_REGION_NAME(ss_chain) (ss_chain)->ssd_entry->regc_region_name
306 #define SUBSPACE_NAME(ss_chain) (ss_chain)->ssd_name
310 #define RELOC_EXPANSION_POSSIBLE
311 #define MAX_RELOC_EXPANSION 5
313 #define SPACE_DEFINED(space_chain) (space_chain)->sd_defined
314 #define SPACE_PRIVATE(space_chain) (space_chain)->sd_private
315 #define SPACE_LOADABLE(space_chain) (space_chain)->sd_loadable
316 #define SPACE_SPNUM(space_chain) (space_chain)->sd_spnum
317 #define SPACE_SORT(space_chain) (space_chain)->sd_sort_key
318 #define SPACE_NAME(space_chain) (space_chain)->sd_name
320 #define SUBSPACE_QUADRANT(ss_chain) (ss_chain)->ssd_quadrant
321 #define SUBSPACE_ALIGN(ss_chain) (ss_chain)->ssd_entry->sh_addralign
322 #define SUBSPACE_ACCESS(ss_chain) (ss_chain)->ssd_entry->sh_flags
323 #define SUBSPACE_SORT(ss_chain) (ss_chain)->ssd_sort_key
324 #define SUBSPACE_COMMON(ss_chain) (ss_chain)->ssd_common
325 #define SUBSPACE_ZERO(ss_chain) (ss_chain)->ssd_zero
326 #define SUBSPACE_DUP_COMM(ss_chain) (ss_chain)->ssd_dup_common
327 #define SUBSPACE_CODE_ONLY(ssch) \
328 (((ssch)->ssd_entry->sh_flags & (SHF_ALLOC | SHF_EXECINSTR | SHF_WRITE)) \
329 == (SHF_ALLOC | SHF_EXECINSTR))
330 #define SET_SUBSPACE_CODE_ONLY(ssch,val) \
331 (ssch)->ssd_entry->sh_flags &= ((val) ? ~SHF_WRITE : 0xffffffff)
332 #define SUBSPACE_LOADABLE(ss_chain) (ss_chain)->ssd_loadable
333 #define SUBSPACE_SUBSPACE_START(ss_chain) (ss_chain)->ssd_vm_addr
334 #define SUBSPACE_SUBSPACE_LENGTH(ss_chain) (ss_chain)->ssd_entry->sh_size
335 #define SUBSPACE_NAME(ss_chain) (ss_chain)->ssd_name
337 #define STAB_FIXUP(frag,toptr,symP,stab_type) \
338 if ( (stab_type == 's' || stab_type == 'n') \
339 && symP->sy_value.X_seg == undefined_section) \
341 int i = S_GET_TYPE(symP) & N_TYPE; \
343 toptr-frag->fr_literal, /* where */ \
345 symP->sy_value.X_add_symbol, /* addr of sym for this stab */ \
348 i == N_UNDF || i == N_ABS, /* 1 if internal reloc */ \
350 e_fsel, /* fixup fld = F% */ \
356 else if ( stab_type == 'd' ) \
358 fix_new_hppa (frag, \
359 toptr-frag->fr_literal, /* where */ \
361 symP, /* addr of sym for this stab */ \
366 e_fsel, /* fixup fld = F% */ \
376 #define SPACE_DEFINED(space_chain) (space_chain)->sd_entry->is_defined
377 #define SPACE_PRIVATE(space_chain) (space_chain)->sd_entry->is_private
378 #define SPACE_LOADABLE(space_chain) (space_chain)->sd_entry->is_loadable
379 #define SPACE_SPNUM(space_chain) (space_chain)->sd_entry->space_number
380 #define SPACE_SORT(space_chain) (space_chain)->sd_entry->sort_key
381 #define SPACE_NAME(space_chain) (space_chain)->sd_entry->name
383 #define SUBSPACE_QUADRANT(ss_chain) (ss_chain)->ssd_entry->quadrant
384 #define SUBSPACE_ALIGN(ss_chain) (ss_chain)->ssd_entry->alignment
385 #define SUBSPACE_ACCESS(ss_chain) (ss_chain)->ssd_entry->access_control_bits
386 #define SUBSPACE_SORT(ss_chain) (ss_chain)->ssd_entry->sort_key
387 #define SUBSPACE_COMMON(ss_chain) (ss_chain)->ssd_entry->is_common
388 #define SUBSPACE_ZERO(ss_chain) (ss_chain)->ssd_zero
389 #define SUBSPACE_DUP_COMM(ss_chain) (ss_chain)->ssd_entry->dup_common
390 #define SUBSPACE_CODE_ONLY(ss_chain) (ss_chain)->ssd_entry->code_only
391 #define SUBSPACE_LOADABLE(ss_chain) (ss_chain)->ssd_entry->is_loadable
392 #define SUBSPACE_SUBSPACE_START(ss_chain) (ss_chain)->ssd_entry->subspace_start
393 #define SUBSPACE_SUBSPACE_LENGTH(ss_chain) (ss_chain)->ssd_entry->subspace_length
394 #define SUBSPACE_NAME(ss_chain) (ss_chain)->ssd_entry->name
397 extern space_dict_chainS
*space_dict_root
;
398 extern space_dict_chainS
*space_dict_last
;
400 extern space_dict_chainS
*current_space
;
401 extern subspace_dict_chainS
*current_subspace
;
403 extern space_dict_chainS
*create_new_space ();
405 extern subspace_dict_chainS
*create_new_subspace ();
407 extern subspace_dict_chainS
*update_subspace ();
409 extern space_dict_chainS
*is_defined_space ();
411 extern space_dict_chainS
*pa_segment_to_space ();
413 extern subspace_dict_chainS
*is_defined_subspace ();
415 extern subspace_dict_chainS
*pa_subsegment_to_subspace ();
417 extern space_dict_chainS
*pa_find_space_by_number ();
419 extern unsigned int pa_subspace_start ();
421 extern int is_last_defined_subspace ();
425 extern symbolS
*pa_get_start_symbol ();
427 extern symbolS
*pa_set_start_symbol ();
429 /* default space and subspace dictionaries */
431 struct default_subspace_dict
435 char loadable
, code_only
, common
, dup_common
, zero
, sort
;
436 int access
, space_index
, alignment
, quadrant
;
440 int def_space_index
; /* this is an index in the default spaces array */
441 char *alias
; /* an alias for this section (or NULL if there isn't one) */
446 extern struct default_subspace_dict pa_def_subspaces
[];
448 struct default_space_dict
460 char *alias
; /* an alias for this section (or NULL if there isn't one) */
464 extern struct default_space_dict pa_def_spaces
[];
467 Support for keeping track of the most recent label in each
471 typedef struct label_symbol_struct
473 symbolS
*lss_label
; /* the label symbol */
474 space_dict_chainS
*lss_space
; /* the space to which it applies*/
475 struct label_symbol_struct
*lss_next
; /* the next label symbol */
478 extern label_symbolS
*label_symbols_rootP
;
480 label_symbolS
*pa_get_label ();
481 int pa_label_is_defined ();
482 void pa_define_label ();
483 void pa_undefine_label ();
484 int pa_pseudo_op_moves_pc ();
486 /* end of label symbol support. */
488 #define is_DP_relative(exp) ( (exp).X_subtract_symbol \
489 && strcmp((exp).X_subtract_symbol->bsym->name, \
492 #define is_PC_relative(exp) ( (exp).X_subtract_symbol \
493 && strcmp((exp).X_subtract_symbol->bsym->name, \
494 "$PIC_pcrel$0") == 0 )
496 #define is_complex(exp) ((exp).X_seg && (exp).X_seg == diff_section)
498 #define tc_crawl_symbol_chain(headers) {;} /* Not used. */
500 #define tc_headers_hook(headers) {;} /* Not used. */
502 #define elf_tc_symbol elf_hppa_tc_symbol
503 #define elf_tc_make_sections elf_hppa_tc_make_sections
504 extern void elf_hppa_final_processing ();
505 #define elf_tc_final_processing elf_hppa_final_processing
507 /* We need to parse field selectors in .byte, etc. */
509 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \
510 parse_cons_expression_hppa (exp)
511 #define TC_CONS_FIX_NEW cons_fix_new_hppa
513 extern void parse_cons_expression_hppa
PARAMS ((expressionS
*exp
));
514 extern void cons_fix_new_hppa
PARAMS ((fragS
*frag
,
519 #endif /* _TC_HPPA_H */