1 /* tc-hppa.c -- Assemble for the PA
2 Copyright (C) 1989, 93, 94, 95, 96, 97, 98, 99, 2000
3 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 2, 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 the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 /* HP PA-RISC support was contributed by the Center for Software Science
24 at the University of Utah. */
32 #include "bfd/libhppa.h"
34 /* Be careful, this file includes data *declarations*. */
35 #include "opcode/hppa.h"
37 #if defined (OBJ_ELF) && defined (OBJ_SOM)
38 error only one of OBJ_ELF
and OBJ_SOM can be defined
41 /* If we are using ELF, then we probably can support dwarf2 debug
42 records. Furthermore, if we are supporting dwarf2 debug records,
43 then we want to use the assembler support for compact line numbers. */
45 #include "dwarf2dbg.h"
46 struct dwarf2_line_info debug_line
;
48 /* A "convient" place to put object file dependencies which do
49 not need to be seen outside of tc-hppa.c. */
51 /* Object file formats specify relocation types. */
52 typedef enum elf_hppa_reloc_type reloc_type
;
54 /* Object file formats specify BFD symbol types. */
55 typedef elf_symbol_type obj_symbol_type
;
56 #define symbol_arg_reloc_info(sym)\
57 (((obj_symbol_type *) symbol_get_bfdsym (sym))->tc_data.hppa_arg_reloc)
59 #if TARGET_ARCH_SIZE == 64
60 /* How to generate a relocation. */
61 #define hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type
63 #define hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
66 /* ELF objects can have versions, but apparently do not have anywhere
67 to store a copyright string. */
68 #define obj_version obj_elf_version
69 #define obj_copyright obj_elf_version
71 #define UNWIND_SECTION_NAME ".PARISC.unwind"
75 /* Names of various debugging spaces/subspaces. */
76 #define GDB_DEBUG_SPACE_NAME "$GDB_DEBUG$"
77 #define GDB_STRINGS_SUBSPACE_NAME "$GDB_STRINGS$"
78 #define GDB_SYMBOLS_SUBSPACE_NAME "$GDB_SYMBOLS$"
79 #define UNWIND_SECTION_NAME "$UNWIND$"
81 /* Object file formats specify relocation types. */
82 typedef int reloc_type
;
84 /* SOM objects can have both a version string and a copyright string. */
85 #define obj_version obj_som_version
86 #define obj_copyright obj_som_copyright
88 /* How to generate a relocation. */
89 #define hppa_gen_reloc_type hppa_som_gen_reloc_type
91 /* Object file formats specify BFD symbol types. */
92 typedef som_symbol_type obj_symbol_type
;
93 #define symbol_arg_reloc_info(sym)\
94 (((obj_symbol_type *) symbol_get_bfdsym (sym))->tc_data.ap.hppa_arg_reloc)
96 /* This apparently isn't in older versions of hpux reloc.h. */
98 #define R_DLT_REL 0x78
110 /* Various structures and types used internally in tc-hppa.c. */
112 /* Unwind table and descriptor. FIXME: Sync this with GDB version. */
116 unsigned int cannot_unwind
:1;
117 unsigned int millicode
:1;
118 unsigned int millicode_save_rest
:1;
119 unsigned int region_desc
:2;
120 unsigned int save_sr
:2;
121 unsigned int entry_fr
:4;
122 unsigned int entry_gr
:5;
123 unsigned int args_stored
:1;
124 unsigned int call_fr
:5;
125 unsigned int call_gr
:5;
126 unsigned int save_sp
:1;
127 unsigned int save_rp
:1;
128 unsigned int save_rp_in_frame
:1;
129 unsigned int extn_ptr_defined
:1;
130 unsigned int cleanup_defined
:1;
132 unsigned int hpe_interrupt_marker
:1;
133 unsigned int hpux_interrupt_marker
:1;
134 unsigned int reserved
:3;
135 unsigned int frame_size
:27;
140 /* Starting and ending offsets of the region described by
142 unsigned int start_offset
;
143 unsigned int end_offset
;
144 struct unwind_desc descriptor
;
147 /* This structure is used by the .callinfo, .enter, .leave pseudo-ops to
148 control the entry and exit code they generate. It is also used in
149 creation of the correct stack unwind descriptors.
151 NOTE: GAS does not support .enter and .leave for the generation of
152 prologues and epilogues. FIXME.
154 The fields in structure roughly correspond to the arguments available on the
155 .callinfo pseudo-op. */
159 /* The unwind descriptor being built. */
160 struct unwind_table ci_unwind
;
162 /* Name of this function. */
163 symbolS
*start_symbol
;
165 /* (temporary) symbol used to mark the end of this function. */
168 /* Next entry in the chain. */
169 struct call_info
*ci_next
;
172 /* Operand formats for FP instructions. Note not all FP instructions
173 allow all four formats to be used (for example fmpysub only allows
177 SGL
, DBL
, ILLEGAL_FMT
, QUAD
, W
, UW
, DW
, UDW
, QW
, UQW
181 /* This fully describes the symbol types which may be attached to
182 an EXPORT or IMPORT directive. Only SOM uses this formation
183 (ELF has no need for it). */
187 SYMBOL_TYPE_ABSOLUTE
,
191 SYMBOL_TYPE_MILLICODE
,
193 SYMBOL_TYPE_PRI_PROG
,
194 SYMBOL_TYPE_SEC_PROG
,
198 /* This structure contains information needed to assemble
199 individual instructions. */
202 /* Holds the opcode after parsing by pa_ip. */
203 unsigned long opcode
;
205 /* Holds an expression associated with the current instruction. */
208 /* Does this instruction use PC-relative addressing. */
211 /* Floating point formats for operand1 and operand2. */
212 fp_operand_format fpof1
;
213 fp_operand_format fpof2
;
215 /* Whether or not we saw a truncation request on an fcnv insn. */
218 /* Holds the field selector for this instruction
219 (for example L%, LR%, etc). */
222 /* Holds any argument relocation bits associated with this
223 instruction. (instruction should be some sort of call). */
224 unsigned int arg_reloc
;
226 /* The format specification for this instruction. */
229 /* The relocation (if any) associated with this instruction. */
233 /* PA-89 floating point registers are arranged like this:
236 +--------------+--------------+
237 | 0 or 16L | 16 or 16R |
238 +--------------+--------------+
239 | 1 or 17L | 17 or 17R |
240 +--------------+--------------+
248 +--------------+--------------+
249 | 14 or 30L | 30 or 30R |
250 +--------------+--------------+
251 | 15 or 31L | 31 or 31R |
252 +--------------+--------------+ */
254 /* Additional information needed to build argument relocation stubs. */
257 /* The argument relocation specification. */
258 unsigned int arg_reloc
;
260 /* Number of arguments. */
261 unsigned int arg_count
;
265 /* This structure defines an entry in the subspace dictionary
268 struct subspace_dictionary_chain
270 /* Nonzero if this space has been defined by the user code. */
271 unsigned int ssd_defined
;
273 /* Name of this subspace. */
276 /* GAS segment and subsegment associated with this subspace. */
280 /* Next space in the subspace dictionary chain. */
281 struct subspace_dictionary_chain
*ssd_next
;
284 typedef struct subspace_dictionary_chain ssd_chain_struct
;
286 /* This structure defines an entry in the subspace dictionary
289 struct space_dictionary_chain
291 /* Nonzero if this space has been defined by the user code or
292 as a default space. */
293 unsigned int sd_defined
;
295 /* Nonzero if this spaces has been defined by the user code. */
296 unsigned int sd_user_defined
;
298 /* The space number (or index). */
299 unsigned int sd_spnum
;
301 /* The name of this subspace. */
304 /* GAS segment to which this subspace corresponds. */
307 /* Current subsegment number being used. */
310 /* The chain of subspaces contained within this space. */
311 ssd_chain_struct
*sd_subspaces
;
313 /* The next entry in the space dictionary chain. */
314 struct space_dictionary_chain
*sd_next
;
317 typedef struct space_dictionary_chain sd_chain_struct
;
319 /* This structure defines attributes of the default subspace
320 dictionary entries. */
322 struct default_subspace_dict
324 /* Name of the subspace. */
327 /* FIXME. Is this still needed? */
330 /* Nonzero if this subspace is loadable. */
333 /* Nonzero if this subspace contains only code. */
336 /* Nonzero if this is a common subspace. */
339 /* Nonzero if this is a common subspace which allows symbols
340 to be multiply defined. */
343 /* Nonzero if this subspace should be zero filled. */
346 /* Sort key for this subspace. */
349 /* Access control bits for this subspace. Can represent RWX access
350 as well as privilege level changes for gateways. */
353 /* Index of containing space. */
356 /* Alignment (in bytes) of this subspace. */
359 /* Quadrant within space where this subspace should be loaded. */
362 /* An index into the default spaces array. */
365 /* Subsegment associated with this subspace. */
369 /* This structure defines attributes of the default space
370 dictionary entries. */
372 struct default_space_dict
374 /* Name of the space. */
377 /* Space number. It is possible to identify spaces within
378 assembly code numerically! */
381 /* Nonzero if this space is loadable. */
384 /* Nonzero if this space is "defined". FIXME is still needed */
387 /* Nonzero if this space can not be shared. */
390 /* Sort key for this space. */
393 /* Segment associated with this space. */
398 /* Structure for previous label tracking. Needed so that alignments,
399 callinfo declarations, etc can be easily attached to a particular
401 typedef struct label_symbol_struct
403 struct symbol
*lss_label
;
405 sd_chain_struct
*lss_space
;
410 struct label_symbol_struct
*lss_next
;
414 /* Extra information needed to perform fixups (relocations) on the PA. */
415 struct hppa_fix_struct
417 /* The field selector. */
418 enum hppa_reloc_field_selector_type_alt fx_r_field
;
423 /* Format of fixup. */
426 /* Argument relocation bits. */
427 unsigned int fx_arg_reloc
;
429 /* The segment this fixup appears in. */
433 /* Structure to hold information about predefined registers. */
441 /* This structure defines the mapping from a FP condition string
442 to a condition number which can be recorded in an instruction. */
449 /* This structure defines a mapping from a field selector
450 string to a field selector type. */
451 struct selector_entry
457 /* Prototypes for functions local to tc-hppa.c. */
460 static void pa_check_current_space_and_subspace
PARAMS ((void));
463 #if !(defined (OBJ_ELF) && defined (TE_LINUX))
464 static void pa_text
PARAMS ((int));
465 static void pa_data
PARAMS ((int));
466 static void pa_comm
PARAMS ((int));
468 static fp_operand_format pa_parse_fp_format
PARAMS ((char **s
));
469 static void pa_cons
PARAMS ((int));
470 static void pa_float_cons
PARAMS ((int));
471 static void pa_fill
PARAMS ((int));
472 static void pa_lcomm
PARAMS ((int));
473 static void pa_lsym
PARAMS ((int));
474 static void pa_stringer
PARAMS ((int));
475 static void pa_version
PARAMS ((int));
476 static int pa_parse_fp_cmp_cond
PARAMS ((char **));
477 static int get_expression
PARAMS ((char *));
478 static int pa_get_absolute_expression
PARAMS ((struct pa_it
*, char **));
479 static int evaluate_absolute
PARAMS ((struct pa_it
*));
480 static unsigned int pa_build_arg_reloc
PARAMS ((char *));
481 static unsigned int pa_align_arg_reloc
PARAMS ((unsigned int, unsigned int));
482 static int pa_parse_nullif
PARAMS ((char **));
483 static int pa_parse_nonneg_cmpsub_cmpltr
PARAMS ((char **, int));
484 static int pa_parse_neg_cmpsub_cmpltr
PARAMS ((char **, int));
485 static int pa_parse_neg_add_cmpltr
PARAMS ((char **, int));
486 static int pa_parse_nonneg_add_cmpltr
PARAMS ((char **, int));
487 static int pa_parse_cmpb_64_cmpltr
PARAMS ((char **));
488 static int pa_parse_cmpib_64_cmpltr
PARAMS ((char **));
489 static int pa_parse_addb_64_cmpltr
PARAMS ((char **));
490 static void pa_block
PARAMS ((int));
491 static void pa_brtab
PARAMS ((int));
492 static void pa_try
PARAMS ((int));
493 static void pa_call
PARAMS ((int));
494 static void pa_call_args
PARAMS ((struct call_desc
*));
495 static void pa_callinfo
PARAMS ((int));
496 static void pa_copyright
PARAMS ((int));
497 static void pa_end
PARAMS ((int));
498 static void pa_enter
PARAMS ((int));
499 static void pa_entry
PARAMS ((int));
500 static void pa_equ
PARAMS ((int));
501 static void pa_exit
PARAMS ((int));
502 static void pa_export
PARAMS ((int));
503 static void pa_type_args
PARAMS ((symbolS
*, int));
504 static void pa_import
PARAMS ((int));
505 static void pa_label
PARAMS ((int));
506 static void pa_leave
PARAMS ((int));
507 static void pa_level
PARAMS ((int));
508 static void pa_origin
PARAMS ((int));
509 static void pa_proc
PARAMS ((int));
510 static void pa_procend
PARAMS ((int));
511 static void pa_param
PARAMS ((int));
512 static void pa_undefine_label
PARAMS ((void));
513 static int need_pa11_opcode
PARAMS ((void));
514 static int pa_parse_number
PARAMS ((char **, int));
515 static label_symbol_struct
*pa_get_label
PARAMS ((void));
517 static int log2
PARAMS ((int));
518 static void pa_compiler
PARAMS ((int));
519 static void pa_align
PARAMS ((int));
520 static void pa_space
PARAMS ((int));
521 static void pa_spnum
PARAMS ((int));
522 static void pa_subspace
PARAMS ((int));
523 static sd_chain_struct
*create_new_space
PARAMS ((char *, int, int,
526 static ssd_chain_struct
*create_new_subspace
PARAMS ((sd_chain_struct
*,
531 static ssd_chain_struct
*update_subspace
PARAMS ((sd_chain_struct
*,
532 char *, int, int, int,
536 static sd_chain_struct
*is_defined_space
PARAMS ((char *));
537 static ssd_chain_struct
*is_defined_subspace
PARAMS ((char *));
538 static sd_chain_struct
*pa_segment_to_space
PARAMS ((asection
*));
539 static ssd_chain_struct
*pa_subsegment_to_subspace
PARAMS ((asection
*,
541 static sd_chain_struct
*pa_find_space_by_number
PARAMS ((int));
542 static unsigned int pa_subspace_start
PARAMS ((sd_chain_struct
*, int));
543 static sd_chain_struct
*pa_parse_space_stmt
PARAMS ((char *, int));
544 static int pa_next_subseg
PARAMS ((sd_chain_struct
*));
545 static void pa_spaces_begin
PARAMS ((void));
547 static void pa_ip
PARAMS ((char *));
548 static void fix_new_hppa
PARAMS ((fragS
*, int, int, symbolS
*,
549 offsetT
, expressionS
*, int,
550 bfd_reloc_code_real_type
,
551 enum hppa_reloc_field_selector_type_alt
,
552 int, unsigned int, int *));
553 static int is_end_of_statement
PARAMS ((void));
554 static int reg_name_search
PARAMS ((char *));
555 static int pa_chk_field_selector
PARAMS ((char **));
556 static int is_same_frag
PARAMS ((fragS
*, fragS
*));
557 static void process_exit
PARAMS ((void));
558 static unsigned int pa_stringer_aux
PARAMS ((char *));
559 static fp_operand_format pa_parse_fp_cnv_format
PARAMS ((char **s
));
560 static int pa_parse_ftest_gfx_completer
PARAMS ((char **));
563 static void hppa_elf_mark_end_of_function
PARAMS ((void));
564 static void pa_build_unwind_subspace
PARAMS ((struct call_info
*));
565 static void pa_vtable_entry
PARAMS ((int));
566 static void pa_vtable_inherit
PARAMS ((int));
569 /* File and gloally scoped variable declarations. */
572 /* Root and final entry in the space chain. */
573 static sd_chain_struct
*space_dict_root
;
574 static sd_chain_struct
*space_dict_last
;
576 /* The current space and subspace. */
577 static sd_chain_struct
*current_space
;
578 static ssd_chain_struct
*current_subspace
;
581 /* Root of the call_info chain. */
582 static struct call_info
*call_info_root
;
584 /* The last call_info (for functions) structure
585 seen so it can be associated with fixups and
587 static struct call_info
*last_call_info
;
589 /* The last call description (for actual calls). */
590 static struct call_desc last_call_desc
;
592 /* handle of the OPCODE hash table */
593 static struct hash_control
*op_hash
= NULL
;
595 /* Table of pseudo ops for the PA. FIXME -- how many of these
596 are now redundant with the overall GAS and the object file
598 const pseudo_typeS md_pseudo_table
[] =
600 /* align pseudo-ops on the PA specify the actual alignment requested,
601 not the log2 of the requested alignment. */
603 {"align", pa_align
, 8},
606 {"align", s_align_bytes
, 8},
608 {"begin_brtab", pa_brtab
, 1},
609 {"begin_try", pa_try
, 1},
610 {"block", pa_block
, 1},
611 {"blockz", pa_block
, 0},
612 {"byte", pa_cons
, 1},
613 {"call", pa_call
, 0},
614 {"callinfo", pa_callinfo
, 0},
615 #if defined (OBJ_ELF) && defined (TE_LINUX)
616 {"code", obj_elf_text
, 0},
618 {"code", pa_text
, 0},
619 {"comm", pa_comm
, 0},
622 {"compiler", pa_compiler
, 0},
624 {"copyright", pa_copyright
, 0},
625 #if !(defined (OBJ_ELF) && defined (TE_LINUX))
626 {"data", pa_data
, 0},
628 {"double", pa_float_cons
, 'd'},
629 {"dword", pa_cons
, 8},
631 {"end_brtab", pa_brtab
, 0},
632 #if !(defined (OBJ_ELF) && defined (TE_LINUX))
633 {"end_try", pa_try
, 0},
635 {"enter", pa_enter
, 0},
636 {"entry", pa_entry
, 0},
638 {"exit", pa_exit
, 0},
639 {"export", pa_export
, 0},
641 {"file", dwarf2_directive_file
, 0 },
643 {"fill", pa_fill
, 0},
644 {"float", pa_float_cons
, 'f'},
645 {"half", pa_cons
, 2},
646 {"import", pa_import
, 0},
648 {"label", pa_label
, 0},
649 {"lcomm", pa_lcomm
, 0},
650 {"leave", pa_leave
, 0},
651 {"level", pa_level
, 0},
653 {"loc", dwarf2_directive_loc
, 0 },
655 {"long", pa_cons
, 4},
656 {"lsym", pa_lsym
, 0},
658 {"nsubspa", pa_subspace
, 1},
660 {"octa", pa_cons
, 16},
661 {"org", pa_origin
, 0},
662 {"origin", pa_origin
, 0},
663 {"param", pa_param
, 0},
664 {"proc", pa_proc
, 0},
665 {"procend", pa_procend
, 0},
666 {"quad", pa_cons
, 8},
668 {"short", pa_cons
, 2},
669 {"single", pa_float_cons
, 'f'},
671 {"space", pa_space
, 0},
672 {"spnum", pa_spnum
, 0},
674 {"string", pa_stringer
, 0},
675 {"stringz", pa_stringer
, 1},
677 {"subspa", pa_subspace
, 0},
679 #if !(defined (OBJ_ELF) && defined (TE_LINUX))
680 {"text", pa_text
, 0},
682 {"version", pa_version
, 0},
684 {"vtable_entry", pa_vtable_entry
, 0},
685 {"vtable_inherit", pa_vtable_inherit
, 0},
687 {"word", pa_cons
, 4},
691 /* This array holds the chars that only start a comment at the beginning of
692 a line. If the line seems to have the form '# 123 filename'
693 .line and .file directives will appear in the pre-processed output.
695 Note that input_file.c hand checks for '#' at the beginning of the
696 first line of the input file. This is because the compiler outputs
697 #NO_APP at the beginning of its output.
699 Also note that C style comments will always work. */
700 const char line_comment_chars
[] = "#";
702 /* This array holds the chars that always start a comment. If the
703 pre-processor is disabled, these aren't very useful. */
704 const char comment_chars
[] = ";";
706 /* This array holds the characters which act as line separators. */
707 const char line_separator_chars
[] = "!";
709 /* Chars that can be used to separate mant from exp in floating point nums. */
710 const char EXP_CHARS
[] = "eE";
712 /* Chars that mean this number is a floating point constant.
713 As in 0f12.456 or 0d1.2345e12.
715 Be aware that MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT may have to be
716 changed in read.c. Ideally it shouldn't hae to know abou it at
717 all, but nothing is ideal around here. */
718 const char FLT_CHARS
[] = "rRsSfFdDxXpP";
720 static struct pa_it the_insn
;
722 /* Points to the end of an expression just parsed by get_expressoin
723 and friends. FIXME. This shouldn't be handled with a file-global
725 static char *expr_end
;
727 /* Nonzero if a .callinfo appeared within the current procedure. */
728 static int callinfo_found
;
730 /* Nonzero if the assembler is currently within a .entry/.exit pair. */
731 static int within_entry_exit
;
733 /* Nonzero if the assembler is currently within a procedure definition. */
734 static int within_procedure
;
736 /* Handle on structure which keep track of the last symbol
737 seen in each subspace. */
738 static label_symbol_struct
*label_symbols_rootp
= NULL
;
740 /* Holds the last field selector. */
741 static int hppa_field_selector
;
743 /* Nonzero when strict syntax checking is enabled. Zero otherwise.
745 Each opcode in the table has a flag which indicates whether or not
746 strict syntax checking should be enabled for that instruction. */
747 static int strict
= 0;
749 /* pa_parse_number returns values in `pa_number'. Mostly
750 pa_parse_number is used to return a register number, with floating
751 point registers being numbered from FP_REG_BASE upwards.
752 The bit specified with FP_REG_RSEL is set if the floating point
753 register has a `r' suffix. */
754 #define FP_REG_BASE 64
755 #define FP_REG_RSEL 128
756 static int pa_number
;
759 /* A dummy bfd symbol so that all relocations have symbols of some kind. */
760 static symbolS
*dummy_symbol
;
763 /* Nonzero if errors are to be printed. */
764 static int print_errors
= 1;
766 /* List of registers that are pre-defined:
768 Each general register has one predefined name of the form
769 %r<REGNUM> which has the value <REGNUM>.
771 Space and control registers are handled in a similar manner,
772 but use %sr<REGNUM> and %cr<REGNUM> as their predefined names.
774 Likewise for the floating point registers, but of the form
775 %fr<REGNUM>. Floating point registers have additional predefined
776 names with 'L' and 'R' suffixes (e.g. %fr19L, %fr19R) which
777 again have the value <REGNUM>.
779 Many registers also have synonyms:
781 %r26 - %r23 have %arg0 - %arg3 as synonyms
782 %r28 - %r29 have %ret0 - %ret1 as synonyms
783 %r30 has %sp as a synonym
784 %r27 has %dp as a synonym
785 %r2 has %rp as a synonym
787 Almost every control register has a synonym; they are not listed
790 The table is sorted. Suitable for searching by a binary search. */
792 static const struct pd_reg pre_defined_registers
[] =
826 {"%fr0", 0 + FP_REG_BASE
},
827 {"%fr0l", 0 + FP_REG_BASE
},
828 {"%fr0r", 0 + FP_REG_BASE
+ FP_REG_RSEL
},
829 {"%fr1", 1 + FP_REG_BASE
},
830 {"%fr10", 10 + FP_REG_BASE
},
831 {"%fr10l", 10 + FP_REG_BASE
},
832 {"%fr10r", 10 + FP_REG_BASE
+ FP_REG_RSEL
},
833 {"%fr11", 11 + FP_REG_BASE
},
834 {"%fr11l", 11 + FP_REG_BASE
},
835 {"%fr11r", 11 + FP_REG_BASE
+ FP_REG_RSEL
},
836 {"%fr12", 12 + FP_REG_BASE
},
837 {"%fr12l", 12 + FP_REG_BASE
},
838 {"%fr12r", 12 + FP_REG_BASE
+ FP_REG_RSEL
},
839 {"%fr13", 13 + FP_REG_BASE
},
840 {"%fr13l", 13 + FP_REG_BASE
},
841 {"%fr13r", 13 + FP_REG_BASE
+ FP_REG_RSEL
},
842 {"%fr14", 14 + FP_REG_BASE
},
843 {"%fr14l", 14 + FP_REG_BASE
},
844 {"%fr14r", 14 + FP_REG_BASE
+ FP_REG_RSEL
},
845 {"%fr15", 15 + FP_REG_BASE
},
846 {"%fr15l", 15 + FP_REG_BASE
},
847 {"%fr15r", 15 + FP_REG_BASE
+ FP_REG_RSEL
},
848 {"%fr16", 16 + FP_REG_BASE
},
849 {"%fr16l", 16 + FP_REG_BASE
},
850 {"%fr16r", 16 + FP_REG_BASE
+ FP_REG_RSEL
},
851 {"%fr17", 17 + FP_REG_BASE
},
852 {"%fr17l", 17 + FP_REG_BASE
},
853 {"%fr17r", 17 + FP_REG_BASE
+ FP_REG_RSEL
},
854 {"%fr18", 18 + FP_REG_BASE
},
855 {"%fr18l", 18 + FP_REG_BASE
},
856 {"%fr18r", 18 + FP_REG_BASE
+ FP_REG_RSEL
},
857 {"%fr19", 19 + FP_REG_BASE
},
858 {"%fr19l", 19 + FP_REG_BASE
},
859 {"%fr19r", 19 + FP_REG_BASE
+ FP_REG_RSEL
},
860 {"%fr1l", 1 + FP_REG_BASE
},
861 {"%fr1r", 1 + FP_REG_BASE
+ FP_REG_RSEL
},
862 {"%fr2", 2 + FP_REG_BASE
},
863 {"%fr20", 20 + FP_REG_BASE
},
864 {"%fr20l", 20 + FP_REG_BASE
},
865 {"%fr20r", 20 + FP_REG_BASE
+ FP_REG_RSEL
},
866 {"%fr21", 21 + FP_REG_BASE
},
867 {"%fr21l", 21 + FP_REG_BASE
},
868 {"%fr21r", 21 + FP_REG_BASE
+ FP_REG_RSEL
},
869 {"%fr22", 22 + FP_REG_BASE
},
870 {"%fr22l", 22 + FP_REG_BASE
},
871 {"%fr22r", 22 + FP_REG_BASE
+ FP_REG_RSEL
},
872 {"%fr23", 23 + FP_REG_BASE
},
873 {"%fr23l", 23 + FP_REG_BASE
},
874 {"%fr23r", 23 + FP_REG_BASE
+ FP_REG_RSEL
},
875 {"%fr24", 24 + FP_REG_BASE
},
876 {"%fr24l", 24 + FP_REG_BASE
},
877 {"%fr24r", 24 + FP_REG_BASE
+ FP_REG_RSEL
},
878 {"%fr25", 25 + FP_REG_BASE
},
879 {"%fr25l", 25 + FP_REG_BASE
},
880 {"%fr25r", 25 + FP_REG_BASE
+ FP_REG_RSEL
},
881 {"%fr26", 26 + FP_REG_BASE
},
882 {"%fr26l", 26 + FP_REG_BASE
},
883 {"%fr26r", 26 + FP_REG_BASE
+ FP_REG_RSEL
},
884 {"%fr27", 27 + FP_REG_BASE
},
885 {"%fr27l", 27 + FP_REG_BASE
},
886 {"%fr27r", 27 + FP_REG_BASE
+ FP_REG_RSEL
},
887 {"%fr28", 28 + FP_REG_BASE
},
888 {"%fr28l", 28 + FP_REG_BASE
},
889 {"%fr28r", 28 + FP_REG_BASE
+ FP_REG_RSEL
},
890 {"%fr29", 29 + FP_REG_BASE
},
891 {"%fr29l", 29 + FP_REG_BASE
},
892 {"%fr29r", 29 + FP_REG_BASE
+ FP_REG_RSEL
},
893 {"%fr2l", 2 + FP_REG_BASE
},
894 {"%fr2r", 2 + FP_REG_BASE
+ FP_REG_RSEL
},
895 {"%fr3", 3 + FP_REG_BASE
},
896 {"%fr30", 30 + FP_REG_BASE
},
897 {"%fr30l", 30 + FP_REG_BASE
},
898 {"%fr30r", 30 + FP_REG_BASE
+ FP_REG_RSEL
},
899 {"%fr31", 31 + FP_REG_BASE
},
900 {"%fr31l", 31 + FP_REG_BASE
},
901 {"%fr31r", 31 + FP_REG_BASE
+ FP_REG_RSEL
},
902 {"%fr3l", 3 + FP_REG_BASE
},
903 {"%fr3r", 3 + FP_REG_BASE
+ FP_REG_RSEL
},
904 {"%fr4", 4 + FP_REG_BASE
},
905 {"%fr4l", 4 + FP_REG_BASE
},
906 {"%fr4r", 4 + FP_REG_BASE
+ FP_REG_RSEL
},
907 {"%fr5", 5 + FP_REG_BASE
},
908 {"%fr5l", 5 + FP_REG_BASE
},
909 {"%fr5r", 5 + FP_REG_BASE
+ FP_REG_RSEL
},
910 {"%fr6", 6 + FP_REG_BASE
},
911 {"%fr6l", 6 + FP_REG_BASE
},
912 {"%fr6r", 6 + FP_REG_BASE
+ FP_REG_RSEL
},
913 {"%fr7", 7 + FP_REG_BASE
},
914 {"%fr7l", 7 + FP_REG_BASE
},
915 {"%fr7r", 7 + FP_REG_BASE
+ FP_REG_RSEL
},
916 {"%fr8", 8 + FP_REG_BASE
},
917 {"%fr8l", 8 + FP_REG_BASE
},
918 {"%fr8r", 8 + FP_REG_BASE
+ FP_REG_RSEL
},
919 {"%fr9", 9 + FP_REG_BASE
},
920 {"%fr9l", 9 + FP_REG_BASE
},
921 {"%fr9r", 9 + FP_REG_BASE
+ FP_REG_RSEL
},
992 /* This table is sorted by order of the length of the string. This is
993 so we check for <> before we check for <. If we had a <> and checked
994 for < first, we would get a false match. */
995 static const struct fp_cond_map fp_cond_map
[] =
1031 static const struct selector_entry selector_table
[] =
1056 /* default space and subspace dictionaries */
1058 #define GDB_SYMBOLS GDB_SYMBOLS_SUBSPACE_NAME
1059 #define GDB_STRINGS GDB_STRINGS_SUBSPACE_NAME
1061 /* pre-defined subsegments (subspaces) for the HPPA. */
1062 #define SUBSEG_CODE 0
1063 #define SUBSEG_LIT 1
1064 #define SUBSEG_MILLI 2
1065 #define SUBSEG_DATA 0
1066 #define SUBSEG_BSS 2
1067 #define SUBSEG_UNWIND 3
1068 #define SUBSEG_GDB_STRINGS 0
1069 #define SUBSEG_GDB_SYMBOLS 1
1071 static struct default_subspace_dict pa_def_subspaces
[] =
1073 {"$CODE$", 1, 1, 1, 0, 0, 0, 24, 0x2c, 0, 8, 0, 0, SUBSEG_CODE
},
1074 {"$DATA$", 1, 1, 0, 0, 0, 0, 24, 0x1f, 1, 8, 1, 1, SUBSEG_DATA
},
1075 {"$LIT$", 1, 1, 0, 0, 0, 0, 16, 0x2c, 0, 8, 0, 0, SUBSEG_LIT
},
1076 {"$MILLICODE$", 1, 1, 0, 0, 0, 0, 8, 0x2c, 0, 8, 0, 0, SUBSEG_MILLI
},
1077 {"$BSS$", 1, 1, 0, 0, 0, 1, 80, 0x1f, 1, 8, 1, 1, SUBSEG_BSS
},
1078 {NULL
, 0, 1, 0, 0, 0, 0, 255, 0x1f, 0, 4, 0, 0, 0}
1081 static struct default_space_dict pa_def_spaces
[] =
1083 {"$TEXT$", 0, 1, 1, 0, 8, ASEC_NULL
},
1084 {"$PRIVATE$", 1, 1, 1, 1, 16, ASEC_NULL
},
1085 {NULL
, 0, 0, 0, 0, 0, ASEC_NULL
}
1088 /* Misc local definitions used by the assembler. */
1090 /* These macros are used to maintain spaces/subspaces. */
1091 #define SPACE_DEFINED(space_chain) (space_chain)->sd_defined
1092 #define SPACE_USER_DEFINED(space_chain) (space_chain)->sd_user_defined
1093 #define SPACE_SPNUM(space_chain) (space_chain)->sd_spnum
1094 #define SPACE_NAME(space_chain) (space_chain)->sd_name
1096 #define SUBSPACE_DEFINED(ss_chain) (ss_chain)->ssd_defined
1097 #define SUBSPACE_NAME(ss_chain) (ss_chain)->ssd_name
1100 /* Return nonzero if the string pointed to by S potentially represents
1101 a right or left half of a FP register */
1102 #define IS_R_SELECT(S) (*(S) == 'R' || *(S) == 'r')
1103 #define IS_L_SELECT(S) (*(S) == 'L' || *(S) == 'l')
1105 /* Insert FIELD into OPCODE starting at bit START. Continue pa_ip
1106 main loop after insertion. */
1108 #define INSERT_FIELD_AND_CONTINUE(OPCODE, FIELD, START) \
1110 ((OPCODE) |= (FIELD) << (START)); \
1114 /* Simple range checking for FIELD againt HIGH and LOW bounds.
1115 IGNORE is used to suppress the error message. */
1117 #define CHECK_FIELD(FIELD, HIGH, LOW, IGNORE) \
1119 if ((FIELD) > (HIGH) || (FIELD) < (LOW)) \
1122 as_bad (_("Field out of range [%d..%d] (%d)."), (LOW), (HIGH), \
1128 /* Simple alignment checking for FIELD againt ALIGN (a power of two).
1129 IGNORE is used to suppress the error message. */
1131 #define CHECK_ALIGN(FIELD, ALIGN, IGNORE) \
1133 if ((FIELD) & ((ALIGN) - 1)) \
1136 as_bad (_("Field not properly aligned [%d] (%d)."), (ALIGN), \
1142 #define is_DP_relative(exp) \
1143 ((exp).X_op == O_subtract \
1144 && strcmp (S_GET_NAME ((exp).X_op_symbol), "$global$") == 0)
1146 #define is_PC_relative(exp) \
1147 ((exp).X_op == O_subtract \
1148 && strcmp (S_GET_NAME ((exp).X_op_symbol), "$PIC_pcrel$0") == 0)
1150 /* We need some complex handling for stabs (sym1 - sym2). Luckily, we'll
1151 always be able to reduce the expression to a constant, so we don't
1152 need real complex handling yet. */
1153 #define is_complex(exp) \
1154 ((exp).X_op != O_constant && (exp).X_op != O_symbol)
1156 /* Actual functions to implement the PA specific code for the assembler. */
1158 /* Called before writing the object file. Make sure entry/exit and
1159 proc/procend pairs match. */
1164 if (within_entry_exit
)
1165 as_fatal (_("Missing .exit\n"));
1167 if (within_procedure
)
1168 as_fatal (_("Missing .procend\n"));
1171 /* Returns a pointer to the label_symbol_struct for the current space.
1172 or NULL if no label_symbol_struct exists for the current space. */
1174 static label_symbol_struct
*
1177 label_symbol_struct
*label_chain
;
1179 for (label_chain
= label_symbols_rootp
;
1181 label_chain
= label_chain
->lss_next
)
1184 if (current_space
== label_chain
->lss_space
&& label_chain
->lss_label
)
1188 if (now_seg
== label_chain
->lss_segment
&& label_chain
->lss_label
)
1196 /* Defines a label for the current space. If one is already defined,
1197 this function will replace it with the new label. */
1200 pa_define_label (symbol
)
1203 label_symbol_struct
*label_chain
= pa_get_label ();
1206 label_chain
->lss_label
= symbol
;
1209 /* Create a new label entry and add it to the head of the chain. */
1211 = (label_symbol_struct
*) xmalloc (sizeof (label_symbol_struct
));
1212 label_chain
->lss_label
= symbol
;
1214 label_chain
->lss_space
= current_space
;
1217 label_chain
->lss_segment
= now_seg
;
1219 label_chain
->lss_next
= NULL
;
1221 if (label_symbols_rootp
)
1222 label_chain
->lss_next
= label_symbols_rootp
;
1224 label_symbols_rootp
= label_chain
;
1228 /* Removes a label definition for the current space.
1229 If there is no label_symbol_struct entry, then no action is taken. */
1232 pa_undefine_label ()
1234 label_symbol_struct
*label_chain
;
1235 label_symbol_struct
*prev_label_chain
= NULL
;
1237 for (label_chain
= label_symbols_rootp
;
1239 label_chain
= label_chain
->lss_next
)
1243 && current_space
== label_chain
->lss_space
&& label_chain
->lss_label
1246 && now_seg
== label_chain
->lss_segment
&& label_chain
->lss_label
1250 /* Remove the label from the chain and free its memory. */
1251 if (prev_label_chain
)
1252 prev_label_chain
->lss_next
= label_chain
->lss_next
;
1254 label_symbols_rootp
= label_chain
->lss_next
;
1259 prev_label_chain
= label_chain
;
1264 /* An HPPA-specific version of fix_new. This is required because the HPPA
1265 code needs to keep track of some extra stuff. Each call to fix_new_hppa
1266 results in the creation of an instance of an hppa_fix_struct. An
1267 hppa_fix_struct stores the extra information along with a pointer to the
1268 original fixS. This is attached to the original fixup via the
1269 tc_fix_data field. */
1272 fix_new_hppa (frag
, where
, size
, add_symbol
, offset
, exp
, pcrel
,
1273 r_type
, r_field
, r_format
, arg_reloc
, unwind_bits
)
1277 symbolS
*add_symbol
;
1281 bfd_reloc_code_real_type r_type
;
1282 enum hppa_reloc_field_selector_type_alt r_field
;
1284 unsigned int arg_reloc
;
1285 int* unwind_bits ATTRIBUTE_UNUSED
;
1289 struct hppa_fix_struct
*hppa_fix
= (struct hppa_fix_struct
*)
1290 obstack_alloc (¬es
, sizeof (struct hppa_fix_struct
));
1293 new_fix
= fix_new_exp (frag
, where
, size
, exp
, pcrel
, r_type
);
1295 new_fix
= fix_new (frag
, where
, size
, add_symbol
, offset
, pcrel
, r_type
);
1296 new_fix
->tc_fix_data
= (void *) hppa_fix
;
1297 hppa_fix
->fx_r_type
= r_type
;
1298 hppa_fix
->fx_r_field
= r_field
;
1299 hppa_fix
->fx_r_format
= r_format
;
1300 hppa_fix
->fx_arg_reloc
= arg_reloc
;
1301 hppa_fix
->segment
= now_seg
;
1303 if (r_type
== R_ENTRY
|| r_type
== R_EXIT
)
1304 new_fix
->fx_offset
= *unwind_bits
;
1307 /* foo-$global$ is used to access non-automatic storage. $global$
1308 is really just a marker and has served its purpose, so eliminate
1309 it now so as not to confuse write.c. Ditto for $PIC_pcrel$0. */
1310 if (new_fix
->fx_subsy
1311 && (strcmp (S_GET_NAME (new_fix
->fx_subsy
), "$global$") == 0
1312 || strcmp (S_GET_NAME (new_fix
->fx_subsy
), "$PIC_pcrel$0") == 0))
1313 new_fix
->fx_subsy
= NULL
;
1316 /* Parse a .byte, .word, .long expression for the HPPA. Called by
1317 cons via the TC_PARSE_CONS_EXPRESSION macro. */
1320 parse_cons_expression_hppa (exp
)
1323 hppa_field_selector
= pa_chk_field_selector (&input_line_pointer
);
1327 /* This fix_new is called by cons via TC_CONS_FIX_NEW.
1328 hppa_field_selector is set by the parse_cons_expression_hppa. */
1331 cons_fix_new_hppa (frag
, where
, size
, exp
)
1337 unsigned int rel_type
;
1339 /* Get a base relocation type. */
1340 if (is_DP_relative (*exp
))
1341 rel_type
= R_HPPA_GOTOFF
;
1342 else if (is_complex (*exp
))
1343 rel_type
= R_HPPA_COMPLEX
;
1347 if (hppa_field_selector
!= e_psel
&& hppa_field_selector
!= e_fsel
)
1349 as_warn (_("Invalid field selector. Assuming F%%."));
1350 hppa_field_selector
= e_fsel
;
1353 fix_new_hppa (frag
, where
, size
,
1354 (symbolS
*) NULL
, (offsetT
) 0, exp
, 0, rel_type
,
1355 hppa_field_selector
, size
* 8, 0, NULL
);
1357 /* Reset field selector to its default state. */
1358 hppa_field_selector
= 0;
1361 /* This function is called once, at assembler startup time. It should
1362 set up all the tables, etc. that the MD part of the assembler will need. */
1367 const char *retval
= NULL
;
1371 last_call_info
= NULL
;
1372 call_info_root
= NULL
;
1374 /* Set the default machine type. */
1375 if (!bfd_set_arch_mach (stdoutput
, bfd_arch_hppa
, 10))
1376 as_warn (_("could not set architecture and machine"));
1378 /* Folding of text and data segments fails miserably on the PA.
1379 Warn user and disable "-R" option. */
1380 if (flag_readonly_data_in_text
)
1382 as_warn (_("-R option not supported on this target."));
1383 flag_readonly_data_in_text
= 0;
1390 op_hash
= hash_new ();
1392 while (i
< NUMOPCODES
)
1394 const char *name
= pa_opcodes
[i
].name
;
1395 retval
= hash_insert (op_hash
, name
, (struct pa_opcode
*) &pa_opcodes
[i
]);
1396 if (retval
!= NULL
&& *retval
!= '\0')
1398 as_fatal (_("Internal error: can't hash `%s': %s\n"), name
, retval
);
1403 if ((pa_opcodes
[i
].match
& pa_opcodes
[i
].mask
)
1404 != pa_opcodes
[i
].match
)
1406 fprintf (stderr
, _("internal error: losing opcode: `%s' \"%s\"\n"),
1407 pa_opcodes
[i
].name
, pa_opcodes
[i
].args
);
1412 while (i
< NUMOPCODES
&& !strcmp (pa_opcodes
[i
].name
, name
));
1416 as_fatal (_("Broken assembler. No assembly attempted."));
1419 /* SOM will change text_section. To make sure we never put
1420 anything into the old one switch to the new one now. */
1421 subseg_set (text_section
, 0);
1425 dummy_symbol
= symbol_find_or_make ("L$dummy");
1426 S_SET_SEGMENT (dummy_symbol
, text_section
);
1427 /* Force the symbol to be converted to a real symbol. */
1428 (void) symbol_get_bfdsym (dummy_symbol
);
1432 /* Assemble a single instruction storing it into a frag. */
1439 /* The had better be something to assemble. */
1442 /* If we are within a procedure definition, make sure we've
1443 defined a label for the procedure; handle case where the
1444 label was defined after the .PROC directive.
1446 Note there's not need to diddle with the segment or fragment
1447 for the label symbol in this case. We have already switched
1448 into the new $CODE$ subspace at this point. */
1449 if (within_procedure
&& last_call_info
->start_symbol
== NULL
)
1451 label_symbol_struct
*label_symbol
= pa_get_label ();
1455 if (label_symbol
->lss_label
)
1457 last_call_info
->start_symbol
= label_symbol
->lss_label
;
1458 symbol_get_bfdsym (label_symbol
->lss_label
)->flags
1461 /* Also handle allocation of a fixup to hold the unwind
1462 information when the label appears after the proc/procend. */
1463 if (within_entry_exit
)
1465 char *where
= frag_more (0);
1467 fix_new_hppa (frag_now
, where
- frag_now
->fr_literal
, 0,
1468 NULL
, (offsetT
) 0, NULL
,
1469 0, R_HPPA_ENTRY
, e_fsel
, 0, 0,
1470 (int *)&last_call_info
->ci_unwind
.descriptor
);
1475 as_bad (_("Missing function name for .PROC (corrupted label chain)"));
1478 as_bad (_("Missing function name for .PROC"));
1481 /* Assemble the instruction. Results are saved into "the_insn". */
1484 /* Get somewhere to put the assembled instrution. */
1487 /* Output the opcode. */
1488 md_number_to_chars (to
, the_insn
.opcode
, 4);
1490 /* If necessary output more stuff. */
1491 if (the_insn
.reloc
!= R_HPPA_NONE
)
1492 fix_new_hppa (frag_now
, (to
- frag_now
->fr_literal
), 4, NULL
,
1493 (offsetT
) 0, &the_insn
.exp
, the_insn
.pcrel
,
1494 the_insn
.reloc
, the_insn
.field_selector
,
1495 the_insn
.format
, the_insn
.arg_reloc
, NULL
);
1498 if (debug_type
== DEBUG_DWARF2
)
1502 /* First update the notion of the current source line. */
1503 dwarf2_where (&debug_line
);
1505 /* We want the offset of the start of this instruction within the
1506 the current frag. */
1507 addr
= frag_now
->fr_address
+ frag_now_fix () - 4;
1509 /* And record the information. */
1510 dwarf2_gen_line_info (addr
, &debug_line
);
1515 /* Do the real work for assembling a single instruction. Store results
1516 into the global "the_insn" variable. */
1522 char *error_message
= "";
1523 char *s
, c
, *argstart
, *name
, *save_s
;
1527 int cmpltr
, nullif
, flag
, cond
, num
;
1528 unsigned long opcode
;
1529 struct pa_opcode
*insn
;
1532 /* We must have a valid space and subspace. */
1533 pa_check_current_space_and_subspace ();
1536 /* Convert everything up to the first whitespace character into lower
1538 for (s
= str
; *s
!= ' ' && *s
!= '\t' && *s
!= '\n' && *s
!= '\0'; s
++)
1542 /* Skip to something interesting. */
1543 for (s
= str
; isupper (*s
) || islower (*s
) || (*s
>= '0' && *s
<= '3'); ++s
)
1562 as_fatal (_("Unknown opcode: `%s'"), str
);
1567 /* Look up the opcode in the has table. */
1568 if ((insn
= (struct pa_opcode
*) hash_find (op_hash
, str
)) == NULL
)
1570 as_bad ("Unknown opcode: `%s'", str
);
1579 /* Mark the location where arguments for the instruction start, then
1580 start processing them. */
1584 /* Do some initialization. */
1585 opcode
= insn
->match
;
1586 strict
= (insn
->flags
& FLAG_STRICT
);
1587 memset (&the_insn
, 0, sizeof (the_insn
));
1589 the_insn
.reloc
= R_HPPA_NONE
;
1591 /* If this instruction is specific to a particular architecture,
1592 then set a new architecture. */
1593 /* But do not automatically promote to pa2.0. The automatic promotion
1594 crud is for compatability with HP's old assemblers only. */
1596 && bfd_get_mach (stdoutput
) < insn
->arch
)
1598 if (!bfd_set_arch_mach (stdoutput
, bfd_arch_hppa
, insn
->arch
))
1599 as_warn (_("could not update architecture and machine"));
1601 else if (bfd_get_mach (stdoutput
) < insn
->arch
)
1607 /* Build the opcode, checking as we go to make
1608 sure that the operands match. */
1609 for (args
= insn
->args
;; ++args
)
1611 /* Absorb white space in instruction. */
1612 while (*s
== ' ' || *s
== '\t')
1618 /* End of arguments. */
1634 /* These must match exactly. */
1643 /* Handle a 5 bit register or control register field at 10. */
1646 if (!pa_parse_number (&s
, 0))
1649 CHECK_FIELD (num
, 31, 0, 0);
1650 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 21);
1652 /* Handle %sar or %cr11. No bits get set, we just verify that it
1655 /* Skip whitespace before register. */
1656 while (*s
== ' ' || *s
== '\t')
1659 if (!strncasecmp(s
, "%sar", 4))
1664 else if (!strncasecmp(s
, "%cr11", 5))
1671 /* Handle a 5 bit register field at 15. */
1673 if (!pa_parse_number (&s
, 0))
1676 CHECK_FIELD (num
, 31, 0, 0);
1677 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 16);
1679 /* Handle a 5 bit register field at 31. */
1681 if (!pa_parse_number (&s
, 0))
1684 CHECK_FIELD (num
, 31, 0, 0);
1685 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
1687 /* Handle a 5 bit register field at 10 and 15. */
1689 if (!pa_parse_number (&s
, 0))
1692 CHECK_FIELD (num
, 31, 0, 0);
1693 opcode
|= num
<< 16;
1694 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 21);
1696 /* Handle a 5 bit field length at 31. */
1698 num
= pa_get_absolute_expression (&the_insn
, &s
);
1699 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
1702 CHECK_FIELD (num
, 32, 1, 0);
1703 INSERT_FIELD_AND_CONTINUE (opcode
, 32 - num
, 0);
1705 /* Handle a 5 bit immediate at 15. */
1707 num
= pa_get_absolute_expression (&the_insn
, &s
);
1708 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
1711 /* When in strict mode, we want to just reject this
1712 match instead of giving an out of range error. */
1713 CHECK_FIELD (num
, 15, -16, strict
);
1714 num
= low_sign_unext (num
, 5);
1715 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 16);
1717 /* Handle a 5 bit immediate at 31. */
1719 num
= pa_get_absolute_expression (&the_insn
, &s
);
1720 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
1723 /* When in strict mode, we want to just reject this
1724 match instead of giving an out of range error. */
1725 CHECK_FIELD (num
, 15, -16, strict
);
1726 num
= low_sign_unext (num
, 5);
1727 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
1729 /* Handle an unsigned 5 bit immediate at 31. */
1731 num
= pa_get_absolute_expression (&the_insn
, &s
);
1732 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
1735 CHECK_FIELD (num
, 31, 0, strict
);
1736 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
1738 /* Handle an unsigned 5 bit immediate at 15. */
1740 num
= pa_get_absolute_expression (&the_insn
, &s
);
1741 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
1744 CHECK_FIELD (num
, 31, 0, strict
);
1745 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 16);
1747 /* Handle an unsigned 10 bit immediate at 15. */
1749 num
= pa_get_absolute_expression (&the_insn
, &s
);
1750 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
1753 CHECK_FIELD (num
, 1023, 0, strict
);
1754 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 16);
1756 /* Handle a 2 bit space identifier at 17. */
1758 if (!pa_parse_number (&s
, 0))
1761 CHECK_FIELD (num
, 3, 0, 1);
1762 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 14);
1764 /* Handle a 3 bit space identifier at 18. */
1766 if (!pa_parse_number (&s
, 0))
1769 CHECK_FIELD (num
, 7, 0, 1);
1770 opcode
|= re_assemble_3 (num
);
1773 /* Handle all completers. */
1778 /* Handle a completer for an indexing load or store. */
1784 while (*s
== ',' && i
< 2)
1787 if (strncasecmp (s
, "sm", 2) == 0)
1794 else if (strncasecmp (s
, "m", 1) == 0)
1796 else if ((strncasecmp (s
, "s ", 2) == 0)
1797 || (strncasecmp (s
, "s,", 2) == 0))
1799 /* When in strict mode this is a match failure. */
1806 as_bad (_("Invalid Indexed Load Completer."));
1811 as_bad (_("Invalid Indexed Load Completer Syntax."));
1813 INSERT_FIELD_AND_CONTINUE (opcode
, uu
, 13);
1816 /* Handle a short load/store completer. */
1828 if (strncasecmp (s
, "ma", 2) == 0)
1834 else if (strncasecmp (s
, "mb", 2) == 0)
1841 /* When in strict mode, pass through for cache op. */
1842 if (!found
&& strict
)
1847 as_bad (_("Invalid Short Load/Store Completer."));
1851 /* If we did not get a ma/mb completer, then we do not
1852 consider this a positive match for 'ce'. */
1853 else if (*args
== 'e')
1856 /* 'J', 'm' and 'q' are the same, except for where they
1857 encode the before/after field. */
1861 INSERT_FIELD_AND_CONTINUE (opcode
, a
, 13);
1863 else if (*args
== 'q')
1866 INSERT_FIELD_AND_CONTINUE (opcode
, a
, 2);
1868 else if (*args
== 'J')
1870 /* M bit is explicit in the major opcode. */
1871 INSERT_FIELD_AND_CONTINUE (opcode
, a
, 2);
1873 else if (*args
== 'e')
1875 /* Gross! Hide these values in the immediate field
1876 of the instruction, then pull them out later. */
1883 /* Handle a stbys completer. */
1889 while (*s
== ',' && i
< 2)
1892 if (strncasecmp (s
, "m", 1) == 0)
1894 else if ((strncasecmp (s
, "b ", 2) == 0)
1895 || (strncasecmp (s
, "b,", 2) == 0))
1897 else if (strncasecmp (s
, "e", 1) == 0)
1899 /* When in strict mode this is a match failure. */
1906 as_bad (_("Invalid Store Bytes Short Completer"));
1911 as_bad (_("Invalid Store Bytes Short Completer"));
1913 INSERT_FIELD_AND_CONTINUE (opcode
, a
, 13);
1916 /* Handle load cache hint completer. */
1919 if (!strncmp(s
, ",sl", 3))
1924 INSERT_FIELD_AND_CONTINUE (opcode
, cmpltr
, 10);
1926 /* Handle store cache hint completer. */
1929 if (!strncmp(s
, ",sl", 3))
1934 else if (!strncmp(s
, ",bc", 3))
1939 INSERT_FIELD_AND_CONTINUE (opcode
, cmpltr
, 10);
1941 /* Handle load and clear cache hint completer. */
1944 if (!strncmp(s
, ",co", 3))
1949 INSERT_FIELD_AND_CONTINUE (opcode
, cmpltr
, 10);
1951 /* Handle load ordering completer. */
1953 if (strncmp(s
, ",o", 2) != 0)
1958 /* Handle a branch gate completer. */
1960 if (strncasecmp (s
, ",gate", 5) != 0)
1965 /* Handle a branch link and push completer. */
1967 if (strncasecmp (s
, ",l,push", 7) != 0)
1972 /* Handle a branch link completer. */
1974 if (strncasecmp (s
, ",l", 2) != 0)
1979 /* Handle a branch pop completer. */
1981 if (strncasecmp (s
, ",pop", 4) != 0)
1986 /* Handle a local processor completer. */
1988 if (strncasecmp (s
, ",l", 2) != 0)
1993 /* Handle a PROBE read/write completer. */
1996 if (!strncasecmp (s
, ",w", 2))
2001 else if (!strncasecmp (s
, ",r", 2))
2007 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 6);
2009 /* Handle MFCTL wide completer. */
2011 if (strncasecmp (s
, ",w", 2) != 0)
2016 /* Handle an RFI restore completer. */
2019 if (!strncasecmp (s
, ",r", 2))
2025 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 5);
2027 /* Handle a system control completer. */
2029 if (*s
== ',' && (*(s
+ 1) == 'm' || *(s
+ 1) == 'M'))
2037 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 5);
2039 /* Handle intermediate/final completer for DCOR. */
2042 if (!strncasecmp (s
, ",i", 2))
2048 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 6);
2050 /* Handle zero/sign extension completer. */
2053 if (!strncasecmp (s
, ",z", 2))
2059 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 10);
2061 /* Handle add completer. */
2064 if (!strncasecmp (s
, ",l", 2))
2069 else if (!strncasecmp (s
, ",tsv", 4))
2075 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 10);
2077 /* Handle 64 bit carry for ADD. */
2080 if (!strncasecmp (s
, ",dc,tsv", 7) ||
2081 !strncasecmp (s
, ",tsv,dc", 7))
2086 else if (!strncasecmp (s
, ",dc", 3))
2094 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 11);
2096 /* Handle 32 bit carry for ADD. */
2099 if (!strncasecmp (s
, ",c,tsv", 6) ||
2100 !strncasecmp (s
, ",tsv,c", 6))
2105 else if (!strncasecmp (s
, ",c", 2))
2113 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 11);
2115 /* Handle trap on signed overflow. */
2118 if (!strncasecmp (s
, ",tsv", 4))
2124 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 11);
2126 /* Handle trap on condition and overflow. */
2129 if (!strncasecmp (s
, ",tc,tsv", 7) ||
2130 !strncasecmp (s
, ",tsv,tc", 7))
2135 else if (!strncasecmp (s
, ",tc", 3))
2143 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 11);
2145 /* Handle 64 bit borrow for SUB. */
2148 if (!strncasecmp (s
, ",db,tsv", 7) ||
2149 !strncasecmp (s
, ",tsv,db", 7))
2154 else if (!strncasecmp (s
, ",db", 3))
2162 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 11);
2164 /* Handle 32 bit borrow for SUB. */
2167 if (!strncasecmp (s
, ",b,tsv", 6) ||
2168 !strncasecmp (s
, ",tsv,b", 6))
2173 else if (!strncasecmp (s
, ",b", 2))
2181 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 11);
2183 /* Handle trap condition completer for UADDCM. */
2186 if (!strncasecmp (s
, ",tc", 3))
2192 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 6);
2194 /* Handle signed/unsigned at 21. */
2198 if (strncasecmp (s
, ",s", 2) == 0)
2203 else if (strncasecmp (s
, ",u", 2) == 0)
2209 INSERT_FIELD_AND_CONTINUE (opcode
, sign
, 10);
2212 /* Handle left/right combination at 17:18. */
2222 as_bad(_("Invalid left/right combination completer"));
2225 INSERT_FIELD_AND_CONTINUE (opcode
, lr
, 13);
2228 as_bad(_("Invalid left/right combination completer"));
2231 /* Handle saturation at 24:25. */
2235 if (strncasecmp (s
, ",ss", 3) == 0)
2240 else if (strncasecmp (s
, ",us", 3) == 0)
2246 INSERT_FIELD_AND_CONTINUE (opcode
, sat
, 6);
2249 /* Handle permutation completer. */
2277 as_bad(_("Invalid permutation completer"));
2279 opcode
|= perm
<< permloc
[i
];
2284 as_bad(_("Invalid permutation completer"));
2292 /* Handle all conditions. */
2298 /* Handle FP compare conditions. */
2300 cond
= pa_parse_fp_cmp_cond (&s
);
2301 INSERT_FIELD_AND_CONTINUE (opcode
, cond
, 0);
2303 /* Handle an add condition. */
2312 /* 64 bit conditions. */
2325 while (*s
!= ',' && *s
!= ' ' && *s
!= '\t')
2329 if (strcmp (name
, "=") == 0)
2331 else if (strcmp (name
, "<") == 0)
2333 else if (strcmp (name
, "<=") == 0)
2335 else if (strcasecmp (name
, "nuv") == 0)
2337 else if (strcasecmp (name
, "znv") == 0)
2339 else if (strcasecmp (name
, "sv") == 0)
2341 else if (strcasecmp (name
, "od") == 0)
2343 else if (strcasecmp (name
, "tr") == 0)
2348 else if (strcmp (name
, "<>") == 0)
2353 else if (strcmp (name
, ">=") == 0)
2358 else if (strcmp (name
, ">") == 0)
2363 else if (strcasecmp (name
, "uv") == 0)
2368 else if (strcasecmp (name
, "vnz") == 0)
2373 else if (strcasecmp (name
, "nsv") == 0)
2378 else if (strcasecmp (name
, "ev") == 0)
2383 /* ",*" is a valid condition. */
2384 else if (*args
== 'a')
2385 as_bad (_("Invalid Add Condition: %s"), name
);
2388 opcode
|= cmpltr
<< 13;
2389 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 12);
2391 /* Handle non-negated add and branch condition. */
2393 cmpltr
= pa_parse_nonneg_add_cmpltr (&s
, 1);
2396 as_bad (_("Invalid Add and Branch Condition: %c"), *s
);
2399 INSERT_FIELD_AND_CONTINUE (opcode
, cmpltr
, 13);
2401 /* Handle 64 bit wide-mode add and branch condition. */
2403 cmpltr
= pa_parse_addb_64_cmpltr (&s
);
2406 as_bad (_("Invalid Add and Branch Condition: %c"), *s
);
2411 /* Negated condition requires an opcode change. */
2412 opcode
|= (cmpltr
& 8) << 24;
2414 INSERT_FIELD_AND_CONTINUE (opcode
, cmpltr
& 7, 13);
2416 /* Handle a negated or non-negated add and branch
2420 cmpltr
= pa_parse_nonneg_add_cmpltr (&s
, 1);
2424 cmpltr
= pa_parse_neg_add_cmpltr (&s
, 1);
2427 as_bad (_("Invalid Compare/Subtract Condition"));
2432 /* Negated condition requires an opcode change. */
2436 INSERT_FIELD_AND_CONTINUE (opcode
, cmpltr
, 13);
2438 /* Handle branch on bit conditions. */
2456 if (strncmp (s
, "<", 1) == 0)
2461 else if (strncmp (s
, ">=", 2) == 0)
2467 as_bad (_("Invalid Bit Branch Condition: %c"), *s
);
2469 INSERT_FIELD_AND_CONTINUE (opcode
, cmpltr
, 15);
2471 /* Handle a compare/subtract condition. */
2480 /* 64 bit conditions. */
2493 while (*s
!= ',' && *s
!= ' ' && *s
!= '\t')
2497 if (strcmp (name
, "=") == 0)
2499 else if (strcmp (name
, "<") == 0)
2501 else if (strcmp (name
, "<=") == 0)
2503 else if (strcasecmp (name
, "<<") == 0)
2505 else if (strcasecmp (name
, "<<=") == 0)
2507 else if (strcasecmp (name
, "sv") == 0)
2509 else if (strcasecmp (name
, "od") == 0)
2511 else if (strcasecmp (name
, "tr") == 0)
2516 else if (strcmp (name
, "<>") == 0)
2521 else if (strcmp (name
, ">=") == 0)
2526 else if (strcmp (name
, ">") == 0)
2531 else if (strcasecmp (name
, ">>=") == 0)
2536 else if (strcasecmp (name
, ">>") == 0)
2541 else if (strcasecmp (name
, "nsv") == 0)
2546 else if (strcasecmp (name
, "ev") == 0)
2551 /* ",*" is a valid condition. */
2552 else if (*args
!= 'S')
2553 as_bad (_("Invalid Compare/Subtract Condition: %s"),
2557 opcode
|= cmpltr
<< 13;
2558 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 12);
2560 /* Handle a non-negated compare condition. */
2562 cmpltr
= pa_parse_nonneg_cmpsub_cmpltr (&s
, 1);
2565 as_bad (_("Invalid Compare/Subtract Condition: %c"), *s
);
2568 INSERT_FIELD_AND_CONTINUE (opcode
, cmpltr
, 13);
2570 /* Handle a 32 bit compare and branch condition. */
2573 cmpltr
= pa_parse_nonneg_cmpsub_cmpltr (&s
, 1);
2577 cmpltr
= pa_parse_neg_cmpsub_cmpltr (&s
, 1);
2580 as_bad (_("Invalid Compare and Branch Condition."));
2585 /* Negated condition requires an opcode change. */
2590 INSERT_FIELD_AND_CONTINUE (opcode
, cmpltr
, 13);
2592 /* Handle a 64 bit compare and branch condition. */
2594 cmpltr
= pa_parse_cmpb_64_cmpltr (&s
);
2597 /* Negated condition requires an opcode change. */
2598 opcode
|= (cmpltr
& 8) << 26;
2601 /* Not a 64 bit cond. Give 32 bit a chance. */
2604 INSERT_FIELD_AND_CONTINUE (opcode
, cmpltr
& 7, 13);
2606 /* Handle a 64 bit cmpib condition. */
2608 cmpltr
= pa_parse_cmpib_64_cmpltr (&s
);
2610 /* Not a 64 bit cond. Give 32 bit a chance. */
2613 INSERT_FIELD_AND_CONTINUE (opcode
, cmpltr
, 13);
2615 /* Handle a logical instruction condition. */
2624 /* 64 bit conditions. */
2636 while (*s
!= ',' && *s
!= ' ' && *s
!= '\t')
2641 if (strcmp (name
, "=") == 0)
2643 else if (strcmp (name
, "<") == 0)
2645 else if (strcmp (name
, "<=") == 0)
2647 else if (strcasecmp (name
, "od") == 0)
2649 else if (strcasecmp (name
, "tr") == 0)
2654 else if (strcmp (name
, "<>") == 0)
2659 else if (strcmp (name
, ">=") == 0)
2664 else if (strcmp (name
, ">") == 0)
2669 else if (strcasecmp (name
, "ev") == 0)
2674 /* ",*" is a valid condition. */
2675 else if (*args
!= 'L')
2676 as_bad (_("Invalid Logical Instruction Condition."));
2679 opcode
|= cmpltr
<< 13;
2680 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 12);
2682 /* Handle a shift/extract/deposit condition. */
2691 /* 64 bit conditions. */
2703 while (*s
!= ',' && *s
!= ' ' && *s
!= '\t')
2707 if (strcmp (name
, "=") == 0)
2709 else if (strcmp (name
, "<") == 0)
2711 else if (strcasecmp (name
, "od") == 0)
2713 else if (strcasecmp (name
, "tr") == 0)
2715 else if (strcmp (name
, "<>") == 0)
2717 else if (strcmp (name
, ">=") == 0)
2719 else if (strcasecmp (name
, "ev") == 0)
2721 /* Handle movb,n. Put things back the way they were.
2722 This includes moving s back to where it started. */
2723 else if (strcasecmp (name
, "n") == 0 && *args
== 'y')
2729 /* ",*" is a valid condition. */
2730 else if (*args
!= 'X')
2731 as_bad (_("Invalid Shift/Extract/Deposit Condition."));
2734 INSERT_FIELD_AND_CONTINUE (opcode
, cmpltr
, 13);
2736 /* Handle a unit instruction condition. */
2745 /* 64 bit conditions. */
2756 if (strncasecmp (s
, "sbz", 3) == 0)
2761 else if (strncasecmp (s
, "shz", 3) == 0)
2766 else if (strncasecmp (s
, "sdc", 3) == 0)
2771 else if (strncasecmp (s
, "sbc", 3) == 0)
2776 else if (strncasecmp (s
, "shc", 3) == 0)
2781 else if (strncasecmp (s
, "tr", 2) == 0)
2787 else if (strncasecmp (s
, "nbz", 3) == 0)
2793 else if (strncasecmp (s
, "nhz", 3) == 0)
2799 else if (strncasecmp (s
, "ndc", 3) == 0)
2805 else if (strncasecmp (s
, "nbc", 3) == 0)
2811 else if (strncasecmp (s
, "nhc", 3) == 0)
2817 else if (strncasecmp (s
, "swz", 3) == 0)
2823 else if (strncasecmp (s
, "swc", 3) == 0)
2829 else if (strncasecmp (s
, "nwz", 3) == 0)
2835 else if (strncasecmp (s
, "nwc", 3) == 0)
2841 /* ",*" is a valid condition. */
2842 else if (*args
!= 'U')
2843 as_bad (_("Invalid Unit Instruction Condition."));
2845 opcode
|= cmpltr
<< 13;
2846 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 12);
2854 /* Handle a nullification completer for branch instructions. */
2856 nullif
= pa_parse_nullif (&s
);
2857 INSERT_FIELD_AND_CONTINUE (opcode
, nullif
, 1);
2859 /* Handle a nullification completer for copr and spop insns. */
2861 nullif
= pa_parse_nullif (&s
);
2862 INSERT_FIELD_AND_CONTINUE (opcode
, nullif
, 5);
2864 /* Handle ,%r2 completer for new syntax branches. */
2866 if (*s
== ',' && strncasecmp (s
+ 1, "%r2", 3) == 0)
2868 else if (*s
== ',' && strncasecmp (s
+ 1, "%rp", 3) == 0)
2874 /* Handle 3 bit entry into the fp compare array. Valid values
2875 are 0..6 inclusive. */
2879 if (the_insn
.exp
.X_op
== O_constant
)
2881 num
= evaluate_absolute (&the_insn
);
2882 CHECK_FIELD (num
, 6, 0, 0);
2884 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 13);
2889 /* Handle 3 bit entry into the fp compare array. Valid values
2890 are 0..6 inclusive. */
2893 if (the_insn
.exp
.X_op
== O_constant
)
2896 num
= evaluate_absolute (&the_insn
);
2897 CHECK_FIELD (num
, 6, 0, 0);
2898 num
= (num
+ 1) ^ 1;
2899 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 13);
2904 /* Handle graphics test completers for ftest */
2907 num
= pa_parse_ftest_gfx_completer (&s
);
2908 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
2911 /* Handle a 11 bit immediate at 31. */
2913 the_insn
.field_selector
= pa_chk_field_selector (&s
);
2916 if (the_insn
.exp
.X_op
== O_constant
)
2918 num
= evaluate_absolute (&the_insn
);
2919 CHECK_FIELD (num
, 1023, -1024, 0);
2920 num
= low_sign_unext (num
, 11);
2921 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
2925 if (is_DP_relative (the_insn
.exp
))
2926 the_insn
.reloc
= R_HPPA_GOTOFF
;
2927 else if (is_PC_relative (the_insn
.exp
))
2928 the_insn
.reloc
= R_HPPA_PCREL_CALL
;
2930 the_insn
.reloc
= R_HPPA
;
2931 the_insn
.format
= 11;
2935 /* Handle a 14 bit immediate at 31. */
2937 the_insn
.field_selector
= pa_chk_field_selector (&s
);
2940 if (the_insn
.exp
.X_op
== O_constant
)
2944 /* XXX the completer stored away tibits of information
2945 for us to extract. We need a cleaner way to do this.
2946 Now that we have lots of letters again, it would be
2947 good to rethink this. */
2948 m
= (opcode
& (1 << 8)) != 0;
2949 a
= (opcode
& (1 << 9)) != 0;
2950 opcode
&= ~ (3 << 8);
2951 num
= evaluate_absolute (&the_insn
);
2952 if ((a
== 1 && num
>= 0) || (a
== 0 && num
< 0))
2954 CHECK_FIELD (num
, 8191, -8192, 0);
2955 num
= low_sign_unext (num
, 14);
2956 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
2963 /* Handle a 14 bit immediate at 31. */
2965 the_insn
.field_selector
= pa_chk_field_selector (&s
);
2968 if (the_insn
.exp
.X_op
== O_constant
)
2972 /* XXX the completer stored away tibits of information
2973 for us to extract. We need a cleaner way to do this.
2974 Now that we have lots of letters again, it would be
2975 good to rethink this. */
2976 m
= (opcode
& (1 << 8)) != 0;
2977 a
= (opcode
& (1 << 9)) != 0;
2978 opcode
&= ~ (3 << 8);
2979 num
= evaluate_absolute (&the_insn
);
2980 if ((a
== 1 && num
< 0) || (a
== 0 && num
> 0))
2984 CHECK_FIELD (num
, 8191, -8192, 0);
2989 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 3);
2996 /* Handle 14 bit immediate, shifted left three times. */
2998 the_insn
.field_selector
= pa_chk_field_selector (&s
);
3001 if (the_insn
.exp
.X_op
== O_constant
)
3003 num
= evaluate_absolute (&the_insn
);
3006 CHECK_FIELD (num
, 8191, -8192, 0);
3011 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 4);
3015 if (is_DP_relative (the_insn
.exp
))
3016 the_insn
.reloc
= R_HPPA_GOTOFF
;
3017 else if (is_PC_relative (the_insn
.exp
))
3018 the_insn
.reloc
= R_HPPA_PCREL_CALL
;
3020 the_insn
.reloc
= R_HPPA
;
3021 the_insn
.format
= 14;
3026 /* Handle 14 bit immediate, shifted left twice. */
3028 the_insn
.field_selector
= pa_chk_field_selector (&s
);
3031 if (the_insn
.exp
.X_op
== O_constant
)
3033 num
= evaluate_absolute (&the_insn
);
3036 CHECK_FIELD (num
, 8191, -8192, 0);
3041 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 3);
3045 if (is_DP_relative (the_insn
.exp
))
3046 the_insn
.reloc
= R_HPPA_GOTOFF
;
3047 else if (is_PC_relative (the_insn
.exp
))
3048 the_insn
.reloc
= R_HPPA_PCREL_CALL
;
3050 the_insn
.reloc
= R_HPPA
;
3051 the_insn
.format
= 14;
3055 /* Handle a 14 bit immediate at 31. */
3057 the_insn
.field_selector
= pa_chk_field_selector (&s
);
3060 if (the_insn
.exp
.X_op
== O_constant
)
3062 num
= evaluate_absolute (&the_insn
);
3063 CHECK_FIELD (num
, 8191, -8192, 0);
3064 num
= low_sign_unext (num
, 14);
3065 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
3069 if (is_DP_relative (the_insn
.exp
))
3070 the_insn
.reloc
= R_HPPA_GOTOFF
;
3071 else if (is_PC_relative (the_insn
.exp
))
3072 the_insn
.reloc
= R_HPPA_PCREL_CALL
;
3074 the_insn
.reloc
= R_HPPA
;
3075 the_insn
.format
= 14;
3079 /* Handle a 21 bit immediate at 31. */
3081 the_insn
.field_selector
= pa_chk_field_selector (&s
);
3084 if (the_insn
.exp
.X_op
== O_constant
)
3086 num
= evaluate_absolute (&the_insn
);
3087 CHECK_FIELD (num
>> 11, 1048575, -1048576, 0);
3088 opcode
|= re_assemble_21 (num
);
3093 if (is_DP_relative (the_insn
.exp
))
3094 the_insn
.reloc
= R_HPPA_GOTOFF
;
3095 else if (is_PC_relative (the_insn
.exp
))
3096 the_insn
.reloc
= R_HPPA_PCREL_CALL
;
3098 the_insn
.reloc
= R_HPPA
;
3099 the_insn
.format
= 21;
3103 /* Handle a 16 bit immediate at 31 (PA 2.0 wide mode only). */
3105 the_insn
.field_selector
= pa_chk_field_selector (&s
);
3108 if (the_insn
.exp
.X_op
== O_constant
)
3110 num
= evaluate_absolute (&the_insn
);
3111 CHECK_FIELD (num
, 32767, -32768, 0);
3112 opcode
|= re_assemble_16 (num
);
3117 /* ??? Is this valid for wide mode? */
3118 if (is_DP_relative (the_insn
.exp
))
3119 the_insn
.reloc
= R_HPPA_GOTOFF
;
3120 else if (is_PC_relative (the_insn
.exp
))
3121 the_insn
.reloc
= R_HPPA_PCREL_CALL
;
3123 the_insn
.reloc
= R_HPPA
;
3124 the_insn
.format
= 14;
3128 /* Handle a word-aligned 16-bit imm. at 31 (PA2.0 wide). */
3130 the_insn
.field_selector
= pa_chk_field_selector (&s
);
3133 if (the_insn
.exp
.X_op
== O_constant
)
3135 num
= evaluate_absolute (&the_insn
);
3136 CHECK_FIELD (num
, 32767, -32768, 0);
3137 CHECK_ALIGN (num
, 4, 0);
3138 opcode
|= re_assemble_16 (num
);
3143 /* ??? Is this valid for wide mode? */
3144 if (is_DP_relative (the_insn
.exp
))
3145 the_insn
.reloc
= R_HPPA_GOTOFF
;
3146 else if (is_PC_relative (the_insn
.exp
))
3147 the_insn
.reloc
= R_HPPA_PCREL_CALL
;
3149 the_insn
.reloc
= R_HPPA
;
3150 the_insn
.format
= 14;
3154 /* Handle a dword-aligned 16-bit imm. at 31 (PA2.0 wide). */
3156 the_insn
.field_selector
= pa_chk_field_selector (&s
);
3159 if (the_insn
.exp
.X_op
== O_constant
)
3161 num
= evaluate_absolute (&the_insn
);
3162 CHECK_FIELD (num
, 32767, -32768, 0);
3163 CHECK_ALIGN (num
, 8, 0);
3164 opcode
|= re_assemble_16 (num
);
3169 /* ??? Is this valid for wide mode? */
3170 if (is_DP_relative (the_insn
.exp
))
3171 the_insn
.reloc
= R_HPPA_GOTOFF
;
3172 else if (is_PC_relative (the_insn
.exp
))
3173 the_insn
.reloc
= R_HPPA_PCREL_CALL
;
3175 the_insn
.reloc
= R_HPPA
;
3176 the_insn
.format
= 14;
3180 /* Handle a 12 bit branch displacement. */
3182 the_insn
.field_selector
= pa_chk_field_selector (&s
);
3186 if (!strcmp (S_GET_NAME (the_insn
.exp
.X_add_symbol
), "L$0\001"))
3188 num
= evaluate_absolute (&the_insn
);
3191 as_bad (_("Branch to unaligned address"));
3194 CHECK_FIELD (num
, 8199, -8184, 0);
3196 opcode
|= re_assemble_12 ((num
- 8) >> 2);
3201 the_insn
.reloc
= R_HPPA_PCREL_CALL
;
3202 the_insn
.format
= 12;
3203 the_insn
.arg_reloc
= last_call_desc
.arg_reloc
;
3204 memset (&last_call_desc
, 0, sizeof (struct call_desc
));
3209 /* Handle a 17 bit branch displacement. */
3211 the_insn
.field_selector
= pa_chk_field_selector (&s
);
3215 if (!the_insn
.exp
.X_add_symbol
3216 || !strcmp (S_GET_NAME (the_insn
.exp
.X_add_symbol
),
3219 num
= evaluate_absolute (&the_insn
);
3222 as_bad (_("Branch to unaligned address"));
3225 CHECK_FIELD (num
, 262143, -262144, 0);
3227 if (the_insn
.exp
.X_add_symbol
)
3230 opcode
|= re_assemble_17 (num
>> 2);
3235 the_insn
.reloc
= R_HPPA_PCREL_CALL
;
3236 the_insn
.format
= 17;
3237 the_insn
.arg_reloc
= last_call_desc
.arg_reloc
;
3238 memset (&last_call_desc
, 0, sizeof (struct call_desc
));
3242 /* Handle a 22 bit branch displacement. */
3244 the_insn
.field_selector
= pa_chk_field_selector (&s
);
3248 if (!the_insn
.exp
.X_add_symbol
3249 || !strcmp (S_GET_NAME (the_insn
.exp
.X_add_symbol
),
3252 num
= evaluate_absolute (&the_insn
);
3255 as_bad (_("Branch to unaligned address"));
3258 CHECK_FIELD (num
, 8388607, -8388608, 0);
3260 if (the_insn
.exp
.X_add_symbol
)
3263 opcode
|= re_assemble_22 (num
>> 2);
3267 the_insn
.reloc
= R_HPPA_PCREL_CALL
;
3268 the_insn
.format
= 22;
3269 the_insn
.arg_reloc
= last_call_desc
.arg_reloc
;
3270 memset (&last_call_desc
, 0, sizeof (struct call_desc
));
3274 /* Handle an absolute 17 bit branch target. */
3276 the_insn
.field_selector
= pa_chk_field_selector (&s
);
3280 if (!the_insn
.exp
.X_add_symbol
3281 || !strcmp (S_GET_NAME (the_insn
.exp
.X_add_symbol
),
3284 num
= evaluate_absolute (&the_insn
);
3287 as_bad (_("Branch to unaligned address"));
3290 CHECK_FIELD (num
, 262143, -262144, 0);
3292 if (the_insn
.exp
.X_add_symbol
)
3295 opcode
|= re_assemble_17 (num
>> 2);
3300 the_insn
.reloc
= R_HPPA_ABS_CALL
;
3301 the_insn
.format
= 17;
3302 the_insn
.arg_reloc
= last_call_desc
.arg_reloc
;
3303 memset (&last_call_desc
, 0, sizeof (struct call_desc
));
3307 /* Handle '%r1' implicit operand of addil instruction. */
3309 if (*s
== ',' && *(s
+ 1) == '%' && *(s
+ 3) == '1'
3310 && (*(s
+ 2) == 'r' || *(s
+ 2) == 'R'))
3318 /* Handle '%sr0,%r31' implicit operand of be,l instruction. */
3320 if (strncasecmp (s
, "%sr0,%r31", 9) != 0)
3325 /* Handle immediate value of 0 for ordered load/store instructions. */
3332 /* Handle a 2 bit shift count at 25. */
3334 num
= pa_get_absolute_expression (&the_insn
, &s
);
3335 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3338 CHECK_FIELD (num
, 3, 1, strict
);
3339 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 6);
3341 /* Handle a 4 bit shift count at 25. */
3343 num
= pa_get_absolute_expression (&the_insn
, &s
);
3344 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3347 CHECK_FIELD (num
, 15, 0, strict
);
3348 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 6);
3350 /* Handle a 5 bit shift count at 26. */
3352 num
= pa_get_absolute_expression (&the_insn
, &s
);
3353 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3356 CHECK_FIELD (num
, 31, 0, strict
);
3357 INSERT_FIELD_AND_CONTINUE (opcode
, 31 - num
, 5);
3359 /* Handle a 6 bit shift count at 20,22:26. */
3361 num
= pa_get_absolute_expression (&the_insn
, &s
);
3362 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3365 CHECK_FIELD (num
, 63, 0, strict
);
3367 opcode
|= (num
& 0x20) << 6;
3368 INSERT_FIELD_AND_CONTINUE (opcode
, num
& 0x1f, 5);
3370 /* Handle a 6 bit field length at 23,27:31. */
3373 num
= pa_get_absolute_expression (&the_insn
, &s
);
3374 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3377 CHECK_FIELD (num
, 64, 1, strict
);
3379 opcode
|= (num
& 0x20) << 3;
3380 num
= 31 - (num
& 0x1f);
3381 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
3383 /* Handle a 6 bit field length at 19,27:31. */
3385 num
= pa_get_absolute_expression (&the_insn
, &s
);
3386 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3389 CHECK_FIELD (num
, 64, 1, strict
);
3391 opcode
|= (num
& 0x20) << 7;
3392 num
= 31 - (num
& 0x1f);
3393 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
3395 /* Handle a 5 bit bit position at 26. */
3397 num
= pa_get_absolute_expression (&the_insn
, &s
);
3398 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3401 CHECK_FIELD (num
, 31, 0, strict
);
3402 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 5);
3404 /* Handle a 6 bit bit position at 20,22:26. */
3406 num
= pa_get_absolute_expression (&the_insn
, &s
);
3407 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3410 CHECK_FIELD (num
, 63, 0, strict
);
3411 opcode
|= (num
& 0x20) << 6;
3412 INSERT_FIELD_AND_CONTINUE (opcode
, num
& 0x1f, 5);
3414 /* Handle a 5 bit immediate at 10 with 'd' as the complement
3415 of the high bit of the immediate. */
3417 num
= pa_get_absolute_expression (&the_insn
, &s
);
3418 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3421 CHECK_FIELD (num
, 63, 0, strict
);
3425 opcode
|= (1 << 13);
3426 INSERT_FIELD_AND_CONTINUE (opcode
, num
& 0x1f, 21);
3428 /* Handle a 5 bit immediate at 10. */
3430 num
= pa_get_absolute_expression (&the_insn
, &s
);
3431 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3434 CHECK_FIELD (num
, 31, 0, strict
);
3435 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 21);
3437 /* Handle a 9 bit immediate at 28. */
3439 num
= pa_get_absolute_expression (&the_insn
, &s
);
3440 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3443 CHECK_FIELD (num
, 511, 1, strict
);
3444 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 3);
3446 /* Handle a 13 bit immediate at 18. */
3448 num
= pa_get_absolute_expression (&the_insn
, &s
);
3449 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3452 CHECK_FIELD (num
, 8191, 0, strict
);
3453 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 13);
3455 /* Handle a 26 bit immediate at 31. */
3457 num
= pa_get_absolute_expression (&the_insn
, &s
);
3458 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3461 CHECK_FIELD (num
, 671108864, 0, strict
);
3462 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
3464 /* Handle a 3 bit SFU identifier at 25. */
3467 as_bad (_("Invalid SFU identifier"));
3468 num
= pa_get_absolute_expression (&the_insn
, &s
);
3469 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3472 CHECK_FIELD (num
, 7, 0, strict
);
3473 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 6);
3475 /* Handle a 20 bit SOP field for spop0. */
3477 num
= pa_get_absolute_expression (&the_insn
, &s
);
3478 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3481 CHECK_FIELD (num
, 1048575, 0, strict
);
3482 num
= (num
& 0x1f) | ((num
& 0x000fffe0) << 6);
3483 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
3485 /* Handle a 15bit SOP field for spop1. */
3487 num
= pa_get_absolute_expression (&the_insn
, &s
);
3488 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3491 CHECK_FIELD (num
, 32767, 0, strict
);
3492 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 11);
3494 /* Handle a 10bit SOP field for spop3. */
3496 num
= pa_get_absolute_expression (&the_insn
, &s
);
3497 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3500 CHECK_FIELD (num
, 1023, 0, strict
);
3501 num
= (num
& 0x1f) | ((num
& 0x000003e0) << 6);
3502 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
3504 /* Handle a 15 bit SOP field for spop2. */
3506 num
= pa_get_absolute_expression (&the_insn
, &s
);
3507 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3510 CHECK_FIELD (num
, 32767, 0, strict
);
3511 num
= (num
& 0x1f) | ((num
& 0x00007fe0) << 6);
3512 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
3514 /* Handle a 3-bit co-processor ID field. */
3517 as_bad (_("Invalid COPR identifier"));
3518 num
= pa_get_absolute_expression (&the_insn
, &s
);
3519 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3522 CHECK_FIELD (num
, 7, 0, strict
);
3523 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 6);
3525 /* Handle a 22bit SOP field for copr. */
3527 num
= pa_get_absolute_expression (&the_insn
, &s
);
3528 if (strict
&& the_insn
.exp
.X_op
!= O_constant
)
3531 CHECK_FIELD (num
, 4194303, 0, strict
);
3532 num
= (num
& 0x1f) | ((num
& 0x003fffe0) << 4);
3533 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
3535 /* Handle a source FP operand format completer. */
3537 if (*s
== ',' && *(s
+1) == 't')
3544 flag
= pa_parse_fp_cnv_format (&s
);
3545 the_insn
.fpof1
= flag
;
3546 if (flag
== W
|| flag
== UW
)
3548 if (flag
== DW
|| flag
== UDW
)
3550 if (flag
== QW
|| flag
== UQW
)
3552 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 11);
3554 /* Handle a destination FP operand format completer. */
3556 /* pa_parse_format needs the ',' prefix. */
3558 flag
= pa_parse_fp_cnv_format (&s
);
3559 the_insn
.fpof2
= flag
;
3560 if (flag
== W
|| flag
== UW
)
3562 if (flag
== DW
|| flag
== UDW
)
3564 if (flag
== QW
|| flag
== UQW
)
3566 opcode
|= flag
<< 13;
3567 if (the_insn
.fpof1
== SGL
3568 || the_insn
.fpof1
== DBL
3569 || the_insn
.fpof1
== QUAD
)
3571 if (the_insn
.fpof2
== SGL
3572 || the_insn
.fpof2
== DBL
3573 || the_insn
.fpof2
== QUAD
)
3575 else if (the_insn
.fpof2
== W
3576 || the_insn
.fpof2
== DW
3577 || the_insn
.fpof2
== QW
)
3579 else if (the_insn
.fpof2
== UW
3580 || the_insn
.fpof2
== UDW
3581 || the_insn
.fpof2
== UQW
)
3586 else if (the_insn
.fpof1
== W
3587 || the_insn
.fpof1
== DW
3588 || the_insn
.fpof1
== QW
)
3590 if (the_insn
.fpof2
== SGL
3591 || the_insn
.fpof2
== DBL
3592 || the_insn
.fpof2
== QUAD
)
3597 else if (the_insn
.fpof1
== UW
3598 || the_insn
.fpof1
== UDW
3599 || the_insn
.fpof1
== UQW
)
3601 if (the_insn
.fpof2
== SGL
3602 || the_insn
.fpof2
== DBL
3603 || the_insn
.fpof2
== QUAD
)
3608 flag
|= the_insn
.trunc
;
3609 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 15);
3611 /* Handle a source FP operand format completer. */
3613 flag
= pa_parse_fp_format (&s
);
3614 the_insn
.fpof1
= flag
;
3615 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 11);
3617 /* Handle a destination FP operand format completer. */
3619 /* pa_parse_format needs the ',' prefix. */
3621 flag
= pa_parse_fp_format (&s
);
3622 the_insn
.fpof2
= flag
;
3623 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 13);
3625 /* Handle a source FP operand format completer at 20. */
3627 flag
= pa_parse_fp_format (&s
);
3628 the_insn
.fpof1
= flag
;
3629 INSERT_FIELD_AND_CONTINUE (opcode
, flag
, 11);
3631 /* Handle a floating point operand format at 26.
3632 Only allows single and double precision. */
3634 flag
= pa_parse_fp_format (&s
);
3640 the_insn
.fpof1
= flag
;
3646 as_bad (_("Invalid Floating Point Operand Format."));
3650 /* Handle all floating point registers. */
3654 /* Float target register. */
3656 if (!pa_parse_number (&s
, 3))
3658 num
= (pa_number
& ~FP_REG_RSEL
) - FP_REG_BASE
;
3659 CHECK_FIELD (num
, 31, 0, 0);
3660 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
3662 /* Float target register with L/R selection. */
3665 if (!pa_parse_number (&s
, 1))
3667 num
= (pa_number
& ~FP_REG_RSEL
) - FP_REG_BASE
;
3668 CHECK_FIELD (num
, 31, 0, 0);
3671 /* 0x30 opcodes are FP arithmetic operation opcodes
3672 and need to be turned into 0x38 opcodes. This
3673 is not necessary for loads/stores. */
3674 if (need_pa11_opcode ()
3675 && ((opcode
& 0xfc000000) == 0x30000000))
3678 opcode
|= (pa_number
& FP_REG_RSEL
? 1 << 6 : 0);
3682 /* Float operand 1. */
3685 if (!pa_parse_number (&s
, 1))
3687 num
= (pa_number
& ~FP_REG_RSEL
) - FP_REG_BASE
;
3688 CHECK_FIELD (num
, 31, 0, 0);
3689 opcode
|= num
<< 21;
3690 if (need_pa11_opcode ())
3692 opcode
|= (pa_number
& FP_REG_RSEL
? 1 << 7 : 0);
3698 /* Float operand 1 with L/R selection. */
3702 if (!pa_parse_number (&s
, 1))
3704 num
= (pa_number
& ~FP_REG_RSEL
) - FP_REG_BASE
;
3705 CHECK_FIELD (num
, 31, 0, 0);
3706 opcode
|= num
<< 21;
3707 opcode
|= (pa_number
& FP_REG_RSEL
? 1 << 7 : 0);
3711 /* Float operand 2. */
3714 if (!pa_parse_number (&s
, 1))
3716 num
= (pa_number
& ~FP_REG_RSEL
) - FP_REG_BASE
;
3717 CHECK_FIELD (num
, 31, 0, 0);
3718 opcode
|= num
<< 16;
3719 if (need_pa11_opcode ())
3721 opcode
|= (pa_number
& FP_REG_RSEL
? 1 << 12 : 0);
3727 /* Float operand 2 with L/R selection. */
3730 if (!pa_parse_number (&s
, 1))
3732 num
= (pa_number
& ~FP_REG_RSEL
) - FP_REG_BASE
;
3733 CHECK_FIELD (num
, 31, 0, 0);
3734 opcode
|= num
<< 16;
3735 opcode
|= (pa_number
& FP_REG_RSEL
? 1 << 12 : 0);
3739 /* Float operand 3 for fmpyfadd, fmpynfadd. */
3742 if (!pa_parse_number (&s
, 1))
3744 num
= (pa_number
& ~FP_REG_RSEL
) - FP_REG_BASE
;
3745 CHECK_FIELD (num
, 31, 0, 0);
3746 opcode
|= (num
& 0x1c) << 11;
3747 opcode
|= (num
& 0x03) << 9;
3748 opcode
|= (pa_number
& FP_REG_RSEL
? 1 << 8 : 0);
3752 /* Float mult operand 1 for fmpyadd, fmpysub */
3755 if (!pa_parse_number (&s
, 1))
3757 num
= (pa_number
& ~FP_REG_RSEL
) - FP_REG_BASE
;
3758 CHECK_FIELD (num
, 31, 0, 0);
3759 if (the_insn
.fpof1
== SGL
)
3763 as_bad (_("Invalid register for single precision fmpyadd or fmpysub"));
3767 num
|= (pa_number
& FP_REG_RSEL
? 1 << 4 : 0);
3769 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 21);
3772 /* Float mult operand 2 for fmpyadd, fmpysub */
3775 if (!pa_parse_number (&s
, 1))
3777 num
= (pa_number
& ~FP_REG_RSEL
) - FP_REG_BASE
;
3778 CHECK_FIELD (num
, 31, 0, 0);
3779 if (the_insn
.fpof1
== SGL
)
3783 as_bad (_("Invalid register for single precision fmpyadd or fmpysub"));
3787 num
|= (pa_number
& FP_REG_RSEL
? 1 << 4 : 0);
3789 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 16);
3792 /* Float mult target for fmpyadd, fmpysub */
3795 if (!pa_parse_number (&s
, 1))
3797 num
= (pa_number
& ~FP_REG_RSEL
) - FP_REG_BASE
;
3798 CHECK_FIELD (num
, 31, 0, 0);
3799 if (the_insn
.fpof1
== SGL
)
3803 as_bad (_("Invalid register for single precision fmpyadd or fmpysub"));
3807 num
|= (pa_number
& FP_REG_RSEL
? 1 << 4 : 0);
3809 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 0);
3812 /* Float add operand 1 for fmpyadd, fmpysub */
3815 if (!pa_parse_number (&s
, 1))
3817 num
= (pa_number
& ~FP_REG_RSEL
) - FP_REG_BASE
;
3818 CHECK_FIELD (num
, 31, 0, 0);
3819 if (the_insn
.fpof1
== SGL
)
3823 as_bad (_("Invalid register for single precision fmpyadd or fmpysub"));
3827 num
|= (pa_number
& FP_REG_RSEL
? 1 << 4 : 0);
3829 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 6);
3832 /* Float add target for fmpyadd, fmpysub */
3835 if (!pa_parse_number (&s
, 1))
3837 num
= (pa_number
& ~FP_REG_RSEL
) - FP_REG_BASE
;
3838 CHECK_FIELD (num
, 31, 0, 0);
3839 if (the_insn
.fpof1
== SGL
)
3843 as_bad (_("Invalid register for single precision fmpyadd or fmpysub"));
3847 num
|= (pa_number
& FP_REG_RSEL
? 1 << 4 : 0);
3849 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 11);
3852 /* Handle L/R register halves like 'x'. */
3856 if (!pa_parse_number (&s
, 1))
3858 num
= (pa_number
& ~FP_REG_RSEL
) - FP_REG_BASE
;
3859 CHECK_FIELD (num
, 31, 0, 0);
3860 opcode
|= num
<< 16;
3861 if (need_pa11_opcode ())
3863 opcode
|= (pa_number
& FP_REG_RSEL
? 1 << 1 : 0);
3868 /* Float target register (PA 2.0 wide). */
3870 if (!pa_parse_number (&s
, 3))
3872 num
= (pa_number
& ~FP_REG_RSEL
) - FP_REG_BASE
;
3873 CHECK_FIELD (num
, 31, 0, 0);
3874 INSERT_FIELD_AND_CONTINUE (opcode
, num
, 16);
3888 /* Check if the args matched. */
3891 if (&insn
[1] - pa_opcodes
< (int) NUMOPCODES
3892 && !strcmp (insn
->name
, insn
[1].name
))
3900 as_bad (_("Invalid operands %s"), error_message
);
3907 the_insn
.opcode
= opcode
;
3910 /* Turn a string in input_line_pointer into a floating point constant of type
3911 type, and store the appropriate bytes in *litP. The number of LITTLENUMS
3912 emitted is stored in *sizeP . An error message or NULL is returned. */
3914 #define MAX_LITTLENUMS 6
3917 md_atof (type
, litP
, sizeP
)
3923 LITTLENUM_TYPE words
[MAX_LITTLENUMS
];
3924 LITTLENUM_TYPE
*wordP
;
3956 return _("Bad call to MD_ATOF()");
3958 t
= atof_ieee (input_line_pointer
, type
, words
);
3960 input_line_pointer
= t
;
3961 *sizeP
= prec
* sizeof (LITTLENUM_TYPE
);
3962 for (wordP
= words
; prec
--;)
3964 md_number_to_chars (litP
, (valueT
) (*wordP
++), sizeof (LITTLENUM_TYPE
));
3965 litP
+= sizeof (LITTLENUM_TYPE
);
3970 /* Write out big-endian. */
3973 md_number_to_chars (buf
, val
, n
)
3978 number_to_chars_bigendian (buf
, val
, n
);
3981 /* Translate internal representation of relocation info to BFD target
3985 tc_gen_reloc (section
, fixp
)
3990 struct hppa_fix_struct
*hppa_fixp
;
3991 static arelent
*no_relocs
= NULL
;
3998 hppa_fixp
= (struct hppa_fix_struct
*) fixp
->tc_fix_data
;
3999 if (fixp
->fx_addsy
== 0)
4002 assert (hppa_fixp
!= 0);
4003 assert (section
!= 0);
4005 reloc
= (arelent
*) xmalloc (sizeof (arelent
));
4007 reloc
->sym_ptr_ptr
= (asymbol
**) xmalloc (sizeof (asymbol
*));
4008 *reloc
->sym_ptr_ptr
= symbol_get_bfdsym (fixp
->fx_addsy
);
4009 codes
= hppa_gen_reloc_type (stdoutput
,
4011 hppa_fixp
->fx_r_format
,
4012 hppa_fixp
->fx_r_field
,
4013 fixp
->fx_subsy
!= NULL
,
4014 symbol_get_bfdsym (fixp
->fx_addsy
));
4019 for (n_relocs
= 0; codes
[n_relocs
]; n_relocs
++)
4022 relocs
= (arelent
**) xmalloc (sizeof (arelent
*) * n_relocs
+ 1);
4023 reloc
= (arelent
*) xmalloc (sizeof (arelent
) * n_relocs
);
4024 for (i
= 0; i
< n_relocs
; i
++)
4025 relocs
[i
] = &reloc
[i
];
4027 relocs
[n_relocs
] = NULL
;
4030 switch (fixp
->fx_r_type
)
4033 assert (n_relocs
== 1);
4037 reloc
->sym_ptr_ptr
= (asymbol
**) xmalloc (sizeof (asymbol
*));
4038 *reloc
->sym_ptr_ptr
= symbol_get_bfdsym (fixp
->fx_addsy
);
4039 reloc
->howto
= bfd_reloc_type_lookup (stdoutput
,
4040 (bfd_reloc_code_real_type
) code
);
4041 reloc
->address
= fixp
->fx_frag
->fr_address
+ fixp
->fx_where
;
4043 assert (reloc
->howto
&& (unsigned int) code
== reloc
->howto
->type
);
4045 /* Now, do any processing that is dependent on the relocation type. */
4048 case R_PARISC_DLTREL21L
:
4049 case R_PARISC_DLTREL14R
:
4050 case R_PARISC_DLTREL14F
:
4051 case R_PARISC_PLABEL32
:
4052 case R_PARISC_PLABEL21L
:
4053 case R_PARISC_PLABEL14R
:
4054 /* For plabel relocations, the addend of the
4055 relocation should be either 0 (no static link) or 2
4056 (static link required). This adjustment is done in
4057 bfd/elf32-hppa.c:elf32_hppa_relocate_section.
4059 We also slam a zero addend into the DLT relative relocs;
4060 it doesn't make a lot of sense to use any addend since
4061 it gets you a different (eg unknown) DLT entry. */
4065 #ifdef ELF_ARG_RELOC
4066 case R_PARISC_PCREL17R
:
4067 case R_PARISC_PCREL17F
:
4068 case R_PARISC_PCREL17C
:
4069 case R_PARISC_DIR17R
:
4070 case R_PARISC_DIR17F
:
4071 case R_PARISC_PCREL21L
:
4072 case R_PARISC_DIR21L
:
4073 reloc
->addend
= HPPA_R_ADDEND (hppa_fixp
->fx_arg_reloc
,
4079 reloc
->addend
= fixp
->fx_offset
;
4086 /* Walk over reach relocation returned by the BFD backend. */
4087 for (i
= 0; i
< n_relocs
; i
++)
4091 relocs
[i
]->sym_ptr_ptr
= (asymbol
**) xmalloc (sizeof (asymbol
*));
4092 *relocs
[i
]->sym_ptr_ptr
= symbol_get_bfdsym (fixp
->fx_addsy
);
4094 bfd_reloc_type_lookup (stdoutput
,
4095 (bfd_reloc_code_real_type
) code
);
4096 relocs
[i
]->address
= fixp
->fx_frag
->fr_address
+ fixp
->fx_where
;
4101 /* The only time we ever use a R_COMP2 fixup is for the difference
4102 of two symbols. With that in mind we fill in all four
4103 relocs now and break out of the loop. */
4105 relocs
[0]->sym_ptr_ptr
= (asymbol
**) &(bfd_abs_symbol
);
4107 bfd_reloc_type_lookup (stdoutput
,
4108 (bfd_reloc_code_real_type
) *codes
[0]);
4109 relocs
[0]->address
= fixp
->fx_frag
->fr_address
+ fixp
->fx_where
;
4110 relocs
[0]->addend
= 0;
4111 relocs
[1]->sym_ptr_ptr
= (asymbol
**) xmalloc (sizeof (asymbol
*));
4112 *relocs
[1]->sym_ptr_ptr
= symbol_get_bfdsym (fixp
->fx_addsy
);
4114 bfd_reloc_type_lookup (stdoutput
,
4115 (bfd_reloc_code_real_type
) *codes
[1]);
4116 relocs
[1]->address
= fixp
->fx_frag
->fr_address
+ fixp
->fx_where
;
4117 relocs
[1]->addend
= 0;
4118 relocs
[2]->sym_ptr_ptr
= (asymbol
**) xmalloc (sizeof (asymbol
*));
4119 *relocs
[2]->sym_ptr_ptr
= symbol_get_bfdsym (fixp
->fx_subsy
);
4121 bfd_reloc_type_lookup (stdoutput
,
4122 (bfd_reloc_code_real_type
) *codes
[2]);
4123 relocs
[2]->address
= fixp
->fx_frag
->fr_address
+ fixp
->fx_where
;
4124 relocs
[2]->addend
= 0;
4125 relocs
[3]->sym_ptr_ptr
= (asymbol
**) &(bfd_abs_symbol
);
4127 bfd_reloc_type_lookup (stdoutput
,
4128 (bfd_reloc_code_real_type
) *codes
[3]);
4129 relocs
[3]->address
= fixp
->fx_frag
->fr_address
+ fixp
->fx_where
;
4130 relocs
[3]->addend
= 0;
4131 relocs
[4]->sym_ptr_ptr
= (asymbol
**) &(bfd_abs_symbol
);
4133 bfd_reloc_type_lookup (stdoutput
,
4134 (bfd_reloc_code_real_type
) *codes
[4]);
4135 relocs
[4]->address
= fixp
->fx_frag
->fr_address
+ fixp
->fx_where
;
4136 relocs
[4]->addend
= 0;
4140 relocs
[i
]->addend
= HPPA_R_ADDEND (hppa_fixp
->fx_arg_reloc
, 0);
4146 /* For plabel relocations, the addend of the
4147 relocation should be either 0 (no static link) or 2
4148 (static link required).
4150 FIXME: We always assume no static link!
4152 We also slam a zero addend into the DLT relative relocs;
4153 it doesn't make a lot of sense to use any addend since
4154 it gets you a different (eg unknown) DLT entry. */
4155 relocs
[i
]->addend
= 0;
4170 /* There is no symbol or addend associated with these fixups. */
4171 relocs
[i
]->sym_ptr_ptr
= (asymbol
**) xmalloc (sizeof (asymbol
*));
4172 *relocs
[i
]->sym_ptr_ptr
= symbol_get_bfdsym (dummy_symbol
);
4173 relocs
[i
]->addend
= 0;
4179 /* There is no symbol associated with these fixups. */
4180 relocs
[i
]->sym_ptr_ptr
= (asymbol
**) xmalloc (sizeof (asymbol
*));
4181 *relocs
[i
]->sym_ptr_ptr
= symbol_get_bfdsym (dummy_symbol
);
4182 relocs
[i
]->addend
= fixp
->fx_offset
;
4186 relocs
[i
]->addend
= fixp
->fx_offset
;
4196 /* Process any machine dependent frag types. */
4199 md_convert_frag (abfd
, sec
, fragP
)
4200 register bfd
*abfd ATTRIBUTE_UNUSED
;
4201 register asection
*sec ATTRIBUTE_UNUSED
;
4202 register fragS
*fragP
;
4204 unsigned int address
;
4206 if (fragP
->fr_type
== rs_machine_dependent
)
4208 switch ((int) fragP
->fr_subtype
)
4211 fragP
->fr_type
= rs_fill
;
4212 know (fragP
->fr_var
== 1);
4213 know (fragP
->fr_next
);
4214 address
= fragP
->fr_address
+ fragP
->fr_fix
;
4215 if (address
% fragP
->fr_offset
)
4218 fragP
->fr_next
->fr_address
4223 fragP
->fr_offset
= 0;
4229 /* Round up a section size to the appropriate boundary. */
4232 md_section_align (segment
, size
)
4236 int align
= bfd_get_section_alignment (stdoutput
, segment
);
4237 int align2
= (1 << align
) - 1;
4239 return (size
+ align2
) & ~align2
;
4242 /* Return the approximate size of a frag before relaxation has occurred. */
4244 md_estimate_size_before_relax (fragP
, segment
)
4245 register fragS
*fragP
;
4246 asection
*segment ATTRIBUTE_UNUSED
;
4252 while ((fragP
->fr_fix
+ size
) % fragP
->fr_offset
)
4259 # ifdef WARN_COMMENTS
4260 const char *md_shortopts
= "Vc";
4262 const char *md_shortopts
= "V";
4265 # ifdef WARN_COMMENTS
4266 const char *md_shortopts
= "c";
4268 const char *md_shortopts
= "";
4272 struct option md_longopts
[] = {
4273 #ifdef WARN_COMMENTS
4274 {"warn-comment", no_argument
, NULL
, 'c'},
4276 {NULL
, no_argument
, NULL
, 0}
4278 size_t md_longopts_size
= sizeof(md_longopts
);
4281 md_parse_option (c
, arg
)
4282 int c ATTRIBUTE_UNUSED
;
4283 char *arg ATTRIBUTE_UNUSED
;
4292 print_version_id ();
4295 #ifdef WARN_COMMENTS
4306 md_show_usage (stream
)
4307 FILE *stream ATTRIBUTE_UNUSED
;
4310 fprintf (stream
, _("\
4313 #ifdef WARN_COMMENTS
4314 fprintf (stream
, _("\
4315 -c print a warning if a comment is found\n"));
4319 /* We have no need to default values of symbols. */
4322 md_undefined_symbol (name
)
4323 char *name ATTRIBUTE_UNUSED
;
4328 #if defined (OBJ_SOM) || defined (ELF_ARG_RELOC)
4329 #define arg_reloc_stub_needed(CALLER, CALLEE) \
4330 ((CALLEE) && (CALLER) && ((CALLEE) != (CALLER)))
4332 #define arg_reloc_stub_needed(CALLER, CALLEE) 0
4335 /* Apply a fixup to an instruction. */
4338 md_apply_fix (fixP
, valp
)
4342 char *buf
= fixP
->fx_where
+ fixP
->fx_frag
->fr_literal
;
4343 struct hppa_fix_struct
*hppa_fixP
;
4347 hppa_fixP
= (struct hppa_fix_struct
*) fixP
->tc_fix_data
;
4348 /* SOM uses R_HPPA_ENTRY and R_HPPA_EXIT relocations which can
4349 never be "applied" (they are just markers). Likewise for
4350 R_HPPA_BEGIN_BRTAB and R_HPPA_END_BRTAB. */
4352 if (fixP
->fx_r_type
== R_HPPA_ENTRY
4353 || fixP
->fx_r_type
== R_HPPA_EXIT
4354 || fixP
->fx_r_type
== R_HPPA_BEGIN_BRTAB
4355 || fixP
->fx_r_type
== R_HPPA_END_BRTAB
4356 || fixP
->fx_r_type
== R_HPPA_BEGIN_TRY
)
4359 /* Disgusting. We must set fx_offset ourselves -- R_HPPA_END_TRY
4360 fixups are considered not adjustable, which in turn causes
4361 adjust_reloc_syms to not set fx_offset. Ugh. */
4362 if (fixP
->fx_r_type
== R_HPPA_END_TRY
)
4364 fixP
->fx_offset
= *valp
;
4369 if (fixP
->fx_r_type
== (int) R_PARISC_GNU_VTENTRY
4370 || fixP
->fx_r_type
== (int) R_PARISC_GNU_VTINHERIT
)
4374 insn
= bfd_get_32 (stdoutput
, (unsigned char *) buf
);
4375 /* There should have been an HPPA specific fixup associated
4376 with the GAS fixup. */
4379 int fmt
= bfd_hppa_insn2fmt (stdoutput
, insn
);
4381 /* If there is a symbol associated with this fixup, then it's something
4382 which will need a SOM relocation (except for some PC-relative relocs).
4383 In such cases we should treat the "val" or "addend" as zero since it
4384 will be added in as needed from fx_offset in tc_gen_reloc. */
4385 if ((fixP
->fx_addsy
!= NULL
4386 || fixP
->fx_r_type
== (int) R_HPPA_NONE
)
4391 new_val
= ((fmt
== 12 || fmt
== 17 || fmt
== 22) ? 8 : 0);
4393 /* These field selectors imply that we do not want an addend. */
4394 else if (hppa_fixP
->fx_r_field
== e_psel
4395 || hppa_fixP
->fx_r_field
== e_rpsel
4396 || hppa_fixP
->fx_r_field
== e_lpsel
4397 || hppa_fixP
->fx_r_field
== e_tsel
4398 || hppa_fixP
->fx_r_field
== e_rtsel
4399 || hppa_fixP
->fx_r_field
== e_ltsel
)
4400 new_val
= ((fmt
== 12 || fmt
== 17 || fmt
== 22) ? 8 : 0);
4401 /* This is truely disgusting. The machine independent code blindly
4402 adds in the value of the symbol being relocated against. Damn! */
4404 && fixP
->fx_addsy
!= NULL
4405 && S_GET_SEGMENT (fixP
->fx_addsy
) != bfd_com_section_ptr
)
4406 new_val
= hppa_field_adjust (*valp
- S_GET_VALUE (fixP
->fx_addsy
),
4407 0, hppa_fixP
->fx_r_field
);
4410 new_val
= hppa_field_adjust (*valp
, 0, hppa_fixP
->fx_r_field
);
4412 /* Handle pc-relative exceptions from above. */
4413 if ((fmt
== 12 || fmt
== 17 || fmt
== 22)
4416 && !arg_reloc_stub_needed (symbol_arg_reloc_info (fixP
->fx_addsy
),
4417 hppa_fixP
->fx_arg_reloc
)
4418 && ((*valp
+ 8192) < 16384
4419 || (fmt
== 17 && (*valp
+ 262144) < 524288)
4420 || (fmt
== 22 && (*valp
+ 8388608) < 16777216))
4421 && S_GET_SEGMENT (fixP
->fx_addsy
) == hppa_fixP
->segment
4423 && S_GET_SEGMENT (fixP
->fx_subsy
) != hppa_fixP
->segment
))
4425 new_val
= hppa_field_adjust (*valp
, 0, hppa_fixP
->fx_r_field
);
4431 CHECK_FIELD (new_val
, 8191, -8192, 0);
4434 insn
= (insn
& ~ 0x3ff1) | (((val
& 0x1ff8) << 1)
4435 | ((val
& 0x2000) >> 13));
4438 CHECK_FIELD (new_val
, 8191, -8192, 0);
4441 insn
= (insn
& ~ 0x3ff9) | (((val
& 0x1ffc) << 1)
4442 | ((val
& 0x2000) >> 13));
4444 /* Handle all opcodes with the 'j' operand type. */
4446 CHECK_FIELD (new_val
, 8191, -8192, 0);
4449 insn
= ((insn
& ~ 0x3fff) | low_sign_unext (val
, 14));
4452 /* Handle all opcodes with the 'k' operand type. */
4454 CHECK_FIELD (new_val
, 1048575, -1048576, 0);
4457 insn
= (insn
& ~ 0x1fffff) | re_assemble_21 (val
);
4460 /* Handle all the opcodes with the 'i' operand type. */
4462 CHECK_FIELD (new_val
, 1023, -1023, 0);
4465 insn
= (insn
& ~ 0x7ff) | low_sign_unext (val
, 11);
4468 /* Handle all the opcodes with the 'w' operand type. */
4470 CHECK_FIELD (new_val
, 8199, -8184, 0);
4473 insn
= (insn
& ~ 0x1ffd) | re_assemble_12 ((val
- 8) >> 2);
4476 /* Handle some of the opcodes with the 'W' operand type. */
4479 offsetT distance
= *valp
;
4481 /* If this is an absolute branch (ie no link) with an out of
4482 range target, then we want to complain. */
4483 if (fixP
->fx_r_type
== (int) R_HPPA_PCREL_CALL
4484 && (insn
& 0xffe00000) == 0xe8000000)
4485 CHECK_FIELD (distance
, 262143, -262144, 0);
4487 CHECK_FIELD (new_val
, 262143, -262144, 0);
4490 insn
= (insn
& ~ 0x1f1ffd) | re_assemble_17 ((val
- 8) >> 2);
4496 offsetT distance
= *valp
;
4498 /* If this is an absolute branch (ie no link) with an out of
4499 range target, then we want to complain. */
4500 if (fixP
->fx_r_type
== (int) R_HPPA_PCREL_CALL
4501 && (insn
& 0xffe00000) == 0xe8000000)
4502 CHECK_FIELD (distance
, 8388607, -8388608, 0);
4504 CHECK_FIELD (new_val
, 8388607, -8388608, 0);
4507 insn
= (insn
& ~ 0x3ff1ffd) | re_assemble_22 ((val
- 8) >> 2);
4513 insn
= (insn
& ~ 0xfff1) | re_assemble_16 (val
& -8);
4518 insn
= (insn
& ~ 0xfff9) | re_assemble_16 (val
& -4);
4523 insn
= (insn
& ~ 0xffff) | re_assemble_16 (val
);
4531 as_bad (_("Unknown relocation encountered in md_apply_fix."));
4535 /* Insert the relocation. */
4536 bfd_put_32 (stdoutput
, insn
, (unsigned char *) buf
);
4541 printf (_("no hppa_fixup entry for this fixup (fixP = 0x%x, type = 0x%x)\n"),
4542 (unsigned int) fixP
, fixP
->fx_r_type
);
4547 /* Exactly what point is a PC-relative offset relative TO?
4548 On the PA, they're relative to the address of the offset. */
4551 md_pcrel_from (fixP
)
4554 return fixP
->fx_where
+ fixP
->fx_frag
->fr_address
;
4557 /* Return nonzero if the input line pointer is at the end of
4561 is_end_of_statement ()
4563 return ((*input_line_pointer
== '\n')
4564 || (*input_line_pointer
== ';')
4565 || (*input_line_pointer
== '!'));
4568 /* Read a number from S. The number might come in one of many forms,
4569 the most common will be a hex or decimal constant, but it could be
4570 a pre-defined register (Yuk!), or an absolute symbol.
4572 Return 1 on success or 0 on failure. If STRICT, then a missing
4573 register prefix will cause a failure. The number itself is
4574 returned in `pa_number'.
4576 IS_FLOAT indicates that a PA-89 FP register number should be
4577 parsed; A `l' or `r' suffix is checked for if but 2 of IS_FLOAT is
4580 pa_parse_number can not handle negative constants and will fail
4581 horribly if it is passed such a constant. */
4584 pa_parse_number (s
, is_float
)
4594 boolean have_prefix
;
4596 /* Skip whitespace before the number. */
4597 while (*p
== ' ' || *p
== '\t')
4603 if (!strict
&& isdigit (*p
))
4605 /* Looks like a number. */
4607 if (*p
== '0' && (*(p
+ 1) == 'x' || *(p
+ 1) == 'X'))
4609 /* The number is specified in hex. */
4611 while (isdigit (*p
) || ((*p
>= 'a') && (*p
<= 'f'))
4612 || ((*p
>= 'A') && (*p
<= 'F')))
4615 num
= num
* 16 + *p
- '0';
4616 else if (*p
>= 'a' && *p
<= 'f')
4617 num
= num
* 16 + *p
- 'a' + 10;
4619 num
= num
* 16 + *p
- 'A' + 10;
4625 /* The number is specified in decimal. */
4626 while (isdigit (*p
))
4628 num
= num
* 10 + *p
- '0';
4635 /* Check for a `l' or `r' suffix. */
4638 pa_number
+= FP_REG_BASE
;
4639 if (! (is_float
& 2))
4641 if (IS_R_SELECT (p
))
4643 pa_number
+= FP_REG_RSEL
;
4646 else if (IS_L_SELECT (p
))
4655 /* The number might be a predefined register. */
4660 /* Tege hack: Special case for general registers as the general
4661 code makes a binary search with case translation, and is VERY
4666 if (*p
== 'e' && *(p
+ 1) == 't'
4667 && (*(p
+ 2) == '0' || *(p
+ 2) == '1'))
4670 num
= *p
- '0' + 28;
4678 else if (!isdigit (*p
))
4681 as_bad (_("Undefined register: '%s'."), name
);
4687 num
= num
* 10 + *p
++ - '0';
4688 while (isdigit (*p
));
4693 /* Do a normal register search. */
4694 while (is_part_of_name (c
))
4700 status
= reg_name_search (name
);
4706 as_bad (_("Undefined register: '%s'."), name
);
4716 /* And finally, it could be a symbol in the absolute section which
4717 is effectively a constant, or a register alias symbol. */
4720 while (is_part_of_name (c
))
4726 if ((sym
= symbol_find (name
)) != NULL
)
4728 if (S_GET_SEGMENT (sym
) == reg_section
)
4730 num
= S_GET_VALUE (sym
);
4731 /* Well, we don't really have one, but we do have a
4735 else if (S_GET_SEGMENT (sym
) == &bfd_abs_section
)
4736 num
= S_GET_VALUE (sym
);
4740 as_bad (_("Non-absolute symbol: '%s'."), name
);
4746 /* There is where we'd come for an undefined symbol
4747 or for an empty string. For an empty string we
4748 will return zero. That's a concession made for
4749 compatability with the braindamaged HP assemblers. */
4755 as_bad (_("Undefined absolute constant: '%s'."), name
);
4764 if (!strict
|| have_prefix
)
4772 #define REG_NAME_CNT (sizeof(pre_defined_registers) / sizeof(struct pd_reg))
4774 /* Given NAME, find the register number associated with that name, return
4775 the integer value associated with the given name or -1 on failure. */
4778 reg_name_search (name
)
4781 int middle
, low
, high
;
4785 high
= REG_NAME_CNT
- 1;
4789 middle
= (low
+ high
) / 2;
4790 cmp
= strcasecmp (name
, pre_defined_registers
[middle
].name
);
4796 return pre_defined_registers
[middle
].value
;
4798 while (low
<= high
);
4804 /* Return nonzero if the given INSN and L/R information will require
4805 a new PA-1.1 opcode. */
4810 if ((pa_number
& FP_REG_RSEL
) != 0
4811 && !(the_insn
.fpof1
== DBL
&& the_insn
.fpof2
== DBL
))
4813 /* If this instruction is specific to a particular architecture,
4814 then set a new architecture. */
4815 if (bfd_get_mach (stdoutput
) < pa11
)
4817 if (!bfd_set_arch_mach (stdoutput
, bfd_arch_hppa
, pa11
))
4818 as_warn (_("could not update architecture and machine"));
4826 /* Parse a condition for a fcmp instruction. Return the numerical
4827 code associated with the condition. */
4830 pa_parse_fp_cmp_cond (s
)
4837 for (i
= 0; i
< 32; i
++)
4839 if (strncasecmp (*s
, fp_cond_map
[i
].string
,
4840 strlen (fp_cond_map
[i
].string
)) == 0)
4842 cond
= fp_cond_map
[i
].cond
;
4843 *s
+= strlen (fp_cond_map
[i
].string
);
4844 /* If not a complete match, back up the input string and
4846 if (**s
!= ' ' && **s
!= '\t')
4848 *s
-= strlen (fp_cond_map
[i
].string
);
4851 while (**s
== ' ' || **s
== '\t')
4857 as_bad (_("Invalid FP Compare Condition: %s"), *s
);
4859 /* Advance over the bogus completer. */
4860 while (**s
!= ',' && **s
!= ' ' && **s
!= '\t')
4866 /* Parse a graphics test complete for ftest. */
4869 pa_parse_ftest_gfx_completer (s
)
4875 if (strncasecmp (*s
, "acc8", 4) == 0)
4880 else if (strncasecmp (*s
, "acc6", 4) == 0)
4885 else if (strncasecmp (*s
, "acc4", 4) == 0)
4890 else if (strncasecmp (*s
, "acc2", 4) == 0)
4895 else if (strncasecmp (*s
, "acc", 3) == 0)
4900 else if (strncasecmp (*s
, "rej8", 4) == 0)
4905 else if (strncasecmp (*s
, "rej", 3) == 0)
4913 as_bad (_("Invalid FTEST completer: %s"), *s
);
4919 /* Parse an FP operand format completer returning the completer
4922 static fp_operand_format
4923 pa_parse_fp_cnv_format (s
)
4932 if (strncasecmp (*s
, "sgl", 3) == 0)
4937 else if (strncasecmp (*s
, "dbl", 3) == 0)
4942 else if (strncasecmp (*s
, "quad", 4) == 0)
4947 else if (strncasecmp (*s
, "w", 1) == 0)
4952 else if (strncasecmp (*s
, "uw", 2) == 0)
4957 else if (strncasecmp (*s
, "dw", 2) == 0)
4962 else if (strncasecmp (*s
, "udw", 3) == 0)
4967 else if (strncasecmp (*s
, "qw", 2) == 0)
4972 else if (strncasecmp (*s
, "uqw", 3) == 0)
4979 format
= ILLEGAL_FMT
;
4980 as_bad (_("Invalid FP Operand Format: %3s"), *s
);
4987 /* Parse an FP operand format completer returning the completer
4990 static fp_operand_format
4991 pa_parse_fp_format (s
)
5000 if (strncasecmp (*s
, "sgl", 3) == 0)
5005 else if (strncasecmp (*s
, "dbl", 3) == 0)
5010 else if (strncasecmp (*s
, "quad", 4) == 0)
5017 format
= ILLEGAL_FMT
;
5018 as_bad (_("Invalid FP Operand Format: %3s"), *s
);
5025 /* Convert from a selector string into a selector type. */
5028 pa_chk_field_selector (str
)
5031 int middle
, low
, high
;
5035 /* Read past any whitespace. */
5036 /* FIXME: should we read past newlines and formfeeds??? */
5037 while (**str
== ' ' || **str
== '\t' || **str
== '\n' || **str
== '\f')
5040 if ((*str
)[1] == '\'' || (*str
)[1] == '%')
5041 name
[0] = tolower ((*str
)[0]),
5043 else if ((*str
)[2] == '\'' || (*str
)[2] == '%')
5044 name
[0] = tolower ((*str
)[0]),
5045 name
[1] = tolower ((*str
)[1]),
5047 else if ((*str
)[3] == '\'' || (*str
)[3] == '%')
5048 name
[0] = tolower ((*str
)[0]),
5049 name
[1] = tolower ((*str
)[1]),
5050 name
[2] = tolower ((*str
)[2]),
5056 high
= sizeof (selector_table
) / sizeof (struct selector_entry
) - 1;
5060 middle
= (low
+ high
) / 2;
5061 cmp
= strcmp (name
, selector_table
[middle
].prefix
);
5068 *str
+= strlen (name
) + 1;
5070 if (selector_table
[middle
].field_selector
== e_nsel
)
5073 return selector_table
[middle
].field_selector
;
5076 while (low
<= high
);
5081 /* Mark (via expr_end) the end of an expression (I think). FIXME. */
5084 get_expression (str
)
5090 save_in
= input_line_pointer
;
5091 input_line_pointer
= str
;
5092 seg
= expression (&the_insn
.exp
);
5093 if (!(seg
== absolute_section
5094 || seg
== undefined_section
5095 || SEG_NORMAL (seg
)))
5097 as_warn (_("Bad segment in expression."));
5098 expr_end
= input_line_pointer
;
5099 input_line_pointer
= save_in
;
5102 expr_end
= input_line_pointer
;
5103 input_line_pointer
= save_in
;
5107 /* Mark (via expr_end) the end of an absolute expression. FIXME. */
5109 pa_get_absolute_expression (insn
, strp
)
5115 insn
->field_selector
= pa_chk_field_selector (strp
);
5116 save_in
= input_line_pointer
;
5117 input_line_pointer
= *strp
;
5118 expression (&insn
->exp
);
5119 /* This is not perfect, but is a huge improvement over doing nothing.
5121 The PA assembly syntax is ambigious in a variety of ways. Consider
5122 this string "4 %r5" Is that the number 4 followed by the register
5123 r5, or is that 4 MOD r5?
5125 If we get a modulo expresion When looking for an absolute, we try
5126 again cutting off the input string at the first whitespace character. */
5127 if (insn
->exp
.X_op
== O_modulus
)
5132 input_line_pointer
= *strp
;
5134 while (*s
!= ',' && *s
!= ' ' && *s
!= '\t')
5140 retval
= pa_get_absolute_expression (insn
, strp
);
5142 input_line_pointer
= save_in
;
5144 return evaluate_absolute (insn
);
5146 /* When in strict mode we have a non-match, fix up the pointers
5147 and return to our caller. */
5148 if (insn
->exp
.X_op
!= O_constant
&& strict
)
5150 expr_end
= input_line_pointer
;
5151 input_line_pointer
= save_in
;
5154 if (insn
->exp
.X_op
!= O_constant
)
5156 as_bad (_("Bad segment (should be absolute)."));
5157 expr_end
= input_line_pointer
;
5158 input_line_pointer
= save_in
;
5161 expr_end
= input_line_pointer
;
5162 input_line_pointer
= save_in
;
5163 return evaluate_absolute (insn
);
5166 /* Evaluate an absolute expression EXP which may be modified by
5167 the selector FIELD_SELECTOR. Return the value of the expression. */
5169 evaluate_absolute (insn
)
5174 int field_selector
= insn
->field_selector
;
5177 value
= exp
.X_add_number
;
5179 return hppa_field_adjust (0, value
, field_selector
);
5182 /* Given an argument location specification return the associated
5183 argument location number. */
5186 pa_build_arg_reloc (type_name
)
5190 if (strncasecmp (type_name
, "no", 2) == 0)
5192 if (strncasecmp (type_name
, "gr", 2) == 0)
5194 else if (strncasecmp (type_name
, "fr", 2) == 0)
5196 else if (strncasecmp (type_name
, "fu", 2) == 0)
5199 as_bad (_("Invalid argument location: %s\n"), type_name
);
5204 /* Encode and return an argument relocation specification for
5205 the given register in the location specified by arg_reloc. */
5208 pa_align_arg_reloc (reg
, arg_reloc
)
5210 unsigned int arg_reloc
;
5212 unsigned int new_reloc
;
5214 new_reloc
= arg_reloc
;
5230 as_bad (_("Invalid argument description: %d"), reg
);
5236 /* Parse a PA nullification completer (,n). Return nonzero if the
5237 completer was found; return zero if no completer was found. */
5249 if (strncasecmp (*s
, "n", 1) == 0)
5253 as_bad (_("Invalid Nullification: (%c)"), **s
);
5262 /* Parse a non-negated compare/subtract completer returning the
5263 number (for encoding in instrutions) of the given completer.
5265 ISBRANCH specifies whether or not this is parsing a condition
5266 completer for a branch (vs a nullification completer for a
5267 computational instruction. */
5270 pa_parse_nonneg_cmpsub_cmpltr (s
, isbranch
)
5275 char *name
= *s
+ 1;
5284 while (**s
!= ',' && **s
!= ' ' && **s
!= '\t')
5290 if (strcmp (name
, "=") == 0)
5294 else if (strcmp (name
, "<") == 0)
5298 else if (strcmp (name
, "<=") == 0)
5302 else if (strcmp (name
, "<<") == 0)
5306 else if (strcmp (name
, "<<=") == 0)
5310 else if (strcasecmp (name
, "sv") == 0)
5314 else if (strcasecmp (name
, "od") == 0)
5318 /* If we have something like addb,n then there is no condition
5320 else if (strcasecmp (name
, "n") == 0 && isbranch
)
5332 /* Reset pointers if this was really a ,n for a branch instruction. */
5340 /* Parse a negated compare/subtract completer returning the
5341 number (for encoding in instrutions) of the given completer.
5343 ISBRANCH specifies whether or not this is parsing a condition
5344 completer for a branch (vs a nullification completer for a
5345 computational instruction. */
5348 pa_parse_neg_cmpsub_cmpltr (s
, isbranch
)
5353 char *name
= *s
+ 1;
5362 while (**s
!= ',' && **s
!= ' ' && **s
!= '\t')
5368 if (strcasecmp (name
, "tr") == 0)
5372 else if (strcmp (name
, "<>") == 0)
5376 else if (strcmp (name
, ">=") == 0)
5380 else if (strcmp (name
, ">") == 0)
5384 else if (strcmp (name
, ">>=") == 0)
5388 else if (strcmp (name
, ">>") == 0)
5392 else if (strcasecmp (name
, "nsv") == 0)
5396 else if (strcasecmp (name
, "ev") == 0)
5400 /* If we have something like addb,n then there is no condition
5402 else if (strcasecmp (name
, "n") == 0 && isbranch
)
5414 /* Reset pointers if this was really a ,n for a branch instruction. */
5423 /* Parse a 64 bit compare and branch completer returning the number (for
5424 encoding in instrutions) of the given completer.
5426 Nonnegated comparisons are returned as 0-7, negated comparisons are
5427 returned as 8-15. */
5430 pa_parse_cmpb_64_cmpltr (s
)
5434 char *name
= *s
+ 1;
5441 while (**s
!= ',' && **s
!= ' ' && **s
!= '\t')
5446 if (strcmp (name
, "*") == 0)
5450 else if (strcmp (name
, "*=") == 0)
5454 else if (strcmp (name
, "*<") == 0)
5458 else if (strcmp (name
, "*<=") == 0)
5462 else if (strcmp (name
, "*<<") == 0)
5466 else if (strcmp (name
, "*<<=") == 0)
5470 else if (strcasecmp (name
, "*sv") == 0)
5474 else if (strcasecmp (name
, "*od") == 0)
5478 else if (strcasecmp (name
, "*tr") == 0)
5482 else if (strcmp (name
, "*<>") == 0)
5486 else if (strcmp (name
, "*>=") == 0)
5490 else if (strcmp (name
, "*>") == 0)
5494 else if (strcmp (name
, "*>>=") == 0)
5498 else if (strcmp (name
, "*>>") == 0)
5502 else if (strcasecmp (name
, "*nsv") == 0)
5506 else if (strcasecmp (name
, "*ev") == 0)
5521 /* Parse a 64 bit compare immediate and branch completer returning the number
5522 (for encoding in instrutions) of the given completer. */
5525 pa_parse_cmpib_64_cmpltr (s
)
5529 char *name
= *s
+ 1;
5536 while (**s
!= ',' && **s
!= ' ' && **s
!= '\t')
5541 if (strcmp (name
, "*<<") == 0)
5545 else if (strcmp (name
, "*=") == 0)
5549 else if (strcmp (name
, "*<") == 0)
5553 else if (strcmp (name
, "*<=") == 0)
5557 else if (strcmp (name
, "*>>=") == 0)
5561 else if (strcmp (name
, "*<>") == 0)
5565 else if (strcasecmp (name
, "*>=") == 0)
5569 else if (strcasecmp (name
, "*>") == 0)
5584 /* Parse a non-negated addition completer returning the number
5585 (for encoding in instrutions) of the given completer.
5587 ISBRANCH specifies whether or not this is parsing a condition
5588 completer for a branch (vs a nullification completer for a
5589 computational instruction. */
5592 pa_parse_nonneg_add_cmpltr (s
, isbranch
)
5597 char *name
= *s
+ 1;
5605 while (**s
!= ',' && **s
!= ' ' && **s
!= '\t')
5609 if (strcmp (name
, "=") == 0)
5613 else if (strcmp (name
, "<") == 0)
5617 else if (strcmp (name
, "<=") == 0)
5621 else if (strcasecmp (name
, "nuv") == 0)
5625 else if (strcasecmp (name
, "znv") == 0)
5629 else if (strcasecmp (name
, "sv") == 0)
5633 else if (strcasecmp (name
, "od") == 0)
5637 /* If we have something like addb,n then there is no condition
5639 else if (strcasecmp (name
, "n") == 0 && isbranch
)
5650 /* Reset pointers if this was really a ,n for a branch instruction. */
5651 if (cmpltr
== 0 && *name
== 'n' && isbranch
)
5657 /* Parse a negated addition completer returning the number
5658 (for encoding in instrutions) of the given completer.
5660 ISBRANCH specifies whether or not this is parsing a condition
5661 completer for a branch (vs a nullification completer for a
5662 computational instruction). */
5665 pa_parse_neg_add_cmpltr (s
, isbranch
)
5670 char *name
= *s
+ 1;
5678 while (**s
!= ',' && **s
!= ' ' && **s
!= '\t')
5682 if (strcasecmp (name
, "tr") == 0)
5686 else if (strcmp (name
, "<>") == 0)
5690 else if (strcmp (name
, ">=") == 0)
5694 else if (strcmp (name
, ">") == 0)
5698 else if (strcasecmp (name
, "uv") == 0)
5702 else if (strcasecmp (name
, "vnz") == 0)
5706 else if (strcasecmp (name
, "nsv") == 0)
5710 else if (strcasecmp (name
, "ev") == 0)
5714 /* If we have something like addb,n then there is no condition
5716 else if (strcasecmp (name
, "n") == 0 && isbranch
)
5727 /* Reset pointers if this was really a ,n for a branch instruction. */
5728 if (cmpltr
== 0 && *name
== 'n' && isbranch
)
5734 /* Parse a 64 bit wide mode add and branch completer returning the number (for
5735 encoding in instrutions) of the given completer. */
5738 pa_parse_addb_64_cmpltr (s
)
5742 char *name
= *s
+ 1;
5751 while (**s
!= ',' && **s
!= ' ' && **s
!= '\t')
5755 if (strcmp (name
, "=") == 0)
5759 else if (strcmp (name
, "<") == 0)
5763 else if (strcmp (name
, "<=") == 0)
5767 else if (strcasecmp (name
, "nuv") == 0)
5771 else if (strcasecmp (name
, "*=") == 0)
5775 else if (strcasecmp (name
, "*<") == 0)
5779 else if (strcasecmp (name
, "*<=") == 0)
5783 else if (strcmp (name
, "tr") == 0)
5787 else if (strcmp (name
, "<>") == 0)
5791 else if (strcmp (name
, ">=") == 0)
5795 else if (strcmp (name
, ">") == 0)
5799 else if (strcasecmp (name
, "uv") == 0)
5803 else if (strcasecmp (name
, "*<>") == 0)
5807 else if (strcasecmp (name
, "*>=") == 0)
5811 else if (strcasecmp (name
, "*>") == 0)
5815 /* If we have something like addb,n then there is no condition
5817 else if (strcasecmp (name
, "n") == 0)
5829 /* Reset pointers if this was really a ,n for a branch instruction. */
5837 /* Handle an alignment directive. Special so that we can update the
5838 alignment of the subspace if necessary. */
5842 /* We must have a valid space and subspace. */
5843 pa_check_current_space_and_subspace ();
5845 /* Let the generic gas code do most of the work. */
5846 s_align_bytes (bytes
);
5848 /* If bytes is a power of 2, then update the current subspace's
5849 alignment if necessary. */
5850 if (log2 (bytes
) != -1)
5851 record_alignment (current_subspace
->ssd_seg
, log2 (bytes
));
5855 /* Handle a .BLOCK type pseudo-op. */
5859 int z ATTRIBUTE_UNUSED
;
5863 unsigned int temp_size
;
5867 /* We must have a valid space and subspace. */
5868 pa_check_current_space_and_subspace ();
5871 temp_size
= get_absolute_expression ();
5873 /* Always fill with zeros, that's what the HP assembler does. */
5876 p
= frag_var (rs_fill
, (int) temp_size
, (int) temp_size
,
5877 (relax_substateT
) 0, (symbolS
*) 0, (offsetT
) 1, NULL
);
5878 memset (p
, 0, temp_size
);
5880 /* Convert 2 bytes at a time. */
5882 for (i
= 0; i
< temp_size
; i
+= 2)
5884 md_number_to_chars (p
+ i
,
5886 (int) ((temp_size
- i
) > 2 ? 2 : (temp_size
- i
)));
5889 pa_undefine_label ();
5890 demand_empty_rest_of_line ();
5893 /* Handle a .begin_brtab and .end_brtab pseudo-op. */
5897 int begin ATTRIBUTE_UNUSED
;
5901 /* The BRTAB relocations are only availble in SOM (to denote
5902 the beginning and end of branch tables). */
5903 char *where
= frag_more (0);
5905 fix_new_hppa (frag_now
, where
- frag_now
->fr_literal
, 0,
5906 NULL
, (offsetT
) 0, NULL
,
5907 0, begin
? R_HPPA_BEGIN_BRTAB
: R_HPPA_END_BRTAB
,
5908 e_fsel
, 0, 0, NULL
);
5911 demand_empty_rest_of_line ();
5914 /* Handle a .begin_try and .end_try pseudo-op. */
5918 int begin ATTRIBUTE_UNUSED
;
5922 char *where
= frag_more (0);
5927 /* The TRY relocations are only availble in SOM (to denote
5928 the beginning and end of exception handling regions). */
5930 fix_new_hppa (frag_now
, where
- frag_now
->fr_literal
, 0,
5931 NULL
, (offsetT
) 0, begin
? NULL
: &exp
,
5932 0, begin
? R_HPPA_BEGIN_TRY
: R_HPPA_END_TRY
,
5933 e_fsel
, 0, 0, NULL
);
5936 demand_empty_rest_of_line ();
5939 /* Handle a .CALL pseudo-op. This involves storing away information
5940 about where arguments are to be found so the linker can detect
5941 (and correct) argument location mismatches between caller and callee. */
5945 int unused ATTRIBUTE_UNUSED
;
5948 /* We must have a valid space and subspace. */
5949 pa_check_current_space_and_subspace ();
5952 pa_call_args (&last_call_desc
);
5953 demand_empty_rest_of_line ();
5956 /* Do the dirty work of building a call descriptor which describes
5957 where the caller placed arguments to a function call. */
5960 pa_call_args (call_desc
)
5961 struct call_desc
*call_desc
;
5964 unsigned int temp
, arg_reloc
;
5966 while (!is_end_of_statement ())
5968 name
= input_line_pointer
;
5969 c
= get_symbol_end ();
5970 /* Process a source argument. */
5971 if ((strncasecmp (name
, "argw", 4) == 0))
5973 temp
= atoi (name
+ 4);
5974 p
= input_line_pointer
;
5976 input_line_pointer
++;
5977 name
= input_line_pointer
;
5978 c
= get_symbol_end ();
5979 arg_reloc
= pa_build_arg_reloc (name
);
5980 call_desc
->arg_reloc
|= pa_align_arg_reloc (temp
, arg_reloc
);
5982 /* Process a return value. */
5983 else if ((strncasecmp (name
, "rtnval", 6) == 0))
5985 p
= input_line_pointer
;
5987 input_line_pointer
++;
5988 name
= input_line_pointer
;
5989 c
= get_symbol_end ();
5990 arg_reloc
= pa_build_arg_reloc (name
);
5991 call_desc
->arg_reloc
|= (arg_reloc
& 0x3);
5995 as_bad (_("Invalid .CALL argument: %s"), name
);
5997 p
= input_line_pointer
;
5999 if (!is_end_of_statement ())
6000 input_line_pointer
++;
6004 /* Return TRUE if FRAG1 and FRAG2 are the same. */
6007 is_same_frag (frag1
, frag2
)
6014 else if (frag2
== NULL
)
6016 else if (frag1
== frag2
)
6018 else if (frag2
->fr_type
== rs_fill
&& frag2
->fr_fix
== 0)
6019 return (is_same_frag (frag1
, frag2
->fr_next
));
6025 /* Build an entry in the UNWIND subspace from the given function
6026 attributes in CALL_INFO. This is not needed for SOM as using
6027 R_ENTRY and R_EXIT relocations allow the linker to handle building
6028 of the unwind spaces. */
6031 pa_build_unwind_subspace (call_info
)
6032 struct call_info
*call_info
;
6035 asection
*seg
, *save_seg
;
6036 subsegT save_subseg
;
6041 if (now_seg
!= text_section
)
6044 if (bfd_get_arch_info (stdoutput
)->bits_per_address
== 32)
6045 reloc
= R_PARISC_DIR32
;
6047 reloc
= R_PARISC_SEGREL32
;
6050 save_subseg
= now_subseg
;
6051 /* Get into the right seg/subseg. This may involve creating
6052 the seg the first time through. Make sure to have the
6053 old seg/subseg so that we can reset things when we are done. */
6054 seg
= bfd_get_section_by_name (stdoutput
, UNWIND_SECTION_NAME
);
6055 if (seg
== ASEC_NULL
)
6057 seg
= subseg_new (UNWIND_SECTION_NAME
, 0);
6058 bfd_set_section_flags (stdoutput
, seg
,
6059 SEC_READONLY
| SEC_HAS_CONTENTS
6060 | SEC_LOAD
| SEC_RELOC
| SEC_ALLOC
| SEC_DATA
);
6061 bfd_set_section_alignment (stdoutput
, seg
, 2);
6064 subseg_set (seg
, 0);
6067 /* Get some space to hold relocation information for the unwind
6070 md_number_to_chars (p
, 0, 4);
6072 /* Relocation info. for start offset of the function. */
6073 fix_new_hppa (frag_now
, p
- frag_now
->fr_literal
, 4,
6074 call_info
->start_symbol
, (offsetT
) 0,
6075 (expressionS
*) NULL
, 0, reloc
,
6076 e_fsel
, 32, 0, NULL
);
6079 md_number_to_chars (p
, 0, 4);
6081 /* Relocation info. for end offset of the function.
6083 Because we allow reductions of 32bit relocations for ELF, this will be
6084 reduced to section_sym + offset which avoids putting the temporary
6085 symbol into the symbol table. It (should) end up giving the same
6086 value as call_info->start_symbol + function size once the linker is
6087 finished with its work. */
6089 fix_new_hppa (frag_now
, p
- frag_now
->fr_literal
, 4,
6090 call_info
->end_symbol
, (offsetT
) 0,
6091 (expressionS
*) NULL
, 0, reloc
,
6092 e_fsel
, 32, 0, NULL
);
6095 unwind
= (char *) &call_info
->ci_unwind
;
6096 for (i
= 8; i
< sizeof (struct unwind_table
); i
++)
6100 FRAG_APPEND_1_CHAR (c
);
6104 /* Return back to the original segment/subsegment. */
6105 subseg_set (save_seg
, save_subseg
);
6109 /* Process a .CALLINFO pseudo-op. This information is used later
6110 to build unwind descriptors and maybe one day to support
6111 .ENTER and .LEAVE. */
6114 pa_callinfo (unused
)
6115 int unused ATTRIBUTE_UNUSED
;
6121 /* We must have a valid space and subspace. */
6122 pa_check_current_space_and_subspace ();
6125 /* .CALLINFO must appear within a procedure definition. */
6126 if (!within_procedure
)
6127 as_bad (_(".callinfo is not within a procedure definition"));
6129 /* Mark the fact that we found the .CALLINFO for the
6130 current procedure. */
6131 callinfo_found
= TRUE
;
6133 /* Iterate over the .CALLINFO arguments. */
6134 while (!is_end_of_statement ())
6136 name
= input_line_pointer
;
6137 c
= get_symbol_end ();
6138 /* Frame size specification. */
6139 if ((strncasecmp (name
, "frame", 5) == 0))
6141 p
= input_line_pointer
;
6143 input_line_pointer
++;
6144 temp
= get_absolute_expression ();
6145 if ((temp
& 0x3) != 0)
6147 as_bad (_("FRAME parameter must be a multiple of 8: %d\n"), temp
);
6151 /* callinfo is in bytes and unwind_desc is in 8 byte units. */
6152 last_call_info
->ci_unwind
.descriptor
.frame_size
= temp
/ 8;
6155 /* Entry register (GR, GR and SR) specifications. */
6156 else if ((strncasecmp (name
, "entry_gr", 8) == 0))
6158 p
= input_line_pointer
;
6160 input_line_pointer
++;
6161 temp
= get_absolute_expression ();
6162 /* The HP assembler accepts 19 as the high bound for ENTRY_GR
6163 even though %r19 is caller saved. I think this is a bug in
6164 the HP assembler, and we are not going to emulate it. */
6165 if (temp
< 3 || temp
> 18)
6166 as_bad (_("Value for ENTRY_GR must be in the range 3..18\n"));
6167 last_call_info
->ci_unwind
.descriptor
.entry_gr
= temp
- 2;
6169 else if ((strncasecmp (name
, "entry_fr", 8) == 0))
6171 p
= input_line_pointer
;
6173 input_line_pointer
++;
6174 temp
= get_absolute_expression ();
6175 /* Similarly the HP assembler takes 31 as the high bound even
6176 though %fr21 is the last callee saved floating point register. */
6177 if (temp
< 12 || temp
> 21)
6178 as_bad (_("Value for ENTRY_FR must be in the range 12..21\n"));
6179 last_call_info
->ci_unwind
.descriptor
.entry_fr
= temp
- 11;
6181 else if ((strncasecmp (name
, "entry_sr", 8) == 0))
6183 p
= input_line_pointer
;
6185 input_line_pointer
++;
6186 temp
= get_absolute_expression ();
6188 as_bad (_("Value for ENTRY_SR must be 3\n"));
6190 /* Note whether or not this function performs any calls. */
6191 else if ((strncasecmp (name
, "calls", 5) == 0) ||
6192 (strncasecmp (name
, "caller", 6) == 0))
6194 p
= input_line_pointer
;
6197 else if ((strncasecmp (name
, "no_calls", 8) == 0))
6199 p
= input_line_pointer
;
6202 /* Should RP be saved into the stack. */
6203 else if ((strncasecmp (name
, "save_rp", 7) == 0))
6205 p
= input_line_pointer
;
6207 last_call_info
->ci_unwind
.descriptor
.save_rp
= 1;
6209 /* Likewise for SP. */
6210 else if ((strncasecmp (name
, "save_sp", 7) == 0))
6212 p
= input_line_pointer
;
6214 last_call_info
->ci_unwind
.descriptor
.save_sp
= 1;
6216 /* Is this an unwindable procedure. If so mark it so
6217 in the unwind descriptor. */
6218 else if ((strncasecmp (name
, "no_unwind", 9) == 0))
6220 p
= input_line_pointer
;
6222 last_call_info
->ci_unwind
.descriptor
.cannot_unwind
= 1;
6224 /* Is this an interrupt routine. If so mark it in the
6225 unwind descriptor. */
6226 else if ((strncasecmp (name
, "hpux_int", 7) == 0))
6228 p
= input_line_pointer
;
6230 last_call_info
->ci_unwind
.descriptor
.hpux_interrupt_marker
= 1;
6232 /* Is this a millicode routine. "millicode" isn't in my
6233 assembler manual, but my copy is old. The HP assembler
6234 accepts it, and there's a place in the unwind descriptor
6235 to drop the information, so we'll accept it too. */
6236 else if ((strncasecmp (name
, "millicode", 9) == 0))
6238 p
= input_line_pointer
;
6240 last_call_info
->ci_unwind
.descriptor
.millicode
= 1;
6244 as_bad (_("Invalid .CALLINFO argument: %s"), name
);
6245 *input_line_pointer
= c
;
6247 if (!is_end_of_statement ())
6248 input_line_pointer
++;
6251 demand_empty_rest_of_line ();
6254 #if !(defined (OBJ_ELF) && defined (TE_LINUX))
6255 /* Switch to the text space. Like s_text, but delete our
6256 label when finished. */
6259 int unused ATTRIBUTE_UNUSED
;
6262 current_space
= is_defined_space ("$TEXT$");
6264 = pa_subsegment_to_subspace (current_space
->sd_seg
, 0);
6268 pa_undefine_label ();
6271 /* Switch to the data space. As usual delete our label. */
6274 int unused ATTRIBUTE_UNUSED
;
6277 current_space
= is_defined_space ("$PRIVATE$");
6279 = pa_subsegment_to_subspace (current_space
->sd_seg
, 0);
6282 pa_undefine_label ();
6285 /* This is different than the standard GAS s_comm(). On HP9000/800 machines,
6286 the .comm pseudo-op has the following symtax:
6288 <label> .comm <length>
6290 where <label> is optional and is a symbol whose address will be the start of
6291 a block of memory <length> bytes long. <length> must be an absolute
6292 expression. <length> bytes will be allocated in the current space
6295 Also note the label may not even be on the same line as the .comm.
6297 This difference in syntax means the colon function will be called
6298 on the symbol before we arrive in pa_comm. colon will set a number
6299 of attributes of the symbol that need to be fixed here. In particular
6300 the value, section pointer, fragment pointer, flags, etc. What
6303 This also makes error detection all but impossible. */
6307 int unused ATTRIBUTE_UNUSED
;
6311 label_symbol_struct
*label_symbol
= pa_get_label ();
6314 symbol
= label_symbol
->lss_label
;
6319 size
= get_absolute_expression ();
6323 S_SET_VALUE (symbol
, size
);
6324 S_SET_SEGMENT (symbol
, bfd_und_section_ptr
);
6325 S_SET_EXTERNAL (symbol
);
6327 /* colon() has already set the frag to the current location in the
6328 current subspace; we need to reset the fragment to the zero address
6329 fragment. We also need to reset the segment pointer. */
6330 symbol_set_frag (symbol
, &zero_address_frag
);
6332 demand_empty_rest_of_line ();
6334 #endif /* !(defined (OBJ_ELF) && defined (TE_LINUX)) */
6336 /* Process a .END pseudo-op. */
6340 int unused ATTRIBUTE_UNUSED
;
6342 demand_empty_rest_of_line ();
6345 /* Process a .ENTER pseudo-op. This is not supported. */
6348 int unused ATTRIBUTE_UNUSED
;
6351 /* We must have a valid space and subspace. */
6352 pa_check_current_space_and_subspace ();
6355 as_bad (_("The .ENTER pseudo-op is not supported"));
6356 demand_empty_rest_of_line ();
6359 /* Process a .ENTRY pseudo-op. .ENTRY marks the beginning of the
6363 int unused ATTRIBUTE_UNUSED
;
6366 /* We must have a valid space and subspace. */
6367 pa_check_current_space_and_subspace ();
6370 if (!within_procedure
)
6371 as_bad (_("Misplaced .entry. Ignored."));
6374 if (!callinfo_found
)
6375 as_bad (_("Missing .callinfo."));
6377 demand_empty_rest_of_line ();
6378 within_entry_exit
= TRUE
;
6381 /* SOM defers building of unwind descriptors until the link phase.
6382 The assembler is responsible for creating an R_ENTRY relocation
6383 to mark the beginning of a region and hold the unwind bits, and
6384 for creating an R_EXIT relocation to mark the end of the region.
6386 FIXME. ELF should be using the same conventions! The problem
6387 is an unwind requires too much relocation space. Hmmm. Maybe
6388 if we split the unwind bits up between the relocations which
6389 denote the entry and exit points. */
6390 if (last_call_info
->start_symbol
!= NULL
)
6392 char *where
= frag_more (0);
6394 fix_new_hppa (frag_now
, where
- frag_now
->fr_literal
, 0,
6395 NULL
, (offsetT
) 0, NULL
,
6396 0, R_HPPA_ENTRY
, e_fsel
, 0, 0,
6397 (int *) &last_call_info
->ci_unwind
.descriptor
);
6402 /* Silly nonsense for pa_equ. The only half-sensible use for this is
6403 being able to subtract two register symbols that specify a range of
6404 registers, to get the size of the range. */
6405 static int fudge_reg_expressions
;
6408 hppa_force_reg_syms_absolute (resultP
, op
, rightP
)
6409 expressionS
*resultP
;
6410 operatorT op ATTRIBUTE_UNUSED
;
6411 expressionS
*rightP
;
6413 if (fudge_reg_expressions
6414 && rightP
->X_op
== O_register
6415 && resultP
->X_op
== O_register
)
6417 rightP
->X_op
= O_constant
;
6418 resultP
->X_op
= O_constant
;
6420 return 0; /* Continue normal expr handling. */
6423 /* Handle a .EQU pseudo-op. */
6429 label_symbol_struct
*label_symbol
= pa_get_label ();
6434 symbol
= label_symbol
->lss_label
;
6438 if (!pa_parse_number (&input_line_pointer
, 0))
6439 as_bad (_(".REG expression must be a register"));
6440 S_SET_VALUE (symbol
, pa_number
);
6441 S_SET_SEGMENT (symbol
, reg_section
);
6448 fudge_reg_expressions
= 1;
6449 seg
= expression (&exp
);
6450 fudge_reg_expressions
= 0;
6451 if (exp
.X_op
!= O_constant
6452 && exp
.X_op
!= O_register
)
6454 if (exp
.X_op
!= O_absent
)
6455 as_bad (_("bad or irreducible absolute expression; zero assumed"));
6456 exp
.X_add_number
= 0;
6457 seg
= absolute_section
;
6459 S_SET_VALUE (symbol
, (unsigned int) exp
.X_add_number
);
6460 S_SET_SEGMENT (symbol
, seg
);
6466 as_bad (_(".REG must use a label"));
6468 as_bad (_(".EQU must use a label"));
6471 pa_undefine_label ();
6472 demand_empty_rest_of_line ();
6475 /* Helper function. Does processing for the end of a function. This
6476 usually involves creating some relocations or building special
6477 symbols to mark the end of the function. */
6484 where
= frag_more (0);
6487 /* Mark the end of the function, stuff away the location of the frag
6488 for the end of the function, and finally call pa_build_unwind_subspace
6489 to add an entry in the unwind table. */
6490 hppa_elf_mark_end_of_function ();
6491 pa_build_unwind_subspace (last_call_info
);
6493 /* SOM defers building of unwind descriptors until the link phase.
6494 The assembler is responsible for creating an R_ENTRY relocation
6495 to mark the beginning of a region and hold the unwind bits, and
6496 for creating an R_EXIT relocation to mark the end of the region.
6498 FIXME. ELF should be using the same conventions! The problem
6499 is an unwind requires too much relocation space. Hmmm. Maybe
6500 if we split the unwind bits up between the relocations which
6501 denote the entry and exit points. */
6502 fix_new_hppa (frag_now
, where
- frag_now
->fr_literal
, 0,
6504 NULL
, 0, R_HPPA_EXIT
, e_fsel
, 0, 0,
6505 (int *) &last_call_info
->ci_unwind
.descriptor
+ 1);
6509 /* Process a .EXIT pseudo-op. */
6513 int unused ATTRIBUTE_UNUSED
;
6516 /* We must have a valid space and subspace. */
6517 pa_check_current_space_and_subspace ();
6520 if (!within_procedure
)
6521 as_bad (_(".EXIT must appear within a procedure"));
6524 if (!callinfo_found
)
6525 as_bad (_("Missing .callinfo"));
6528 if (!within_entry_exit
)
6529 as_bad (_("No .ENTRY for this .EXIT"));
6532 within_entry_exit
= FALSE
;
6537 demand_empty_rest_of_line ();
6540 /* Process a .EXPORT directive. This makes functions external
6541 and provides information such as argument relocation entries
6546 int unused ATTRIBUTE_UNUSED
;
6551 name
= input_line_pointer
;
6552 c
= get_symbol_end ();
6553 /* Make sure the given symbol exists. */
6554 if ((symbol
= symbol_find_or_make (name
)) == NULL
)
6556 as_bad (_("Cannot define export symbol: %s\n"), name
);
6557 p
= input_line_pointer
;
6559 input_line_pointer
++;
6563 /* OK. Set the external bits and process argument relocations.
6564 For the HP, weak and global are not mutually exclusive.
6565 S_SET_EXTERNAL will not set BSF_GLOBAL if WEAK is set.
6566 Call S_SET_EXTERNAL to get the other processing. Manually
6567 set BSF_GLOBAL when we get back. */
6568 S_SET_EXTERNAL (symbol
);
6569 symbol_get_bfdsym (symbol
)->flags
|= BSF_GLOBAL
;
6570 p
= input_line_pointer
;
6572 if (!is_end_of_statement ())
6574 input_line_pointer
++;
6575 pa_type_args (symbol
, 1);
6579 demand_empty_rest_of_line ();
6582 /* Helper function to process arguments to a .EXPORT pseudo-op. */
6585 pa_type_args (symbolP
, is_export
)
6590 unsigned int temp
, arg_reloc
;
6591 pa_symbol_type type
= SYMBOL_TYPE_UNKNOWN
;
6592 asymbol
*bfdsym
= symbol_get_bfdsym (symbolP
);
6594 if (strncasecmp (input_line_pointer
, "absolute", 8) == 0)
6597 input_line_pointer
+= 8;
6598 bfdsym
->flags
&= ~BSF_FUNCTION
;
6599 S_SET_SEGMENT (symbolP
, bfd_abs_section_ptr
);
6600 type
= SYMBOL_TYPE_ABSOLUTE
;
6602 else if (strncasecmp (input_line_pointer
, "code", 4) == 0)
6604 input_line_pointer
+= 4;
6605 /* IMPORTing/EXPORTing CODE types for functions is meaningless for SOM,
6606 instead one should be IMPORTing/EXPORTing ENTRY types.
6608 Complain if one tries to EXPORT a CODE type since that's never
6609 done. Both GCC and HP C still try to IMPORT CODE types, so
6610 silently fix them to be ENTRY types. */
6611 if (S_IS_FUNCTION (symbolP
))
6614 as_tsktsk (_("Using ENTRY rather than CODE in export directive for %s"),
6615 S_GET_NAME (symbolP
));
6617 bfdsym
->flags
|= BSF_FUNCTION
;
6618 type
= SYMBOL_TYPE_ENTRY
;
6622 bfdsym
->flags
&= ~BSF_FUNCTION
;
6623 type
= SYMBOL_TYPE_CODE
;
6626 else if (strncasecmp (input_line_pointer
, "data", 4) == 0)
6628 input_line_pointer
+= 4;
6629 bfdsym
->flags
&= ~BSF_FUNCTION
;
6630 bfdsym
->flags
|= BSF_OBJECT
;
6631 type
= SYMBOL_TYPE_DATA
;
6633 else if ((strncasecmp (input_line_pointer
, "entry", 5) == 0))
6635 input_line_pointer
+= 5;
6636 bfdsym
->flags
|= BSF_FUNCTION
;
6637 type
= SYMBOL_TYPE_ENTRY
;
6639 else if (strncasecmp (input_line_pointer
, "millicode", 9) == 0)
6641 input_line_pointer
+= 9;
6642 bfdsym
->flags
|= BSF_FUNCTION
;
6645 elf_symbol_type
*elfsym
= (elf_symbol_type
*) bfdsym
;
6646 elfsym
->internal_elf_sym
.st_info
=
6647 ELF_ST_INFO (ELF_ST_BIND (elfsym
->internal_elf_sym
.st_info
),
6651 type
= SYMBOL_TYPE_MILLICODE
;
6653 else if (strncasecmp (input_line_pointer
, "plabel", 6) == 0)
6655 input_line_pointer
+= 6;
6656 bfdsym
->flags
&= ~BSF_FUNCTION
;
6657 type
= SYMBOL_TYPE_PLABEL
;
6659 else if (strncasecmp (input_line_pointer
, "pri_prog", 8) == 0)
6661 input_line_pointer
+= 8;
6662 bfdsym
->flags
|= BSF_FUNCTION
;
6663 type
= SYMBOL_TYPE_PRI_PROG
;
6665 else if (strncasecmp (input_line_pointer
, "sec_prog", 8) == 0)
6667 input_line_pointer
+= 8;
6668 bfdsym
->flags
|= BSF_FUNCTION
;
6669 type
= SYMBOL_TYPE_SEC_PROG
;
6672 /* SOM requires much more information about symbol types
6673 than BFD understands. This is how we get this information
6674 to the SOM BFD backend. */
6675 #ifdef obj_set_symbol_type
6676 obj_set_symbol_type (bfdsym
, (int) type
);
6679 /* Now that the type of the exported symbol has been handled,
6680 handle any argument relocation information. */
6681 while (!is_end_of_statement ())
6683 if (*input_line_pointer
== ',')
6684 input_line_pointer
++;
6685 name
= input_line_pointer
;
6686 c
= get_symbol_end ();
6687 /* Argument sources. */
6688 if ((strncasecmp (name
, "argw", 4) == 0))
6690 p
= input_line_pointer
;
6692 input_line_pointer
++;
6693 temp
= atoi (name
+ 4);
6694 name
= input_line_pointer
;
6695 c
= get_symbol_end ();
6696 arg_reloc
= pa_align_arg_reloc (temp
, pa_build_arg_reloc (name
));
6697 #if defined (OBJ_SOM) || defined (ELF_ARG_RELOC)
6698 symbol_arg_reloc_info (symbolP
) |= arg_reloc
;
6700 *input_line_pointer
= c
;
6702 /* The return value. */
6703 else if ((strncasecmp (name
, "rtnval", 6)) == 0)
6705 p
= input_line_pointer
;
6707 input_line_pointer
++;
6708 name
= input_line_pointer
;
6709 c
= get_symbol_end ();
6710 arg_reloc
= pa_build_arg_reloc (name
);
6711 #if defined (OBJ_SOM) || defined (ELF_ARG_RELOC)
6712 symbol_arg_reloc_info (symbolP
) |= arg_reloc
;
6714 *input_line_pointer
= c
;
6716 /* Privelege level. */
6717 else if ((strncasecmp (name
, "priv_lev", 8)) == 0)
6719 p
= input_line_pointer
;
6721 input_line_pointer
++;
6722 temp
= atoi (input_line_pointer
);
6724 ((obj_symbol_type
*) bfdsym
)->tc_data
.ap
.hppa_priv_level
= temp
;
6726 c
= get_symbol_end ();
6727 *input_line_pointer
= c
;
6731 as_bad (_("Undefined .EXPORT/.IMPORT argument (ignored): %s"), name
);
6732 p
= input_line_pointer
;
6735 if (!is_end_of_statement ())
6736 input_line_pointer
++;
6740 /* Handle an .IMPORT pseudo-op. Any symbol referenced in a given
6741 assembly file must either be defined in the assembly file, or
6742 explicitly IMPORTED from another. */
6746 int unused ATTRIBUTE_UNUSED
;
6751 name
= input_line_pointer
;
6752 c
= get_symbol_end ();
6754 symbol
= symbol_find (name
);
6755 /* Ugh. We might be importing a symbol defined earlier in the file,
6756 in which case all the code below will really screw things up
6757 (set the wrong segment, symbol flags & type, etc). */
6758 if (symbol
== NULL
|| !S_IS_DEFINED (symbol
))
6760 symbol
= symbol_find_or_make (name
);
6761 p
= input_line_pointer
;
6764 if (!is_end_of_statement ())
6766 input_line_pointer
++;
6767 pa_type_args (symbol
, 0);
6771 /* Sigh. To be compatable with the HP assembler and to help
6772 poorly written assembly code, we assign a type based on
6773 the the current segment. Note only BSF_FUNCTION really
6774 matters, we do not need to set the full SYMBOL_TYPE_* info. */
6775 if (now_seg
== text_section
)
6776 symbol_get_bfdsym (symbol
)->flags
|= BSF_FUNCTION
;
6778 /* If the section is undefined, then the symbol is undefined
6779 Since this is an import, leave the section undefined. */
6780 S_SET_SEGMENT (symbol
, bfd_und_section_ptr
);
6785 /* The symbol was already defined. Just eat everything up to
6786 the end of the current statement. */
6787 while (!is_end_of_statement ())
6788 input_line_pointer
++;
6791 demand_empty_rest_of_line ();
6794 /* Handle a .LABEL pseudo-op. */
6798 int unused ATTRIBUTE_UNUSED
;
6802 name
= input_line_pointer
;
6803 c
= get_symbol_end ();
6805 if (strlen (name
) > 0)
6808 p
= input_line_pointer
;
6813 as_warn (_("Missing label name on .LABEL"));
6816 if (!is_end_of_statement ())
6818 as_warn (_("extra .LABEL arguments ignored."));
6819 ignore_rest_of_line ();
6821 demand_empty_rest_of_line ();
6824 /* Handle a .LEAVE pseudo-op. This is not supported yet. */
6828 int unused ATTRIBUTE_UNUSED
;
6831 /* We must have a valid space and subspace. */
6832 pa_check_current_space_and_subspace ();
6835 as_bad (_("The .LEAVE pseudo-op is not supported"));
6836 demand_empty_rest_of_line ();
6839 /* Handle a .LEVEL pseudo-op. */
6843 int unused ATTRIBUTE_UNUSED
;
6847 level
= input_line_pointer
;
6848 if (strncmp (level
, "1.0", 3) == 0)
6850 input_line_pointer
+= 3;
6851 if (!bfd_set_arch_mach (stdoutput
, bfd_arch_hppa
, 10))
6852 as_warn (_("could not set architecture and machine"));
6854 else if (strncmp (level
, "1.1", 3) == 0)
6856 input_line_pointer
+= 3;
6857 if (!bfd_set_arch_mach (stdoutput
, bfd_arch_hppa
, 11))
6858 as_warn (_("could not set architecture and machine"));
6860 else if (strncmp (level
, "2.0w", 4) == 0)
6862 input_line_pointer
+= 4;
6863 if (!bfd_set_arch_mach (stdoutput
, bfd_arch_hppa
, 25))
6864 as_warn (_("could not set architecture and machine"));
6866 else if (strncmp (level
, "2.0", 3) == 0)
6868 input_line_pointer
+= 3;
6869 if (!bfd_set_arch_mach (stdoutput
, bfd_arch_hppa
, 20))
6870 as_warn (_("could not set architecture and machine"));
6874 as_bad (_("Unrecognized .LEVEL argument\n"));
6875 ignore_rest_of_line ();
6877 demand_empty_rest_of_line ();
6880 /* Handle a .ORIGIN pseudo-op. */
6884 int unused ATTRIBUTE_UNUSED
;
6887 /* We must have a valid space and subspace. */
6888 pa_check_current_space_and_subspace ();
6892 pa_undefine_label ();
6895 /* Handle a .PARAM pseudo-op. This is much like a .EXPORT, except it
6896 is for static functions. FIXME. Should share more code with .EXPORT. */
6900 int unused ATTRIBUTE_UNUSED
;
6905 name
= input_line_pointer
;
6906 c
= get_symbol_end ();
6908 if ((symbol
= symbol_find_or_make (name
)) == NULL
)
6910 as_bad (_("Cannot define static symbol: %s\n"), name
);
6911 p
= input_line_pointer
;
6913 input_line_pointer
++;
6917 S_CLEAR_EXTERNAL (symbol
);
6918 p
= input_line_pointer
;
6920 if (!is_end_of_statement ())
6922 input_line_pointer
++;
6923 pa_type_args (symbol
, 0);
6927 demand_empty_rest_of_line ();
6930 /* Handle a .PROC pseudo-op. It is used to mark the beginning
6931 of a procedure from a syntactical point of view. */
6935 int unused ATTRIBUTE_UNUSED
;
6937 struct call_info
*call_info
;
6940 /* We must have a valid space and subspace. */
6941 pa_check_current_space_and_subspace ();
6944 if (within_procedure
)
6945 as_fatal (_("Nested procedures"));
6947 /* Reset global variables for new procedure. */
6948 callinfo_found
= FALSE
;
6949 within_procedure
= TRUE
;
6951 /* Create another call_info structure. */
6952 call_info
= (struct call_info
*) xmalloc (sizeof (struct call_info
));
6955 as_fatal (_("Cannot allocate unwind descriptor\n"));
6957 memset (call_info
, 0, sizeof (struct call_info
));
6959 call_info
->ci_next
= NULL
;
6961 if (call_info_root
== NULL
)
6963 call_info_root
= call_info
;
6964 last_call_info
= call_info
;
6968 last_call_info
->ci_next
= call_info
;
6969 last_call_info
= call_info
;
6972 /* set up defaults on call_info structure */
6974 call_info
->ci_unwind
.descriptor
.cannot_unwind
= 0;
6975 call_info
->ci_unwind
.descriptor
.region_desc
= 1;
6976 call_info
->ci_unwind
.descriptor
.hpux_interrupt_marker
= 0;
6978 /* If we got a .PROC pseudo-op, we know that the function is defined
6979 locally. Make sure it gets into the symbol table. */
6981 label_symbol_struct
*label_symbol
= pa_get_label ();
6985 if (label_symbol
->lss_label
)
6987 last_call_info
->start_symbol
= label_symbol
->lss_label
;
6988 symbol_get_bfdsym (label_symbol
->lss_label
)->flags
|= BSF_FUNCTION
;
6991 as_bad (_("Missing function name for .PROC (corrupted label chain)"));
6994 last_call_info
->start_symbol
= NULL
;
6997 demand_empty_rest_of_line ();
7000 /* Process the syntatical end of a procedure. Make sure all the
7001 appropriate pseudo-ops were found within the procedure. */
7005 int unused ATTRIBUTE_UNUSED
;
7009 /* We must have a valid space and subspace. */
7010 pa_check_current_space_and_subspace ();
7013 /* If we are within a procedure definition, make sure we've
7014 defined a label for the procedure; handle case where the
7015 label was defined after the .PROC directive.
7017 Note there's not need to diddle with the segment or fragment
7018 for the label symbol in this case. We have already switched
7019 into the new $CODE$ subspace at this point. */
7020 if (within_procedure
&& last_call_info
->start_symbol
== NULL
)
7022 label_symbol_struct
*label_symbol
= pa_get_label ();
7026 if (label_symbol
->lss_label
)
7028 last_call_info
->start_symbol
= label_symbol
->lss_label
;
7029 symbol_get_bfdsym (label_symbol
->lss_label
)->flags
7032 /* Also handle allocation of a fixup to hold the unwind
7033 information when the label appears after the proc/procend. */
7034 if (within_entry_exit
)
7036 char *where
= frag_more (0);
7038 fix_new_hppa (frag_now
, where
- frag_now
->fr_literal
, 0,
7039 NULL
, (offsetT
) 0, NULL
,
7040 0, R_HPPA_ENTRY
, e_fsel
, 0, 0,
7041 (int *) &last_call_info
->ci_unwind
.descriptor
);
7046 as_bad (_("Missing function name for .PROC (corrupted label chain)"));
7049 as_bad (_("Missing function name for .PROC"));
7052 if (!within_procedure
)
7053 as_bad (_("misplaced .procend"));
7055 if (!callinfo_found
)
7056 as_bad (_("Missing .callinfo for this procedure"));
7058 if (within_entry_exit
)
7059 as_bad (_("Missing .EXIT for a .ENTRY"));
7062 /* ELF needs to mark the end of each function so that it can compute
7063 the size of the function (apparently its needed in the symbol table). */
7064 hppa_elf_mark_end_of_function ();
7067 within_procedure
= FALSE
;
7068 demand_empty_rest_of_line ();
7069 pa_undefine_label ();
7074 /* If VALUE is an exact power of two between zero and 2^31, then
7075 return log2 (VALUE). Else return -1. */
7083 while ((1 << shift
) != value
&& shift
< 32)
7092 /* Check to make sure we have a valid space and subspace. */
7095 pa_check_current_space_and_subspace ()
7097 if (current_space
== NULL
)
7098 as_fatal (_("Not in a space.\n"));
7100 if (current_subspace
== NULL
)
7101 as_fatal (_("Not in a subspace.\n"));
7104 /* Parse the parameters to a .SPACE directive; if CREATE_FLAG is nonzero,
7105 then create a new space entry to hold the information specified
7106 by the parameters to the .SPACE directive. */
7108 static sd_chain_struct
*
7109 pa_parse_space_stmt (space_name
, create_flag
)
7113 char *name
, *ptemp
, c
;
7114 char loadable
, defined
, private, sort
;
7116 asection
*seg
= NULL
;
7117 sd_chain_struct
*space
;
7119 /* load default values */
7125 if (strcmp (space_name
, "$TEXT$") == 0)
7127 seg
= pa_def_spaces
[0].segment
;
7128 defined
= pa_def_spaces
[0].defined
;
7129 private = pa_def_spaces
[0].private;
7130 sort
= pa_def_spaces
[0].sort
;
7131 spnum
= pa_def_spaces
[0].spnum
;
7133 else if (strcmp (space_name
, "$PRIVATE$") == 0)
7135 seg
= pa_def_spaces
[1].segment
;
7136 defined
= pa_def_spaces
[1].defined
;
7137 private = pa_def_spaces
[1].private;
7138 sort
= pa_def_spaces
[1].sort
;
7139 spnum
= pa_def_spaces
[1].spnum
;
7142 if (!is_end_of_statement ())
7144 print_errors
= FALSE
;
7145 ptemp
= input_line_pointer
+ 1;
7146 /* First see if the space was specified as a number rather than
7147 as a name. According to the PA assembly manual the rest of
7148 the line should be ignored. */
7150 pa_parse_number (&ptemp
, 0);
7154 input_line_pointer
= ptemp
;
7158 while (!is_end_of_statement ())
7160 input_line_pointer
++;
7161 name
= input_line_pointer
;
7162 c
= get_symbol_end ();
7163 if ((strncasecmp (name
, "spnum", 5) == 0))
7165 *input_line_pointer
= c
;
7166 input_line_pointer
++;
7167 spnum
= get_absolute_expression ();
7169 else if ((strncasecmp (name
, "sort", 4) == 0))
7171 *input_line_pointer
= c
;
7172 input_line_pointer
++;
7173 sort
= get_absolute_expression ();
7175 else if ((strncasecmp (name
, "unloadable", 10) == 0))
7177 *input_line_pointer
= c
;
7180 else if ((strncasecmp (name
, "notdefined", 10) == 0))
7182 *input_line_pointer
= c
;
7185 else if ((strncasecmp (name
, "private", 7) == 0))
7187 *input_line_pointer
= c
;
7192 as_bad (_("Invalid .SPACE argument"));
7193 *input_line_pointer
= c
;
7194 if (!is_end_of_statement ())
7195 input_line_pointer
++;
7199 print_errors
= TRUE
;
7202 if (create_flag
&& seg
== NULL
)
7203 seg
= subseg_new (space_name
, 0);
7205 /* If create_flag is nonzero, then create the new space with
7206 the attributes computed above. Else set the values in
7207 an already existing space -- this can only happen for
7208 the first occurence of a built-in space. */
7210 space
= create_new_space (space_name
, spnum
, loadable
, defined
,
7211 private, sort
, seg
, 1);
7214 space
= is_defined_space (space_name
);
7215 SPACE_SPNUM (space
) = spnum
;
7216 SPACE_DEFINED (space
) = defined
& 1;
7217 SPACE_USER_DEFINED (space
) = 1;
7220 #ifdef obj_set_section_attributes
7221 obj_set_section_attributes (seg
, defined
, private, sort
, spnum
);
7227 /* Handle a .SPACE pseudo-op; this switches the current space to the
7228 given space, creating the new space if necessary. */
7232 int unused ATTRIBUTE_UNUSED
;
7234 char *name
, c
, *space_name
, *save_s
;
7235 sd_chain_struct
*sd_chain
;
7237 if (within_procedure
)
7239 as_bad (_("Can\'t change spaces within a procedure definition. Ignored"));
7240 ignore_rest_of_line ();
7244 /* Check for some of the predefined spaces. FIXME: most of the code
7245 below is repeated several times, can we extract the common parts
7246 and place them into a subroutine or something similar? */
7247 /* FIXME Is this (and the next IF stmt) really right?
7248 What if INPUT_LINE_POINTER points to "$TEXT$FOO"? */
7249 if (strncmp (input_line_pointer
, "$TEXT$", 6) == 0)
7251 input_line_pointer
+= 6;
7252 sd_chain
= is_defined_space ("$TEXT$");
7253 if (sd_chain
== NULL
)
7254 sd_chain
= pa_parse_space_stmt ("$TEXT$", 1);
7255 else if (SPACE_USER_DEFINED (sd_chain
) == 0)
7256 sd_chain
= pa_parse_space_stmt ("$TEXT$", 0);
7258 current_space
= sd_chain
;
7259 subseg_set (text_section
, sd_chain
->sd_last_subseg
);
7261 = pa_subsegment_to_subspace (text_section
,
7262 sd_chain
->sd_last_subseg
);
7263 demand_empty_rest_of_line ();
7266 if (strncmp (input_line_pointer
, "$PRIVATE$", 9) == 0)
7268 input_line_pointer
+= 9;
7269 sd_chain
= is_defined_space ("$PRIVATE$");
7270 if (sd_chain
== NULL
)
7271 sd_chain
= pa_parse_space_stmt ("$PRIVATE$", 1);
7272 else if (SPACE_USER_DEFINED (sd_chain
) == 0)
7273 sd_chain
= pa_parse_space_stmt ("$PRIVATE$", 0);
7275 current_space
= sd_chain
;
7276 subseg_set (data_section
, sd_chain
->sd_last_subseg
);
7278 = pa_subsegment_to_subspace (data_section
,
7279 sd_chain
->sd_last_subseg
);
7280 demand_empty_rest_of_line ();
7283 if (!strncasecmp (input_line_pointer
,
7284 GDB_DEBUG_SPACE_NAME
,
7285 strlen (GDB_DEBUG_SPACE_NAME
)))
7287 input_line_pointer
+= strlen (GDB_DEBUG_SPACE_NAME
);
7288 sd_chain
= is_defined_space (GDB_DEBUG_SPACE_NAME
);
7289 if (sd_chain
== NULL
)
7290 sd_chain
= pa_parse_space_stmt (GDB_DEBUG_SPACE_NAME
, 1);
7291 else if (SPACE_USER_DEFINED (sd_chain
) == 0)
7292 sd_chain
= pa_parse_space_stmt (GDB_DEBUG_SPACE_NAME
, 0);
7294 current_space
= sd_chain
;
7297 asection
*gdb_section
7298 = bfd_make_section_old_way (stdoutput
, GDB_DEBUG_SPACE_NAME
);
7300 subseg_set (gdb_section
, sd_chain
->sd_last_subseg
);
7302 = pa_subsegment_to_subspace (gdb_section
,
7303 sd_chain
->sd_last_subseg
);
7305 demand_empty_rest_of_line ();
7309 /* It could be a space specified by number. */
7311 save_s
= input_line_pointer
;
7313 pa_parse_number (&input_line_pointer
, 0);
7316 if ((sd_chain
= pa_find_space_by_number (pa_number
)))
7318 current_space
= sd_chain
;
7320 subseg_set (sd_chain
->sd_seg
, sd_chain
->sd_last_subseg
);
7322 = pa_subsegment_to_subspace (sd_chain
->sd_seg
,
7323 sd_chain
->sd_last_subseg
);
7324 demand_empty_rest_of_line ();
7329 /* Not a number, attempt to create a new space. */
7331 input_line_pointer
= save_s
;
7332 name
= input_line_pointer
;
7333 c
= get_symbol_end ();
7334 space_name
= xmalloc (strlen (name
) + 1);
7335 strcpy (space_name
, name
);
7336 *input_line_pointer
= c
;
7338 sd_chain
= pa_parse_space_stmt (space_name
, 1);
7339 current_space
= sd_chain
;
7341 subseg_set (sd_chain
->sd_seg
, sd_chain
->sd_last_subseg
);
7342 current_subspace
= pa_subsegment_to_subspace (sd_chain
->sd_seg
,
7343 sd_chain
->sd_last_subseg
);
7344 demand_empty_rest_of_line ();
7348 /* Switch to a new space. (I think). FIXME. */
7352 int unused ATTRIBUTE_UNUSED
;
7357 sd_chain_struct
*space
;
7359 name
= input_line_pointer
;
7360 c
= get_symbol_end ();
7361 space
= is_defined_space (name
);
7365 md_number_to_chars (p
, SPACE_SPNUM (space
), 4);
7368 as_warn (_("Undefined space: '%s' Assuming space number = 0."), name
);
7370 *input_line_pointer
= c
;
7371 demand_empty_rest_of_line ();
7374 /* Handle a .SUBSPACE pseudo-op; this switches the current subspace to the
7375 given subspace, creating the new subspace if necessary.
7377 FIXME. Should mirror pa_space more closely, in particular how
7378 they're broken up into subroutines. */
7381 pa_subspace (create_new
)
7384 char *name
, *ss_name
, c
;
7385 char loadable
, code_only
, common
, dup_common
, zero
, sort
;
7386 int i
, access
, space_index
, alignment
, quadrant
, applicable
, flags
;
7387 sd_chain_struct
*space
;
7388 ssd_chain_struct
*ssd
;
7391 if (current_space
== NULL
)
7392 as_fatal (_("Must be in a space before changing or declaring subspaces.\n"));
7394 if (within_procedure
)
7396 as_bad (_("Can\'t change subspaces within a procedure definition. Ignored"));
7397 ignore_rest_of_line ();
7401 name
= input_line_pointer
;
7402 c
= get_symbol_end ();
7403 ss_name
= xmalloc (strlen (name
) + 1);
7404 strcpy (ss_name
, name
);
7405 *input_line_pointer
= c
;
7407 /* Load default values. */
7419 space
= current_space
;
7423 ssd
= is_defined_subspace (ss_name
);
7424 /* Allow user to override the builtin attributes of subspaces. But
7425 only allow the attributes to be changed once! */
7426 if (ssd
&& SUBSPACE_DEFINED (ssd
))
7428 subseg_set (ssd
->ssd_seg
, ssd
->ssd_subseg
);
7429 current_subspace
= ssd
;
7430 if (!is_end_of_statement ())
7431 as_warn (_("Parameters of an existing subspace can\'t be modified"));
7432 demand_empty_rest_of_line ();
7437 /* A new subspace. Load default values if it matches one of
7438 the builtin subspaces. */
7440 while (pa_def_subspaces
[i
].name
)
7442 if (strcasecmp (pa_def_subspaces
[i
].name
, ss_name
) == 0)
7444 loadable
= pa_def_subspaces
[i
].loadable
;
7445 common
= pa_def_subspaces
[i
].common
;
7446 dup_common
= pa_def_subspaces
[i
].dup_common
;
7447 code_only
= pa_def_subspaces
[i
].code_only
;
7448 zero
= pa_def_subspaces
[i
].zero
;
7449 space_index
= pa_def_subspaces
[i
].space_index
;
7450 alignment
= pa_def_subspaces
[i
].alignment
;
7451 quadrant
= pa_def_subspaces
[i
].quadrant
;
7452 access
= pa_def_subspaces
[i
].access
;
7453 sort
= pa_def_subspaces
[i
].sort
;
7460 /* We should be working with a new subspace now. Fill in
7461 any information as specified by the user. */
7462 if (!is_end_of_statement ())
7464 input_line_pointer
++;
7465 while (!is_end_of_statement ())
7467 name
= input_line_pointer
;
7468 c
= get_symbol_end ();
7469 if ((strncasecmp (name
, "quad", 4) == 0))
7471 *input_line_pointer
= c
;
7472 input_line_pointer
++;
7473 quadrant
= get_absolute_expression ();
7475 else if ((strncasecmp (name
, "align", 5) == 0))
7477 *input_line_pointer
= c
;
7478 input_line_pointer
++;
7479 alignment
= get_absolute_expression ();
7480 if (log2 (alignment
) == -1)
7482 as_bad (_("Alignment must be a power of 2"));
7486 else if ((strncasecmp (name
, "access", 6) == 0))
7488 *input_line_pointer
= c
;
7489 input_line_pointer
++;
7490 access
= get_absolute_expression ();
7492 else if ((strncasecmp (name
, "sort", 4) == 0))
7494 *input_line_pointer
= c
;
7495 input_line_pointer
++;
7496 sort
= get_absolute_expression ();
7498 else if ((strncasecmp (name
, "code_only", 9) == 0))
7500 *input_line_pointer
= c
;
7503 else if ((strncasecmp (name
, "unloadable", 10) == 0))
7505 *input_line_pointer
= c
;
7508 else if ((strncasecmp (name
, "common", 6) == 0))
7510 *input_line_pointer
= c
;
7513 else if ((strncasecmp (name
, "dup_comm", 8) == 0))
7515 *input_line_pointer
= c
;
7518 else if ((strncasecmp (name
, "zero", 4) == 0))
7520 *input_line_pointer
= c
;
7523 else if ((strncasecmp (name
, "first", 5) == 0))
7524 as_bad (_("FIRST not supported as a .SUBSPACE argument"));
7526 as_bad (_("Invalid .SUBSPACE argument"));
7527 if (!is_end_of_statement ())
7528 input_line_pointer
++;
7532 /* Compute a reasonable set of BFD flags based on the information
7533 in the .subspace directive. */
7534 applicable
= bfd_applicable_section_flags (stdoutput
);
7537 flags
|= (SEC_ALLOC
| SEC_LOAD
);
7540 if (common
|| dup_common
)
7541 flags
|= SEC_IS_COMMON
;
7543 flags
|= SEC_RELOC
| SEC_HAS_CONTENTS
;
7545 /* This is a zero-filled subspace (eg BSS). */
7547 flags
&= ~(SEC_LOAD
| SEC_HAS_CONTENTS
);
7549 applicable
&= flags
;
7551 /* If this is an existing subspace, then we want to use the
7552 segment already associated with the subspace.
7554 FIXME NOW! ELF BFD doesn't appear to be ready to deal with
7555 lots of sections. It might be a problem in the PA ELF
7556 code, I do not know yet. For now avoid creating anything
7557 but the "standard" sections for ELF. */
7559 section
= subseg_force_new (ss_name
, 0);
7561 section
= ssd
->ssd_seg
;
7563 section
= subseg_new (ss_name
, 0);
7566 seg_info (section
)->bss
= 1;
7568 /* Now set the flags. */
7569 bfd_set_section_flags (stdoutput
, section
, applicable
);
7571 /* Record any alignment request for this section. */
7572 record_alignment (section
, log2 (alignment
));
7574 /* Set the starting offset for this section. */
7575 bfd_set_section_vma (stdoutput
, section
,
7576 pa_subspace_start (space
, quadrant
));
7578 /* Now that all the flags are set, update an existing subspace,
7579 or create a new one. */
7582 current_subspace
= update_subspace (space
, ss_name
, loadable
,
7583 code_only
, common
, dup_common
,
7584 sort
, zero
, access
, space_index
,
7585 alignment
, quadrant
,
7588 current_subspace
= create_new_subspace (space
, ss_name
, loadable
,
7590 dup_common
, zero
, sort
,
7591 access
, space_index
,
7592 alignment
, quadrant
, section
);
7594 demand_empty_rest_of_line ();
7595 current_subspace
->ssd_seg
= section
;
7596 subseg_set (current_subspace
->ssd_seg
, current_subspace
->ssd_subseg
);
7598 SUBSPACE_DEFINED (current_subspace
) = 1;
7602 /* Create default space and subspace dictionaries. */
7609 space_dict_root
= NULL
;
7610 space_dict_last
= NULL
;
7613 while (pa_def_spaces
[i
].name
)
7617 /* Pick the right name to use for the new section. */
7618 name
= pa_def_spaces
[i
].name
;
7620 pa_def_spaces
[i
].segment
= subseg_new (name
, 0);
7621 create_new_space (pa_def_spaces
[i
].name
, pa_def_spaces
[i
].spnum
,
7622 pa_def_spaces
[i
].loadable
, pa_def_spaces
[i
].defined
,
7623 pa_def_spaces
[i
].private, pa_def_spaces
[i
].sort
,
7624 pa_def_spaces
[i
].segment
, 0);
7629 while (pa_def_subspaces
[i
].name
)
7632 int applicable
, subsegment
;
7633 asection
*segment
= NULL
;
7634 sd_chain_struct
*space
;
7636 /* Pick the right name for the new section and pick the right
7637 subsegment number. */
7638 name
= pa_def_subspaces
[i
].name
;
7641 /* Create the new section. */
7642 segment
= subseg_new (name
, subsegment
);
7645 /* For SOM we want to replace the standard .text, .data, and .bss
7646 sections with our own. We also want to set BFD flags for
7647 all the built-in subspaces. */
7648 if (!strcmp (pa_def_subspaces
[i
].name
, "$CODE$"))
7650 text_section
= segment
;
7651 applicable
= bfd_applicable_section_flags (stdoutput
);
7652 bfd_set_section_flags (stdoutput
, segment
,
7653 applicable
& (SEC_ALLOC
| SEC_LOAD
7654 | SEC_RELOC
| SEC_CODE
7656 | SEC_HAS_CONTENTS
));
7658 else if (!strcmp (pa_def_subspaces
[i
].name
, "$DATA$"))
7660 data_section
= segment
;
7661 applicable
= bfd_applicable_section_flags (stdoutput
);
7662 bfd_set_section_flags (stdoutput
, segment
,
7663 applicable
& (SEC_ALLOC
| SEC_LOAD
7665 | SEC_HAS_CONTENTS
));
7669 else if (!strcmp (pa_def_subspaces
[i
].name
, "$BSS$"))
7671 bss_section
= segment
;
7672 applicable
= bfd_applicable_section_flags (stdoutput
);
7673 bfd_set_section_flags (stdoutput
, segment
,
7674 applicable
& SEC_ALLOC
);
7676 else if (!strcmp (pa_def_subspaces
[i
].name
, "$LIT$"))
7678 applicable
= bfd_applicable_section_flags (stdoutput
);
7679 bfd_set_section_flags (stdoutput
, segment
,
7680 applicable
& (SEC_ALLOC
| SEC_LOAD
7683 | SEC_HAS_CONTENTS
));
7685 else if (!strcmp (pa_def_subspaces
[i
].name
, "$MILLICODE$"))
7687 applicable
= bfd_applicable_section_flags (stdoutput
);
7688 bfd_set_section_flags (stdoutput
, segment
,
7689 applicable
& (SEC_ALLOC
| SEC_LOAD
7692 | SEC_HAS_CONTENTS
));
7694 else if (!strcmp (pa_def_subspaces
[i
].name
, "$UNWIND$"))
7696 applicable
= bfd_applicable_section_flags (stdoutput
);
7697 bfd_set_section_flags (stdoutput
, segment
,
7698 applicable
& (SEC_ALLOC
| SEC_LOAD
7701 | SEC_HAS_CONTENTS
));
7704 /* Find the space associated with this subspace. */
7705 space
= pa_segment_to_space (pa_def_spaces
[pa_def_subspaces
[i
].
7706 def_space_index
].segment
);
7709 as_fatal (_("Internal error: Unable to find containing space for %s."),
7710 pa_def_subspaces
[i
].name
);
7713 create_new_subspace (space
, name
,
7714 pa_def_subspaces
[i
].loadable
,
7715 pa_def_subspaces
[i
].code_only
,
7716 pa_def_subspaces
[i
].common
,
7717 pa_def_subspaces
[i
].dup_common
,
7718 pa_def_subspaces
[i
].zero
,
7719 pa_def_subspaces
[i
].sort
,
7720 pa_def_subspaces
[i
].access
,
7721 pa_def_subspaces
[i
].space_index
,
7722 pa_def_subspaces
[i
].alignment
,
7723 pa_def_subspaces
[i
].quadrant
,
7731 /* Create a new space NAME, with the appropriate flags as defined
7732 by the given parameters. */
7734 static sd_chain_struct
*
7735 create_new_space (name
, spnum
, loadable
, defined
, private,
7736 sort
, seg
, user_defined
)
7746 sd_chain_struct
*chain_entry
;
7748 chain_entry
= (sd_chain_struct
*) xmalloc (sizeof (sd_chain_struct
));
7750 as_fatal (_("Out of memory: could not allocate new space chain entry: %s\n"),
7753 SPACE_NAME (chain_entry
) = (char *) xmalloc (strlen (name
) + 1);
7754 strcpy (SPACE_NAME (chain_entry
), name
);
7755 SPACE_DEFINED (chain_entry
) = defined
;
7756 SPACE_USER_DEFINED (chain_entry
) = user_defined
;
7757 SPACE_SPNUM (chain_entry
) = spnum
;
7759 chain_entry
->sd_seg
= seg
;
7760 chain_entry
->sd_last_subseg
= -1;
7761 chain_entry
->sd_subspaces
= NULL
;
7762 chain_entry
->sd_next
= NULL
;
7764 /* Find spot for the new space based on its sort key. */
7765 if (!space_dict_last
)
7766 space_dict_last
= chain_entry
;
7768 if (space_dict_root
== NULL
)
7769 space_dict_root
= chain_entry
;
7772 sd_chain_struct
*chain_pointer
;
7773 sd_chain_struct
*prev_chain_pointer
;
7775 chain_pointer
= space_dict_root
;
7776 prev_chain_pointer
= NULL
;
7778 while (chain_pointer
)
7780 prev_chain_pointer
= chain_pointer
;
7781 chain_pointer
= chain_pointer
->sd_next
;
7784 /* At this point we've found the correct place to add the new
7785 entry. So add it and update the linked lists as appropriate. */
7786 if (prev_chain_pointer
)
7788 chain_entry
->sd_next
= chain_pointer
;
7789 prev_chain_pointer
->sd_next
= chain_entry
;
7793 space_dict_root
= chain_entry
;
7794 chain_entry
->sd_next
= chain_pointer
;
7797 if (chain_entry
->sd_next
== NULL
)
7798 space_dict_last
= chain_entry
;
7801 /* This is here to catch predefined spaces which do not get
7802 modified by the user's input. Another call is found at
7803 the bottom of pa_parse_space_stmt to handle cases where
7804 the user modifies a predefined space. */
7805 #ifdef obj_set_section_attributes
7806 obj_set_section_attributes (seg
, defined
, private, sort
, spnum
);
7812 /* Create a new subspace NAME, with the appropriate flags as defined
7813 by the given parameters.
7815 Add the new subspace to the subspace dictionary chain in numerical
7816 order as defined by the SORT entries. */
7818 static ssd_chain_struct
*
7819 create_new_subspace (space
, name
, loadable
, code_only
, common
,
7820 dup_common
, is_zero
, sort
, access
, space_index
,
7821 alignment
, quadrant
, seg
)
7822 sd_chain_struct
*space
;
7824 int loadable
, code_only
, common
, dup_common
, is_zero
;
7832 ssd_chain_struct
*chain_entry
;
7834 chain_entry
= (ssd_chain_struct
*) xmalloc (sizeof (ssd_chain_struct
));
7836 as_fatal (_("Out of memory: could not allocate new subspace chain entry: %s\n"), name
);
7838 SUBSPACE_NAME (chain_entry
) = (char *) xmalloc (strlen (name
) + 1);
7839 strcpy (SUBSPACE_NAME (chain_entry
), name
);
7841 /* Initialize subspace_defined. When we hit a .subspace directive
7842 we'll set it to 1 which "locks-in" the subspace attributes. */
7843 SUBSPACE_DEFINED (chain_entry
) = 0;
7845 chain_entry
->ssd_subseg
= 0;
7846 chain_entry
->ssd_seg
= seg
;
7847 chain_entry
->ssd_next
= NULL
;
7849 /* Find spot for the new subspace based on its sort key. */
7850 if (space
->sd_subspaces
== NULL
)
7851 space
->sd_subspaces
= chain_entry
;
7854 ssd_chain_struct
*chain_pointer
;
7855 ssd_chain_struct
*prev_chain_pointer
;
7857 chain_pointer
= space
->sd_subspaces
;
7858 prev_chain_pointer
= NULL
;
7860 while (chain_pointer
)
7862 prev_chain_pointer
= chain_pointer
;
7863 chain_pointer
= chain_pointer
->ssd_next
;
7866 /* Now we have somewhere to put the new entry. Insert it and update
7868 if (prev_chain_pointer
)
7870 chain_entry
->ssd_next
= chain_pointer
;
7871 prev_chain_pointer
->ssd_next
= chain_entry
;
7875 space
->sd_subspaces
= chain_entry
;
7876 chain_entry
->ssd_next
= chain_pointer
;
7880 #ifdef obj_set_subsection_attributes
7881 obj_set_subsection_attributes (seg
, space
->sd_seg
, access
,
7888 /* Update the information for the given subspace based upon the
7889 various arguments. Return the modified subspace chain entry. */
7891 static ssd_chain_struct
*
7892 update_subspace (space
, name
, loadable
, code_only
, common
, dup_common
, sort
,
7893 zero
, access
, space_index
, alignment
, quadrant
, section
)
7894 sd_chain_struct
*space
;
7908 ssd_chain_struct
*chain_entry
;
7910 chain_entry
= is_defined_subspace (name
);
7912 #ifdef obj_set_subsection_attributes
7913 obj_set_subsection_attributes (section
, space
->sd_seg
, access
,
7920 /* Return the space chain entry for the space with the name NAME or
7921 NULL if no such space exists. */
7923 static sd_chain_struct
*
7924 is_defined_space (name
)
7927 sd_chain_struct
*chain_pointer
;
7929 for (chain_pointer
= space_dict_root
;
7931 chain_pointer
= chain_pointer
->sd_next
)
7933 if (strcmp (SPACE_NAME (chain_pointer
), name
) == 0)
7934 return chain_pointer
;
7937 /* No mapping from segment to space was found. Return NULL. */
7941 /* Find and return the space associated with the given seg. If no mapping
7942 from the given seg to a space is found, then return NULL.
7944 Unlike subspaces, the number of spaces is not expected to grow much,
7945 so a linear exhaustive search is OK here. */
7947 static sd_chain_struct
*
7948 pa_segment_to_space (seg
)
7951 sd_chain_struct
*space_chain
;
7953 /* Walk through each space looking for the correct mapping. */
7954 for (space_chain
= space_dict_root
;
7956 space_chain
= space_chain
->sd_next
)
7958 if (space_chain
->sd_seg
== seg
)
7962 /* Mapping was not found. Return NULL. */
7966 /* Return the space chain entry for the subspace with the name NAME or
7967 NULL if no such subspace exists.
7969 Uses a linear search through all the spaces and subspaces, this may
7970 not be appropriate if we ever being placing each function in its
7973 static ssd_chain_struct
*
7974 is_defined_subspace (name
)
7977 sd_chain_struct
*space_chain
;
7978 ssd_chain_struct
*subspace_chain
;
7980 /* Walk through each space. */
7981 for (space_chain
= space_dict_root
;
7983 space_chain
= space_chain
->sd_next
)
7985 /* Walk through each subspace looking for a name which matches. */
7986 for (subspace_chain
= space_chain
->sd_subspaces
;
7988 subspace_chain
= subspace_chain
->ssd_next
)
7989 if (strcmp (SUBSPACE_NAME (subspace_chain
), name
) == 0)
7990 return subspace_chain
;
7993 /* Subspace wasn't found. Return NULL. */
7997 /* Find and return the subspace associated with the given seg. If no
7998 mapping from the given seg to a subspace is found, then return NULL.
8000 If we ever put each procedure/function within its own subspace
8001 (to make life easier on the compiler and linker), then this will have
8002 to become more efficient. */
8004 static ssd_chain_struct
*
8005 pa_subsegment_to_subspace (seg
, subseg
)
8009 sd_chain_struct
*space_chain
;
8010 ssd_chain_struct
*subspace_chain
;
8012 /* Walk through each space. */
8013 for (space_chain
= space_dict_root
;
8015 space_chain
= space_chain
->sd_next
)
8017 if (space_chain
->sd_seg
== seg
)
8019 /* Walk through each subspace within each space looking for
8020 the correct mapping. */
8021 for (subspace_chain
= space_chain
->sd_subspaces
;
8023 subspace_chain
= subspace_chain
->ssd_next
)
8024 if (subspace_chain
->ssd_subseg
== (int) subseg
)
8025 return subspace_chain
;
8029 /* No mapping from subsegment to subspace found. Return NULL. */
8033 /* Given a number, try and find a space with the name number.
8035 Return a pointer to a space dictionary chain entry for the space
8036 that was found or NULL on failure. */
8038 static sd_chain_struct
*
8039 pa_find_space_by_number (number
)
8042 sd_chain_struct
*space_chain
;
8044 for (space_chain
= space_dict_root
;
8046 space_chain
= space_chain
->sd_next
)
8048 if (SPACE_SPNUM (space_chain
) == (unsigned int) number
)
8052 /* No appropriate space found. Return NULL. */
8056 /* Return the starting address for the given subspace. If the starting
8057 address is unknown then return zero. */
8060 pa_subspace_start (space
, quadrant
)
8061 sd_chain_struct
*space
;
8064 /* FIXME. Assumes everyone puts read/write data at 0x4000000, this
8065 is not correct for the PA OSF1 port. */
8066 if ((strcmp (SPACE_NAME (space
), "$PRIVATE$") == 0) && quadrant
== 1)
8068 else if (space
->sd_seg
== data_section
&& quadrant
== 1)
8075 /* FIXME. Needs documentation. */
8077 pa_next_subseg (space
)
8078 sd_chain_struct
*space
;
8081 space
->sd_last_subseg
++;
8082 return space
->sd_last_subseg
;
8086 /* Helper function for pa_stringer. Used to find the end of
8093 unsigned int c
= *s
& CHAR_MASK
;
8106 /* Handle a .STRING type pseudo-op. */
8109 pa_stringer (append_zero
)
8112 char *s
, num_buf
[4];
8116 /* Preprocess the string to handle PA-specific escape sequences.
8117 For example, \xDD where DD is a hexadecimal number should be
8118 changed to \OOO where OOO is an octal number. */
8121 /* We must have a valid space and subspace. */
8122 pa_check_current_space_and_subspace ();
8125 /* Skip the opening quote. */
8126 s
= input_line_pointer
+ 1;
8128 while (is_a_char (c
= pa_stringer_aux (s
++)))
8135 /* Handle \x<num>. */
8138 unsigned int number
;
8143 /* Get past the 'x'. */
8145 for (num_digit
= 0, number
= 0, dg
= *s
;
8147 && (isdigit (dg
) || (dg
>= 'a' && dg
<= 'f')
8148 || (dg
>= 'A' && dg
<= 'F'));
8152 number
= number
* 16 + dg
- '0';
8153 else if (dg
>= 'a' && dg
<= 'f')
8154 number
= number
* 16 + dg
- 'a' + 10;
8156 number
= number
* 16 + dg
- 'A' + 10;
8166 sprintf (num_buf
, "%02o", number
);
8169 sprintf (num_buf
, "%03o", number
);
8172 for (i
= 0; i
<= num_digit
; i
++)
8173 s_start
[i
] = num_buf
[i
];
8177 /* This might be a "\"", skip over the escaped char. */
8184 stringer (append_zero
);
8185 pa_undefine_label ();
8188 /* Handle a .VERSION pseudo-op. */
8192 int unused ATTRIBUTE_UNUSED
;
8195 pa_undefine_label ();
8200 /* Handle a .COMPILER pseudo-op. */
8203 pa_compiler (unused
)
8204 int unused ATTRIBUTE_UNUSED
;
8206 obj_som_compiler (0);
8207 pa_undefine_label ();
8212 /* Handle a .COPYRIGHT pseudo-op. */
8215 pa_copyright (unused
)
8216 int unused ATTRIBUTE_UNUSED
;
8219 pa_undefine_label ();
8222 /* Just like a normal cons, but when finished we have to undefine
8223 the latest space label. */
8230 pa_undefine_label ();
8233 /* Like float_cons, but we need to undefine our label. */
8236 pa_float_cons (float_type
)
8239 float_cons (float_type
);
8240 pa_undefine_label ();
8243 /* Like s_fill, but delete our label when finished. */
8247 int unused ATTRIBUTE_UNUSED
;
8250 /* We must have a valid space and subspace. */
8251 pa_check_current_space_and_subspace ();
8255 pa_undefine_label ();
8258 /* Like lcomm, but delete our label when finished. */
8261 pa_lcomm (needs_align
)
8265 /* We must have a valid space and subspace. */
8266 pa_check_current_space_and_subspace ();
8269 s_lcomm (needs_align
);
8270 pa_undefine_label ();
8273 /* Like lsym, but delete our label when finished. */
8277 int unused ATTRIBUTE_UNUSED
;
8280 /* We must have a valid space and subspace. */
8281 pa_check_current_space_and_subspace ();
8285 pa_undefine_label ();
8288 /* On the PA relocations which involve function symbols must not be
8289 adjusted. This so that the linker can know when/how to create argument
8290 relocation stubs for indirect calls and calls to static functions.
8292 "T" field selectors create DLT relative fixups for accessing
8293 globals and statics in PIC code; each DLT relative fixup creates
8294 an entry in the DLT table. The entries contain the address of
8295 the final target (eg accessing "foo" would create a DLT entry
8296 with the address of "foo").
8298 Unfortunately, the HP linker doesn't take into account any addend
8299 when generating the DLT; so accessing $LIT$+8 puts the address of
8300 $LIT$ into the DLT rather than the address of $LIT$+8.
8302 The end result is we can't perform relocation symbol reductions for
8303 any fixup which creates entries in the DLT (eg they use "T" field
8306 Reject reductions involving symbols with external scope; such
8307 reductions make life a living hell for object file editors.
8309 FIXME. Also reject R_HPPA relocations which are 32bits wide in
8310 the code space. The SOM BFD backend doesn't know how to pull the
8311 right bits out of an instruction. */
8314 hppa_fix_adjustable (fixp
)
8317 struct hppa_fix_struct
*hppa_fix
;
8319 hppa_fix
= (struct hppa_fix_struct
*) fixp
->tc_fix_data
;
8322 /* Reject reductions of symbols in 32bit relocs. */
8323 if (fixp
->fx_r_type
== R_HPPA
&& hppa_fix
->fx_r_format
== 32)
8328 if (fixp
->fx_r_type
== (int) R_PARISC_GNU_VTINHERIT
8329 || fixp
->fx_r_type
== (int) R_PARISC_GNU_VTENTRY
)
8333 /* Reject reductions of symbols in sym1-sym2 expressions when
8334 the fixup will occur in a CODE subspace.
8336 XXX FIXME: Long term we probably want to reject all of these;
8337 for example reducing in the debug section would lose if we ever
8338 supported using the optimizing hp linker. */
8341 && (hppa_fix
->segment
->flags
& SEC_CODE
))
8343 /* Apparently sy_used_in_reloc never gets set for sub symbols. */
8344 symbol_mark_used_in_reloc (fixp
->fx_subsy
);
8348 /* We can't adjust any relocs that use LR% and RR% field selectors.
8350 If a symbol is reduced to a section symbol, the assembler will
8351 adjust the addend unless the symbol happens to reside right at
8352 the start of the section. Additionally, the linker has no choice
8353 but to manipulate the addends when coalescing input sections for
8354 "ld -r". Since an LR% field selector is defined to round the
8355 addend, we can't change the addend without risking that a LR% and
8356 it's corresponding (possible multiple) RR% field will no longer
8357 sum to the right value.
8360 . ldil LR%foo+0,%r21
8361 . ldw RR%foo+0(%r21),%r26
8362 . ldw RR%foo+4(%r21),%r25
8364 If foo is at address 4092 (decimal) in section `sect', then after
8365 reducing to the section symbol we get
8366 . LR%sect+4092 == (L%sect)+0
8367 . RR%sect+4092 == (R%sect)+4092
8368 . RR%sect+4096 == (R%sect)-4096
8369 and the last address loses because rounding the addend to 8k
8370 mutiples takes us up to 8192 with an offset of -4096.
8372 In cases where the LR% expression is identical to the RR% one we
8373 will never have a problem, but is so happens that gcc rounds
8374 addends involved in LR% field selectors to work around a HP
8375 linker bug. ie. We often have addresses like the last case
8376 above where the LR% expression is offset from the RR% one. */
8378 if (hppa_fix
->fx_r_field
== e_lrsel
8379 || hppa_fix
->fx_r_field
== e_rrsel
8380 || hppa_fix
->fx_r_field
== e_nlrsel
)
8383 /* Reject reductions of symbols in DLT relative relocs,
8384 relocations with plabels. */
8385 if (hppa_fix
->fx_r_field
== e_tsel
8386 || hppa_fix
->fx_r_field
== e_ltsel
8387 || hppa_fix
->fx_r_field
== e_rtsel
8388 || hppa_fix
->fx_r_field
== e_psel
8389 || hppa_fix
->fx_r_field
== e_rpsel
8390 || hppa_fix
->fx_r_field
== e_lpsel
)
8393 if (fixp
->fx_addsy
&& (S_IS_EXTERNAL (fixp
->fx_addsy
)
8394 || S_IS_WEAK (fixp
->fx_addsy
)))
8397 /* Reject absolute calls (jumps). */
8398 if (hppa_fix
->fx_r_type
== R_HPPA_ABS_CALL
)
8401 /* Reject reductions of function symbols. */
8402 if (fixp
->fx_addsy
== 0 || ! S_IS_FUNCTION (fixp
->fx_addsy
))
8408 /* Return nonzero if the fixup in FIXP will require a relocation,
8409 even it if appears that the fixup could be completely handled
8413 hppa_force_relocation (fixp
)
8416 struct hppa_fix_struct
*hppa_fixp
;
8419 hppa_fixp
= (struct hppa_fix_struct
*) fixp
->tc_fix_data
;
8421 if (fixp
->fx_r_type
== (int) R_HPPA_ENTRY
8422 || fixp
->fx_r_type
== (int) R_HPPA_EXIT
8423 || fixp
->fx_r_type
== (int) R_HPPA_BEGIN_BRTAB
8424 || fixp
->fx_r_type
== (int) R_HPPA_END_BRTAB
8425 || fixp
->fx_r_type
== (int) R_HPPA_BEGIN_TRY
8426 || fixp
->fx_r_type
== (int) R_HPPA_END_TRY
8427 || (fixp
->fx_addsy
!= NULL
&& fixp
->fx_subsy
!= NULL
8428 && (hppa_fixp
->segment
->flags
& SEC_CODE
) != 0))
8432 if (fixp
->fx_r_type
== (int) R_PARISC_GNU_VTINHERIT
8433 || fixp
->fx_r_type
== (int) R_PARISC_GNU_VTENTRY
)
8437 /* It is necessary to force PC-relative calls/jumps to have a relocation
8438 entry if they're going to need either a argument relocation or long
8439 call stub. FIXME. Can't we need the same for absolute calls? */
8440 if (fixp
->fx_pcrel
&& fixp
->fx_addsy
8441 && (arg_reloc_stub_needed (symbol_arg_reloc_info (fixp
->fx_addsy
),
8442 hppa_fixp
->fx_arg_reloc
)))
8445 distance
= (fixp
->fx_offset
+ S_GET_VALUE (fixp
->fx_addsy
)
8446 - md_pcrel_from (fixp
));
8447 /* Now check and see if we're going to need a long-branch stub. */
8448 if (fixp
->fx_r_type
== (int) R_HPPA_PCREL_CALL
8449 && (distance
> 262143 || distance
< -262144))
8452 if (fixp
->fx_r_type
== (int) R_HPPA_ABS_CALL
)
8455 /* No need (yet) to force another relocations to be emitted. */
8459 /* Now for some ELF specific code. FIXME. */
8461 /* Mark the end of a function so that it's possible to compute
8462 the size of the function in hppa_elf_final_processing. */
8465 hppa_elf_mark_end_of_function ()
8467 /* ELF does not have EXIT relocations. All we do is create a
8468 temporary symbol marking the end of the function. */
8471 if (last_call_info
== NULL
|| last_call_info
->start_symbol
== NULL
)
8473 /* We have already warned about a missing label,
8474 or other problems. */
8478 name
= (char *) xmalloc (strlen ("L$\001end_")
8479 + strlen (S_GET_NAME (last_call_info
->start_symbol
))
8485 strcpy (name
, "L$\001end_");
8486 strcat (name
, S_GET_NAME (last_call_info
->start_symbol
));
8488 /* If we have a .exit followed by a .procend, then the
8489 symbol will have already been defined. */
8490 symbolP
= symbol_find (name
);
8493 /* The symbol has already been defined! This can
8494 happen if we have a .exit followed by a .procend.
8496 This is *not* an error. All we want to do is free
8497 the memory we just allocated for the name and continue. */
8502 /* symbol value should be the offset of the
8503 last instruction of the function */
8504 symbolP
= symbol_new (name
, now_seg
, (valueT
) (frag_now_fix () - 4),
8508 S_CLEAR_EXTERNAL (symbolP
);
8509 symbol_table_insert (symbolP
);
8513 last_call_info
->end_symbol
= symbolP
;
8515 as_bad (_("Symbol '%s' could not be created."), name
);
8519 as_bad (_("No memory for symbol name."));
8523 /* For ELF, this function serves one purpose: to setup the st_size
8524 field of STT_FUNC symbols. To do this, we need to scan the
8525 call_info structure list, determining st_size in by taking the
8526 difference in the address of the beginning/end marker symbols. */
8529 elf_hppa_final_processing ()
8531 struct call_info
*call_info_pointer
;
8533 for (call_info_pointer
= call_info_root
;
8535 call_info_pointer
= call_info_pointer
->ci_next
)
8537 elf_symbol_type
*esym
8538 = ((elf_symbol_type
*)
8539 symbol_get_bfdsym (call_info_pointer
->start_symbol
));
8540 esym
->internal_elf_sym
.st_size
=
8541 S_GET_VALUE (call_info_pointer
->end_symbol
)
8542 - S_GET_VALUE (call_info_pointer
->start_symbol
) + 4;
8549 if (debug_type
== DEBUG_DWARF2
)
8554 pa_vtable_entry (ignore
)
8555 int ignore ATTRIBUTE_UNUSED
;
8557 struct fix
*new_fix
;
8559 new_fix
= obj_elf_vtable_entry (0);
8563 struct hppa_fix_struct
*hppa_fix
= (struct hppa_fix_struct
*)
8564 obstack_alloc (¬es
, sizeof (struct hppa_fix_struct
));
8565 hppa_fix
->fx_r_type
= R_HPPA
;
8566 hppa_fix
->fx_r_field
= e_fsel
;
8567 hppa_fix
->fx_r_format
= 32;
8568 hppa_fix
->fx_arg_reloc
= 0;
8569 hppa_fix
->segment
= now_seg
;
8570 new_fix
->tc_fix_data
= (void *) hppa_fix
;
8571 new_fix
->fx_r_type
= (int) R_PARISC_GNU_VTENTRY
;
8576 pa_vtable_inherit (ignore
)
8577 int ignore ATTRIBUTE_UNUSED
;
8579 struct fix
*new_fix
;
8581 new_fix
= obj_elf_vtable_inherit (0);
8585 struct hppa_fix_struct
*hppa_fix
= (struct hppa_fix_struct
*)
8586 obstack_alloc (¬es
, sizeof (struct hppa_fix_struct
));
8587 hppa_fix
->fx_r_type
= R_HPPA
;
8588 hppa_fix
->fx_r_field
= e_fsel
;
8589 hppa_fix
->fx_r_format
= 32;
8590 hppa_fix
->fx_arg_reloc
= 0;
8591 hppa_fix
->segment
= now_seg
;
8592 new_fix
->tc_fix_data
= (void *) hppa_fix
;
8593 new_fix
->fx_r_type
= (int) R_PARISC_GNU_VTINHERIT
;