1 /* tc-s390.c -- Assemble for the S390
2 Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
3 2009, 2010 Free Software Foundation, Inc.
4 Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
6 This file is part of GAS, the GNU Assembler.
8 GAS is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GAS is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GAS; see the file COPYING. If not, write to the Free
20 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
24 #include "safe-ctype.h"
26 #include "struc-symbol.h"
27 #include "dwarf2dbg.h"
28 #include "dw2gencfi.h"
30 #include "opcode/s390.h"
33 /* The default architecture. */
35 #define DEFAULT_ARCH "s390"
37 static char *default_arch
= DEFAULT_ARCH
;
38 /* Either 32 or 64, selects file format. */
39 static int s390_arch_size
= 0;
41 /* If no -march option was given default to the highest available CPU.
42 Since with S/390 a newer CPU always supports everything from its
43 predecessors this will accept every valid asm input. */
44 static unsigned int current_cpu
= S390_OPCODE_MAXCPU
- 1;
45 static unsigned int current_mode_mask
= 0;
47 /* Whether to use user friendly register names. Default is TRUE. */
48 #ifndef TARGET_REG_NAMES_P
49 #define TARGET_REG_NAMES_P TRUE
52 static bfd_boolean reg_names_p
= TARGET_REG_NAMES_P
;
54 /* Set to TRUE if we want to warn about zero base/index registers. */
55 static bfd_boolean warn_areg_zero
= FALSE
;
57 /* Generic assembler global variables which must be defined by all
60 const char comment_chars
[] = "#";
62 /* Characters which start a comment at the beginning of a line. */
63 const char line_comment_chars
[] = "#";
65 /* Characters which may be used to separate multiple commands on a
67 const char line_separator_chars
[] = ";";
69 /* Characters which are used to indicate an exponent in a floating
71 const char EXP_CHARS
[] = "eE";
73 /* Characters which mean that a number is a floating point constant,
75 const char FLT_CHARS
[] = "dD";
77 /* The dwarf2 data alignment, adjusted for 32 or 64 bit. */
78 int s390_cie_data_alignment
;
80 /* The target specific pseudo-ops which we support. */
82 /* Define the prototypes for the pseudo-ops */
83 static void s390_byte (int);
84 static void s390_elf_cons (int);
85 static void s390_bss (int);
86 static void s390_insn (int);
87 static void s390_literals (int);
88 static void s390_machine (int);
90 const pseudo_typeS md_pseudo_table
[] =
92 { "align", s_align_bytes
, 0 },
93 /* Pseudo-ops which must be defined. */
94 { "bss", s390_bss
, 0 },
95 { "insn", s390_insn
, 0 },
96 /* Pseudo-ops which must be overridden. */
97 { "byte", s390_byte
, 0 },
98 { "short", s390_elf_cons
, 2 },
99 { "long", s390_elf_cons
, 4 },
100 { "quad", s390_elf_cons
, 8 },
101 { "ltorg", s390_literals
, 0 },
102 { "string", stringer
, 8 + 1 },
103 { "machine", s390_machine
, 0 },
108 /* Structure to hold information about predefined registers. */
115 /* List of registers that are pre-defined:
117 Each access register has a predefined name of the form:
118 a<reg_num> which has the value <reg_num>.
120 Each control register has a predefined name of the form:
121 c<reg_num> which has the value <reg_num>.
123 Each general register has a predefined name of the form:
124 r<reg_num> which has the value <reg_num>.
126 Each floating point register a has predefined name of the form:
127 f<reg_num> which has the value <reg_num>.
129 There are individual registers as well:
133 The table is sorted. Suitable for searching by a binary search. */
135 static const struct pd_reg pre_defined_registers
[] =
137 { "a0", 0 }, /* Access registers */
154 { "c0", 0 }, /* Control registers */
171 { "f0", 0 }, /* Floating point registers */
188 { "lit", 13 }, /* Pointer to literal pool */
190 { "r0", 0 }, /* General purpose registers */
207 { "sp", 15 }, /* Stack pointer */
211 #define REG_NAME_CNT (sizeof (pre_defined_registers) / sizeof (struct pd_reg))
213 /* Given NAME, find the register number associated with that name, return
214 the integer value associated with the given name or -1 on failure. */
217 reg_name_search (const struct pd_reg
*regs
, int regcount
, const char *name
)
219 int middle
, low
, high
;
227 middle
= (low
+ high
) / 2;
228 cmp
= strcasecmp (name
, regs
[middle
].name
);
234 return regs
[middle
].value
;
243 * Summary of register_name().
245 * in: Input_line_pointer points to 1st char of operand.
247 * out: A expressionS.
248 * The operand may have been a register: in this case, X_op == O_register,
249 * X_add_number is set to the register number, and truth is returned.
250 * Input_line_pointer->(next non-blank) char after operand, or is in its
255 register_name (expressionS
*expressionP
)
262 /* Find the spelling of the operand. */
263 start
= name
= input_line_pointer
;
264 if (name
[0] == '%' && ISALPHA (name
[1]))
265 name
= ++input_line_pointer
;
269 c
= get_symbol_end ();
270 reg_number
= reg_name_search (pre_defined_registers
, REG_NAME_CNT
, name
);
272 /* Put back the delimiting char. */
273 *input_line_pointer
= c
;
275 /* Look to see if it's in the register table. */
278 expressionP
->X_op
= O_register
;
279 expressionP
->X_add_number
= reg_number
;
281 /* Make the rest nice. */
282 expressionP
->X_add_symbol
= NULL
;
283 expressionP
->X_op_symbol
= NULL
;
287 /* Reset the line as if we had not done anything. */
288 input_line_pointer
= start
;
292 /* Local variables. */
294 /* Opformat hash table. */
295 static struct hash_control
*s390_opformat_hash
;
297 /* Opcode hash table. */
298 static struct hash_control
*s390_opcode_hash
= NULL
;
300 /* Flags to set in the elf header */
301 static flagword s390_flags
= 0;
303 symbolS
*GOT_symbol
; /* Pre-defined "_GLOBAL_OFFSET_TABLE_" */
305 #ifndef WORKING_DOT_WORD
306 int md_short_jump_size
= 4;
307 int md_long_jump_size
= 4;
310 const char *md_shortopts
= "A:m:kVQ:";
311 struct option md_longopts
[] = {
312 {NULL
, no_argument
, NULL
, 0}
314 size_t md_longopts_size
= sizeof (md_longopts
);
316 /* Initialize the default opcode arch and word size from the default
317 architecture name if not specified by an option. */
319 init_default_arch (void)
321 if (strcmp (default_arch
, "s390") == 0)
323 if (s390_arch_size
== 0)
326 else if (strcmp (default_arch
, "s390x") == 0)
328 if (s390_arch_size
== 0)
332 as_fatal (_("Invalid default architecture, broken assembler."));
334 if (current_mode_mask
== 0)
336 /* Default to z/Architecture mode if the CPU supports it. */
337 if (current_cpu
< S390_OPCODE_Z900
)
338 current_mode_mask
= 1 << S390_OPCODE_ESA
;
340 current_mode_mask
= 1 << S390_OPCODE_ZARCH
;
344 /* Called by TARGET_FORMAT. */
346 s390_target_format (void)
348 /* We don't get a chance to initialize anything before we're called,
349 so handle that now. */
350 init_default_arch ();
352 return s390_arch_size
== 64 ? "elf64-s390" : "elf32-s390";
355 /* Map a CPU string as given with -march= or .machine to the
356 respective enum s390_opcode_cpu_val value. 0xffffffff is returned
357 in case of an error. */
360 s390_parse_cpu (char *arg
)
362 if (strcmp (arg
, "g5") == 0)
363 return S390_OPCODE_G5
;
364 else if (strcmp (arg
, "g6") == 0)
365 return S390_OPCODE_G6
;
366 else if (strcmp (arg
, "z900") == 0)
367 return S390_OPCODE_Z900
;
368 else if (strcmp (arg
, "z990") == 0)
369 return S390_OPCODE_Z990
;
370 else if (strcmp (arg
, "z9-109") == 0)
371 return S390_OPCODE_Z9_109
;
372 else if (strcmp (arg
, "z9-ec") == 0)
373 return S390_OPCODE_Z9_EC
;
374 else if (strcmp (arg
, "z10") == 0)
375 return S390_OPCODE_Z10
;
376 else if (strcmp (arg
, "z196") == 0)
377 return S390_OPCODE_Z196
;
378 else if (strcmp (arg
, "all") == 0)
379 return S390_OPCODE_MAXCPU
- 1;
385 md_parse_option (int c
, char *arg
)
389 /* -k: Ignore for FreeBSD compatibility. */
393 if (arg
!= NULL
&& strcmp (arg
, "regnames") == 0)
396 else if (arg
!= NULL
&& strcmp (arg
, "no-regnames") == 0)
399 else if (arg
!= NULL
&& strcmp (arg
, "warn-areg-zero") == 0)
400 warn_areg_zero
= TRUE
;
402 else if (arg
!= NULL
&& strcmp (arg
, "31") == 0)
405 else if (arg
!= NULL
&& strcmp (arg
, "64") == 0)
408 else if (arg
!= NULL
&& strcmp (arg
, "esa") == 0)
409 current_mode_mask
= 1 << S390_OPCODE_ESA
;
411 else if (arg
!= NULL
&& strcmp (arg
, "zarch") == 0)
412 current_mode_mask
= 1 << S390_OPCODE_ZARCH
;
414 else if (arg
!= NULL
&& strncmp (arg
, "arch=", 5) == 0)
416 current_cpu
= s390_parse_cpu (arg
+ 5);
418 if (current_cpu
== (unsigned int)-1)
420 as_bad (_("invalid switch -m%s"), arg
);
427 as_bad (_("invalid switch -m%s"), arg
);
433 /* Option -A is deprecated. Still available for compatibility. */
434 if (arg
!= NULL
&& strcmp (arg
, "esa") == 0)
435 current_cpu
= S390_OPCODE_G5
;
436 else if (arg
!= NULL
&& strcmp (arg
, "esame") == 0)
437 current_cpu
= S390_OPCODE_Z900
;
439 as_bad (_("invalid architecture -A%s"), arg
);
442 /* -V: SVR4 argument to print version ID. */
447 /* -Qy, -Qn: SVR4 arguments controlling whether a .comment section
448 should be emitted or not. FIXME: Not implemented. */
460 md_show_usage (FILE *stream
)
462 fprintf (stream
, _("\
464 -mregnames Allow symbolic names for registers\n\
465 -mwarn-areg-zero Warn about zero base/index registers\n\
466 -mno-regnames Do not allow symbolic names for registers\n\
467 -m31 Set file format to 31 bit format\n\
468 -m64 Set file format to 64 bit format\n"));
469 fprintf (stream
, _("\
470 -V print assembler version number\n\
471 -Qy, -Qn ignored\n"));
474 /* Generate the hash table mapping mnemonics to struct s390_opcode.
475 This table is built at startup and whenever the CPU level is
476 changed using .machine. */
479 s390_setup_opcodes (void)
481 register const struct s390_opcode
*op
;
482 const struct s390_opcode
*op_end
;
483 bfd_boolean dup_insn
= FALSE
;
486 if (s390_opcode_hash
!= NULL
)
487 hash_die (s390_opcode_hash
);
489 /* Insert the opcodes into a hash table. */
490 s390_opcode_hash
= hash_new ();
492 op_end
= s390_opcodes
+ s390_num_opcodes
;
493 for (op
= s390_opcodes
; op
< op_end
; op
++)
495 while (op
< op_end
- 1 && strcmp(op
->name
, op
[1].name
) == 0)
497 if (op
->min_cpu
<= current_cpu
&& (op
->modes
& current_mode_mask
))
502 if (op
->min_cpu
<= current_cpu
&& (op
->modes
& current_mode_mask
))
504 retval
= hash_insert (s390_opcode_hash
, op
->name
, (void *) op
);
505 if (retval
!= (const char *) NULL
)
507 as_bad (_("Internal assembler error for instruction %s"),
513 while (op
< op_end
- 1 && strcmp (op
->name
, op
[1].name
) == 0)
521 /* This function is called when the assembler starts up. It is called
522 after the options have been parsed and the output file has been
528 register const struct s390_opcode
*op
;
529 const struct s390_opcode
*op_end
;
530 bfd_boolean dup_insn
= FALSE
;
533 /* Give a warning if the combination -m64-bit and -Aesa is used. */
534 if (s390_arch_size
== 64 && current_cpu
< S390_OPCODE_Z900
)
535 as_warn (_("The 64 bit file format is used without esame instructions."));
537 s390_cie_data_alignment
= -s390_arch_size
/ 8;
539 /* Set the ELF flags if desired. */
541 bfd_set_private_flags (stdoutput
, s390_flags
);
543 /* Insert the opcode formats into a hash table. */
544 s390_opformat_hash
= hash_new ();
546 op_end
= s390_opformats
+ s390_num_opformats
;
547 for (op
= s390_opformats
; op
< op_end
; op
++)
549 retval
= hash_insert (s390_opformat_hash
, op
->name
, (void *) op
);
550 if (retval
!= (const char *) NULL
)
552 as_bad (_("Internal assembler error for instruction format %s"),
558 s390_setup_opcodes ();
560 record_alignment (text_section
, 2);
561 record_alignment (data_section
, 2);
562 record_alignment (bss_section
, 2);
565 /* Called after all assembly has been done. */
569 if (s390_arch_size
== 64)
570 bfd_set_arch_mach (stdoutput
, bfd_arch_s390
, bfd_mach_s390_64
);
572 bfd_set_arch_mach (stdoutput
, bfd_arch_s390
, bfd_mach_s390_31
);
575 /* Insert an operand value into an instruction. */
578 s390_insert_operand (unsigned char *insn
,
579 const struct s390_operand
*operand
,
587 if (operand
->flags
& (S390_OPERAND_SIGNED
|S390_OPERAND_PCREL
))
591 max
= ((offsetT
) 1 << (operand
->bits
- 1)) - 1;
592 min
= - ((offsetT
) 1 << (operand
->bits
- 1));
593 /* Halve PCREL operands. */
594 if (operand
->flags
& S390_OPERAND_PCREL
)
596 /* Check for underflow / overflow. */
597 if (val
< min
|| val
> max
)
600 _("operand out of range (%s not between %ld and %ld)");
603 if (operand
->flags
& S390_OPERAND_PCREL
)
609 sprint_value (buf
, val
);
610 if (file
== (char *) NULL
)
611 as_bad (err
, buf
, (int) min
, (int) max
);
613 as_bad_where (file
, line
, err
, buf
, (int) min
, (int) max
);
616 /* val is ok, now restrict it to operand->bits bits. */
617 uval
= (addressT
) val
& ((((addressT
) 1 << (operand
->bits
-1)) << 1) - 1);
618 /* val is restrict, now check for special case. */
619 if (operand
->bits
== 20 && operand
->shift
== 20)
620 uval
= (uval
>> 12) | ((uval
& 0xfff) << 8);
626 max
= (((addressT
) 1 << (operand
->bits
- 1)) << 1) - 1;
628 uval
= (addressT
) val
;
629 /* Length x in an instructions has real length x+1. */
630 if (operand
->flags
& S390_OPERAND_LENGTH
)
632 /* Check for underflow / overflow. */
633 if (uval
< min
|| uval
> max
)
635 if (operand
->flags
& S390_OPERAND_LENGTH
)
642 as_bad_value_out_of_range (_("operand"), uval
, (offsetT
) min
, (offsetT
) max
, file
, line
);
648 /* Insert fragments of the operand byte for byte. */
649 offset
= operand
->shift
+ operand
->bits
;
650 uval
<<= (-offset
) & 7;
651 insn
+= (offset
- 1) / 8;
663 bfd_reloc_code_real_type reloc
;
666 /* Parse tls marker and return the desired relocation. */
667 static bfd_reloc_code_real_type
668 s390_tls_suffix (char **str_p
, expressionS
*exp_p
)
670 static struct map_tls mapping
[] =
672 { "tls_load", 8, BFD_RELOC_390_TLS_LOAD
},
673 { "tls_gdcall", 10, BFD_RELOC_390_TLS_GDCALL
},
674 { "tls_ldcall", 10, BFD_RELOC_390_TLS_LDCALL
},
675 { NULL
, 0, BFD_RELOC_UNUSED
}
685 return BFD_RELOC_UNUSED
;
688 while (ISIDNUM (*str
))
692 return BFD_RELOC_UNUSED
;
694 orig_line
= input_line_pointer
;
695 input_line_pointer
= str
;
697 str
= input_line_pointer
;
698 if (&input_line_pointer
!= str_p
)
699 input_line_pointer
= orig_line
;
701 if (exp_p
->X_op
!= O_symbol
)
702 return BFD_RELOC_UNUSED
;
704 for (ptr
= &mapping
[0]; ptr
->length
> 0; ptr
++)
705 if (len
== ptr
->length
706 && strncasecmp (ident
, ptr
->string
, ptr
->length
) == 0)
708 /* Found a matching tls suffix. */
712 return BFD_RELOC_UNUSED
;
715 /* Structure used to hold suffixes. */
726 ELF_SUFFIX_TLS_GOTIE
,
738 elf_suffix_type suffix
;
742 /* Parse @got/@plt/@gotoff. and return the desired relocation. */
743 static elf_suffix_type
744 s390_elf_suffix (char **str_p
, expressionS
*exp_p
)
746 static struct map_bfd mapping
[] =
748 { "got", 3, ELF_SUFFIX_GOT
},
749 { "got12", 5, ELF_SUFFIX_GOT
},
750 { "plt", 3, ELF_SUFFIX_PLT
},
751 { "gotent", 6, ELF_SUFFIX_GOTENT
},
752 { "gotoff", 6, ELF_SUFFIX_GOTOFF
},
753 { "gotplt", 6, ELF_SUFFIX_GOTPLT
},
754 { "pltoff", 6, ELF_SUFFIX_PLTOFF
},
755 { "tlsgd", 5, ELF_SUFFIX_TLS_GD
},
756 { "gotntpoff", 9, ELF_SUFFIX_TLS_GOTIE
},
757 { "indntpoff", 9, ELF_SUFFIX_TLS_IE
},
758 { "tlsldm", 6, ELF_SUFFIX_TLS_LDM
},
759 { "dtpoff", 6, ELF_SUFFIX_TLS_LDO
},
760 { "ntpoff", 6, ELF_SUFFIX_TLS_LE
},
761 { NULL
, 0, ELF_SUFFIX_NONE
}
770 return ELF_SUFFIX_NONE
;
773 while (ISALNUM (*str
))
777 for (ptr
= &mapping
[0]; ptr
->length
> 0; ptr
++)
778 if (len
== ptr
->length
779 && strncasecmp (ident
, ptr
->string
, ptr
->length
) == 0)
781 if (exp_p
->X_add_number
!= 0)
782 as_warn (_("identifier+constant@%s means identifier@%s+constant"),
783 ptr
->string
, ptr
->string
);
784 /* Now check for identifier@suffix+constant. */
785 if (*str
== '-' || *str
== '+')
787 char *orig_line
= input_line_pointer
;
790 input_line_pointer
= str
;
791 expression (&new_exp
);
793 switch (new_exp
.X_op
)
795 case O_constant
: /* X_add_number (a constant expression). */
796 exp_p
->X_add_number
+= new_exp
.X_add_number
;
797 str
= input_line_pointer
;
799 case O_symbol
: /* X_add_symbol + X_add_number. */
800 /* this case is used for e.g. xyz@PLT+.Label. */
801 exp_p
->X_add_number
+= new_exp
.X_add_number
;
802 exp_p
->X_op_symbol
= new_exp
.X_add_symbol
;
804 str
= input_line_pointer
;
806 case O_uminus
: /* (- X_add_symbol) + X_add_number. */
807 /* this case is used for e.g. xyz@PLT-.Label. */
808 exp_p
->X_add_number
+= new_exp
.X_add_number
;
809 exp_p
->X_op_symbol
= new_exp
.X_add_symbol
;
810 exp_p
->X_op
= O_subtract
;
811 str
= input_line_pointer
;
817 /* If s390_elf_suffix has not been called with
818 &input_line_pointer as first parameter, we have
819 clobbered the input_line_pointer. We have to
821 if (&input_line_pointer
!= str_p
)
822 input_line_pointer
= orig_line
;
828 return BFD_RELOC_UNUSED
;
831 /* Structure used to hold a literal pool entry. */
834 struct s390_lpe
*next
;
836 FLONUM_TYPE floatnum
; /* used if X_op == O_big && X_add_number <= 0 */
837 LITTLENUM_TYPE bignum
[4]; /* used if X_op == O_big && X_add_number > 0 */
839 bfd_reloc_code_real_type reloc
;
843 static struct s390_lpe
*lpe_free_list
= NULL
;
844 static struct s390_lpe
*lpe_list
= NULL
;
845 static struct s390_lpe
*lpe_list_tail
= NULL
;
846 static symbolS
*lp_sym
= NULL
;
847 static int lp_count
= 0;
848 static int lpe_count
= 0;
851 s390_exp_compare (expressionS
*exp1
, expressionS
*exp2
)
853 if (exp1
->X_op
!= exp2
->X_op
)
858 case O_constant
: /* X_add_number must be equal. */
860 return exp1
->X_add_number
== exp2
->X_add_number
;
863 as_bad (_("Can't handle O_big in s390_exp_compare"));
865 case O_symbol
: /* X_add_symbol & X_add_number must be equal. */
870 return (exp1
->X_add_symbol
== exp2
->X_add_symbol
)
871 && (exp1
->X_add_number
== exp2
->X_add_number
);
873 case O_multiply
: /* X_add_symbol,X_op_symbol&X_add_number must be equal. */
878 case O_bit_inclusive_or
:
880 case O_bit_exclusive_or
:
892 return (exp1
->X_add_symbol
== exp2
->X_add_symbol
)
893 && (exp1
->X_op_symbol
== exp2
->X_op_symbol
)
894 && (exp1
->X_add_number
== exp2
->X_add_number
);
900 /* Test for @lit and if its present make an entry in the literal pool and
901 modify the current expression to be an offset into the literal pool. */
902 static elf_suffix_type
903 s390_lit_suffix (char **str_p
, expressionS
*exp_p
, elf_suffix_type suffix
)
905 bfd_reloc_code_real_type reloc
;
909 struct s390_lpe
*lpe
;
913 return suffix
; /* No modification. */
915 /* We look for a suffix of the form "@lit1", "@lit2", "@lit4" or "@lit8". */
917 while (ISALNUM (*str
))
920 if (len
!= 4 || strncasecmp (ident
, "lit", 3) != 0
921 || (ident
[3]!='1' && ident
[3]!='2' && ident
[3]!='4' && ident
[3]!='8'))
922 return suffix
; /* no modification */
923 nbytes
= ident
[3] - '0';
925 reloc
= BFD_RELOC_UNUSED
;
926 if (suffix
== ELF_SUFFIX_GOT
)
929 reloc
= BFD_RELOC_390_GOT16
;
930 else if (nbytes
== 4)
931 reloc
= BFD_RELOC_32_GOT_PCREL
;
932 else if (nbytes
== 8)
933 reloc
= BFD_RELOC_390_GOT64
;
935 else if (suffix
== ELF_SUFFIX_PLT
)
938 reloc
= BFD_RELOC_390_PLT32
;
939 else if (nbytes
== 8)
940 reloc
= BFD_RELOC_390_PLT64
;
943 if (suffix
!= ELF_SUFFIX_NONE
&& reloc
== BFD_RELOC_UNUSED
)
944 as_bad (_("Invalid suffix for literal pool entry"));
946 /* Search the pool if the new entry is a duplicate. */
947 if (exp_p
->X_op
== O_big
)
949 /* Special processing for big numbers. */
950 for (lpe
= lpe_list
; lpe
!= NULL
; lpe
= lpe
->next
)
952 if (lpe
->ex
.X_op
== O_big
)
954 if (exp_p
->X_add_number
<= 0 && lpe
->ex
.X_add_number
<= 0)
956 if (memcmp (&generic_floating_point_number
, &lpe
->floatnum
,
957 sizeof (FLONUM_TYPE
)) == 0)
960 else if (exp_p
->X_add_number
== lpe
->ex
.X_add_number
)
962 if (memcmp (generic_bignum
, lpe
->bignum
,
963 sizeof (LITTLENUM_TYPE
)*exp_p
->X_add_number
) == 0)
971 /* Processing for 'normal' data types. */
972 for (lpe
= lpe_list
; lpe
!= NULL
; lpe
= lpe
->next
)
973 if (lpe
->nbytes
== nbytes
&& lpe
->reloc
== reloc
974 && s390_exp_compare (exp_p
, &lpe
->ex
) != 0)
981 if (lpe_free_list
!= NULL
)
984 lpe_free_list
= lpe_free_list
->next
;
988 lpe
= (struct s390_lpe
*) xmalloc (sizeof (struct s390_lpe
));
993 if (exp_p
->X_op
== O_big
)
995 if (exp_p
->X_add_number
<= 0)
996 lpe
->floatnum
= generic_floating_point_number
;
997 else if (exp_p
->X_add_number
<= 4)
998 memcpy (lpe
->bignum
, generic_bignum
,
999 exp_p
->X_add_number
* sizeof (LITTLENUM_TYPE
));
1001 as_bad (_("Big number is too big"));
1004 lpe
->nbytes
= nbytes
;
1006 /* Literal pool name defined ? */
1009 sprintf (tmp_name
, ".L\001%i", lp_count
);
1010 lp_sym
= symbol_make (tmp_name
);
1013 /* Make name for literal pool entry. */
1014 sprintf (tmp_name
, ".L\001%i\002%i", lp_count
, lpe_count
);
1016 lpe
->sym
= symbol_make (tmp_name
);
1018 /* Add to literal pool list. */
1020 if (lpe_list_tail
!= NULL
)
1022 lpe_list_tail
->next
= lpe
;
1023 lpe_list_tail
= lpe
;
1026 lpe_list
= lpe_list_tail
= lpe
;
1029 /* Now change exp_p to the offset into the literal pool.
1030 Thats the expression: .L^Ax^By-.L^Ax */
1031 exp_p
->X_add_symbol
= lpe
->sym
;
1032 exp_p
->X_op_symbol
= lp_sym
;
1033 exp_p
->X_op
= O_subtract
;
1034 exp_p
->X_add_number
= 0;
1038 /* We change the suffix type to ELF_SUFFIX_NONE, because
1039 the difference of two local labels is just a number. */
1040 return ELF_SUFFIX_NONE
;
1043 /* Like normal .long/.short/.word, except support @got, etc.
1044 clobbers input_line_pointer, checks end-of-line. */
1046 s390_elf_cons (int nbytes
/* 1=.byte, 2=.word, 4=.long */)
1049 elf_suffix_type suffix
;
1051 if (is_it_end_of_statement ())
1053 demand_empty_rest_of_line ();
1061 if (exp
.X_op
== O_symbol
1062 && *input_line_pointer
== '@'
1063 && (suffix
= s390_elf_suffix (&input_line_pointer
, &exp
)) != ELF_SUFFIX_NONE
)
1065 bfd_reloc_code_real_type reloc
;
1066 reloc_howto_type
*reloc_howto
;
1072 static bfd_reloc_code_real_type tab2
[] =
1074 BFD_RELOC_UNUSED
, /* ELF_SUFFIX_NONE */
1075 BFD_RELOC_390_GOT16
, /* ELF_SUFFIX_GOT */
1076 BFD_RELOC_UNUSED
, /* ELF_SUFFIX_PLT */
1077 BFD_RELOC_UNUSED
, /* ELF_SUFFIX_GOTENT */
1078 BFD_RELOC_16_GOTOFF
, /* ELF_SUFFIX_GOTOFF */
1079 BFD_RELOC_UNUSED
, /* ELF_SUFFIX_GOTPLT */
1080 BFD_RELOC_390_PLTOFF16
, /* ELF_SUFFIX_PLTOFF */
1081 BFD_RELOC_UNUSED
, /* ELF_SUFFIX_TLS_GD */
1082 BFD_RELOC_UNUSED
, /* ELF_SUFFIX_TLS_GOTIE */
1083 BFD_RELOC_UNUSED
, /* ELF_SUFFIX_TLS_IE */
1084 BFD_RELOC_UNUSED
, /* ELF_SUFFIX_TLS_LDM */
1085 BFD_RELOC_UNUSED
, /* ELF_SUFFIX_TLS_LDO */
1086 BFD_RELOC_UNUSED
/* ELF_SUFFIX_TLS_LE */
1088 reloc
= tab2
[suffix
];
1090 else if (nbytes
== 4)
1092 static bfd_reloc_code_real_type tab4
[] =
1094 BFD_RELOC_UNUSED
, /* ELF_SUFFIX_NONE */
1095 BFD_RELOC_32_GOT_PCREL
, /* ELF_SUFFIX_GOT */
1096 BFD_RELOC_390_PLT32
, /* ELF_SUFFIX_PLT */
1097 BFD_RELOC_UNUSED
, /* ELF_SUFFIX_GOTENT */
1098 BFD_RELOC_32_GOTOFF
, /* ELF_SUFFIX_GOTOFF */
1099 BFD_RELOC_390_GOTPLT32
, /* ELF_SUFFIX_GOTPLT */
1100 BFD_RELOC_390_PLTOFF32
, /* ELF_SUFFIX_PLTOFF */
1101 BFD_RELOC_390_TLS_GD32
, /* ELF_SUFFIX_TLS_GD */
1102 BFD_RELOC_390_TLS_GOTIE32
, /* ELF_SUFFIX_TLS_GOTIE */
1103 BFD_RELOC_390_TLS_IE32
, /* ELF_SUFFIX_TLS_IE */
1104 BFD_RELOC_390_TLS_LDM32
, /* ELF_SUFFIX_TLS_LDM */
1105 BFD_RELOC_390_TLS_LDO32
, /* ELF_SUFFIX_TLS_LDO */
1106 BFD_RELOC_390_TLS_LE32
/* ELF_SUFFIX_TLS_LE */
1108 reloc
= tab4
[suffix
];
1110 else if (nbytes
== 8)
1112 static bfd_reloc_code_real_type tab8
[] =
1114 BFD_RELOC_UNUSED
, /* ELF_SUFFIX_NONE */
1115 BFD_RELOC_390_GOT64
, /* ELF_SUFFIX_GOT */
1116 BFD_RELOC_390_PLT64
, /* ELF_SUFFIX_PLT */
1117 BFD_RELOC_UNUSED
, /* ELF_SUFFIX_GOTENT */
1118 BFD_RELOC_390_GOTOFF64
, /* ELF_SUFFIX_GOTOFF */
1119 BFD_RELOC_390_GOTPLT64
, /* ELF_SUFFIX_GOTPLT */
1120 BFD_RELOC_390_PLTOFF64
, /* ELF_SUFFIX_PLTOFF */
1121 BFD_RELOC_390_TLS_GD64
, /* ELF_SUFFIX_TLS_GD */
1122 BFD_RELOC_390_TLS_GOTIE64
, /* ELF_SUFFIX_TLS_GOTIE */
1123 BFD_RELOC_390_TLS_IE64
, /* ELF_SUFFIX_TLS_IE */
1124 BFD_RELOC_390_TLS_LDM64
, /* ELF_SUFFIX_TLS_LDM */
1125 BFD_RELOC_390_TLS_LDO64
, /* ELF_SUFFIX_TLS_LDO */
1126 BFD_RELOC_390_TLS_LE64
/* ELF_SUFFIX_TLS_LE */
1128 reloc
= tab8
[suffix
];
1131 reloc
= BFD_RELOC_UNUSED
;
1133 if (reloc
!= BFD_RELOC_UNUSED
1134 && (reloc_howto
= bfd_reloc_type_lookup (stdoutput
, reloc
)))
1136 size
= bfd_get_reloc_size (reloc_howto
);
1138 as_bad (_("%s relocations do not fit in %d bytes"),
1139 reloc_howto
->name
, nbytes
);
1140 where
= frag_more (nbytes
);
1141 md_number_to_chars (where
, 0, size
);
1142 /* To make fixup_segment do the pc relative conversion the
1143 pcrel parameter on the fix_new_exp call needs to be FALSE. */
1144 fix_new_exp (frag_now
, where
- frag_now
->fr_literal
,
1145 size
, &exp
, FALSE
, reloc
);
1148 as_bad (_("relocation not applicable"));
1151 emit_expr (&exp
, (unsigned int) nbytes
);
1153 while (*input_line_pointer
++ == ',');
1155 input_line_pointer
--; /* Put terminator back into stream. */
1156 demand_empty_rest_of_line ();
1159 /* We need to keep a list of fixups. We can't simply generate them as
1160 we go, because that would require us to first create the frag, and
1161 that would screw up references to ``.''. */
1167 bfd_reloc_code_real_type reloc
;
1170 #define MAX_INSN_FIXUPS (4)
1172 /* This routine is called for each instruction to be assembled. */
1175 md_gather_operands (char *str
,
1176 unsigned char *insn
,
1177 const struct s390_opcode
*opcode
)
1179 struct s390_fixup fixups
[MAX_INSN_FIXUPS
];
1180 const struct s390_operand
*operand
;
1181 const unsigned char *opindex_ptr
;
1183 elf_suffix_type suffix
;
1184 bfd_reloc_code_real_type reloc
;
1189 while (ISSPACE (*str
))
1194 /* Gather the operands. */
1196 for (opindex_ptr
= opcode
->operands
; *opindex_ptr
!= 0; opindex_ptr
++)
1200 operand
= s390_operands
+ *opindex_ptr
;
1202 if (skip_optional
&& (operand
->flags
& S390_OPERAND_INDEX
))
1204 /* We do an early skip. For D(X,B) constructions the index
1205 register is skipped (X is optional). For D(L,B) the base
1206 register will be the skipped operand, because L is NOT
1212 /* Gather the operand. */
1213 hold
= input_line_pointer
;
1214 input_line_pointer
= str
;
1216 /* Parse the operand. */
1217 if (! register_name (&ex
))
1220 str
= input_line_pointer
;
1221 input_line_pointer
= hold
;
1223 /* Write the operand to the insn. */
1224 if (ex
.X_op
== O_illegal
)
1225 as_bad (_("illegal operand"));
1226 else if (ex
.X_op
== O_absent
)
1228 /* No operands, check if all operands can be skipped. */
1229 while (*opindex_ptr
!= 0 && operand
->flags
& S390_OPERAND_OPTIONAL
)
1231 if (operand
->flags
& S390_OPERAND_DISP
)
1233 /* An optional displacement makes the whole D(X,B)
1234 D(L,B) or D(B) block optional. */
1236 operand
= s390_operands
+ *(++opindex_ptr
);
1237 } while (!(operand
->flags
& S390_OPERAND_BASE
));
1239 operand
= s390_operands
+ *(++opindex_ptr
);
1241 if (opindex_ptr
[0] == '\0')
1243 as_bad (_("missing operand"));
1245 else if (ex
.X_op
== O_register
|| ex
.X_op
== O_constant
)
1247 s390_lit_suffix (&str
, &ex
, ELF_SUFFIX_NONE
);
1249 if (ex
.X_op
!= O_register
&& ex
.X_op
!= O_constant
)
1251 /* We need to generate a fixup for the
1252 expression returned by s390_lit_suffix. */
1253 if (fc
>= MAX_INSN_FIXUPS
)
1254 as_fatal (_("too many fixups"));
1255 fixups
[fc
].exp
= ex
;
1256 fixups
[fc
].opindex
= *opindex_ptr
;
1257 fixups
[fc
].reloc
= BFD_RELOC_UNUSED
;
1262 if ((operand
->flags
& S390_OPERAND_INDEX
)
1263 && ex
.X_add_number
== 0
1265 as_warn (_("index register specified but zero"));
1266 if ((operand
->flags
& S390_OPERAND_BASE
)
1267 && ex
.X_add_number
== 0
1269 as_warn (_("base register specified but zero"));
1270 s390_insert_operand (insn
, operand
, ex
.X_add_number
, NULL
, 0);
1275 suffix
= s390_elf_suffix (&str
, &ex
);
1276 suffix
= s390_lit_suffix (&str
, &ex
, suffix
);
1277 reloc
= BFD_RELOC_UNUSED
;
1279 if (suffix
== ELF_SUFFIX_GOT
)
1281 if ((operand
->flags
& S390_OPERAND_DISP
) &&
1282 (operand
->bits
== 12))
1283 reloc
= BFD_RELOC_390_GOT12
;
1284 else if ((operand
->flags
& S390_OPERAND_DISP
) &&
1285 (operand
->bits
== 20))
1286 reloc
= BFD_RELOC_390_GOT20
;
1287 else if ((operand
->flags
& S390_OPERAND_SIGNED
)
1288 && (operand
->bits
== 16))
1289 reloc
= BFD_RELOC_390_GOT16
;
1290 else if ((operand
->flags
& S390_OPERAND_PCREL
)
1291 && (operand
->bits
== 32))
1292 reloc
= BFD_RELOC_390_GOTENT
;
1294 else if (suffix
== ELF_SUFFIX_PLT
)
1296 if ((operand
->flags
& S390_OPERAND_PCREL
)
1297 && (operand
->bits
== 16))
1298 reloc
= BFD_RELOC_390_PLT16DBL
;
1299 else if ((operand
->flags
& S390_OPERAND_PCREL
)
1300 && (operand
->bits
== 32))
1301 reloc
= BFD_RELOC_390_PLT32DBL
;
1303 else if (suffix
== ELF_SUFFIX_GOTENT
)
1305 if ((operand
->flags
& S390_OPERAND_PCREL
)
1306 && (operand
->bits
== 32))
1307 reloc
= BFD_RELOC_390_GOTENT
;
1309 else if (suffix
== ELF_SUFFIX_GOTOFF
)
1311 if ((operand
->flags
& S390_OPERAND_SIGNED
)
1312 && (operand
->bits
== 16))
1313 reloc
= BFD_RELOC_16_GOTOFF
;
1315 else if (suffix
== ELF_SUFFIX_PLTOFF
)
1317 if ((operand
->flags
& S390_OPERAND_SIGNED
)
1318 && (operand
->bits
== 16))
1319 reloc
= BFD_RELOC_390_PLTOFF16
;
1321 else if (suffix
== ELF_SUFFIX_GOTPLT
)
1323 if ((operand
->flags
& S390_OPERAND_DISP
)
1324 && (operand
->bits
== 12))
1325 reloc
= BFD_RELOC_390_GOTPLT12
;
1326 else if ((operand
->flags
& S390_OPERAND_SIGNED
)
1327 && (operand
->bits
== 16))
1328 reloc
= BFD_RELOC_390_GOTPLT16
;
1329 else if ((operand
->flags
& S390_OPERAND_PCREL
)
1330 && (operand
->bits
== 32))
1331 reloc
= BFD_RELOC_390_GOTPLTENT
;
1333 else if (suffix
== ELF_SUFFIX_TLS_GOTIE
)
1335 if ((operand
->flags
& S390_OPERAND_DISP
)
1336 && (operand
->bits
== 12))
1337 reloc
= BFD_RELOC_390_TLS_GOTIE12
;
1338 else if ((operand
->flags
& S390_OPERAND_DISP
)
1339 && (operand
->bits
== 20))
1340 reloc
= BFD_RELOC_390_TLS_GOTIE20
;
1342 else if (suffix
== ELF_SUFFIX_TLS_IE
)
1344 if ((operand
->flags
& S390_OPERAND_PCREL
)
1345 && (operand
->bits
== 32))
1346 reloc
= BFD_RELOC_390_TLS_IEENT
;
1349 if (suffix
!= ELF_SUFFIX_NONE
&& reloc
== BFD_RELOC_UNUSED
)
1350 as_bad (_("invalid operand suffix"));
1351 /* We need to generate a fixup of type 'reloc' for this
1353 if (fc
>= MAX_INSN_FIXUPS
)
1354 as_fatal (_("too many fixups"));
1355 fixups
[fc
].exp
= ex
;
1356 fixups
[fc
].opindex
= *opindex_ptr
;
1357 fixups
[fc
].reloc
= reloc
;
1361 /* Check the next character. The call to expression has advanced
1362 str past any whitespace. */
1363 if (operand
->flags
& S390_OPERAND_DISP
)
1365 /* After a displacement a block in parentheses can start. */
1368 /* Check if parenthesized block can be skipped. If the next
1369 operand is neiter an optional operand nor a base register
1370 then we have a syntax error. */
1371 operand
= s390_operands
+ *(++opindex_ptr
);
1372 if (!(operand
->flags
& (S390_OPERAND_INDEX
|S390_OPERAND_BASE
)))
1373 as_bad (_("syntax error; missing '(' after displacement"));
1375 /* Ok, skip all operands until S390_OPERAND_BASE. */
1376 while (!(operand
->flags
& S390_OPERAND_BASE
))
1377 operand
= s390_operands
+ *(++opindex_ptr
);
1379 /* If there is a next operand it must be separated by a comma. */
1380 if (opindex_ptr
[1] != '\0')
1384 while (opindex_ptr
[1] != '\0')
1386 operand
= s390_operands
+ *(++opindex_ptr
);
1387 if (operand
->flags
& S390_OPERAND_OPTIONAL
)
1389 as_bad (_("syntax error; expected ,"));
1399 /* We found an opening parentheses. */
1401 for (f
= str
; *f
!= '\0'; f
++)
1402 if (*f
== ',' || *f
== ')')
1404 /* If there is no comma until the closing parentheses OR
1405 there is a comma right after the opening parentheses,
1406 we have to skip optional operands. */
1407 if (*f
== ',' && f
== str
)
1409 /* comma directly after '(' ? */
1414 skip_optional
= (*f
!= ',');
1417 else if (operand
->flags
& S390_OPERAND_BASE
)
1419 /* After the base register the parenthesed block ends. */
1421 as_bad (_("syntax error; missing ')' after base register"));
1423 /* If there is a next operand it must be separated by a comma. */
1424 if (opindex_ptr
[1] != '\0')
1428 while (opindex_ptr
[1] != '\0')
1430 operand
= s390_operands
+ *(++opindex_ptr
);
1431 if (operand
->flags
& S390_OPERAND_OPTIONAL
)
1433 as_bad (_("syntax error; expected ,"));
1443 /* We can find an 'early' closing parentheses in e.g. D(L) instead
1444 of D(L,B). In this case the base register has to be skipped. */
1447 operand
= s390_operands
+ *(++opindex_ptr
);
1449 if (!(operand
->flags
& S390_OPERAND_BASE
))
1450 as_bad (_("syntax error; ')' not allowed here"));
1453 /* If there is a next operand it must be separated by a comma. */
1454 if (opindex_ptr
[1] != '\0')
1458 while (opindex_ptr
[1] != '\0')
1460 operand
= s390_operands
+ *(++opindex_ptr
);
1461 if (operand
->flags
& S390_OPERAND_OPTIONAL
)
1463 as_bad (_("syntax error; expected ,"));
1473 while (ISSPACE (*str
))
1476 /* Check for tls instruction marker. */
1477 reloc
= s390_tls_suffix (&str
, &ex
);
1478 if (reloc
!= BFD_RELOC_UNUSED
)
1480 /* We need to generate a fixup of type 'reloc' for this
1482 if (fc
>= MAX_INSN_FIXUPS
)
1483 as_fatal (_("too many fixups"));
1484 fixups
[fc
].exp
= ex
;
1485 fixups
[fc
].opindex
= -1;
1486 fixups
[fc
].reloc
= reloc
;
1494 if ((linefeed
= strchr (str
, '\n')) != NULL
)
1496 as_bad (_("junk at end of line: `%s'"), str
);
1497 if (linefeed
!= NULL
)
1501 /* Write out the instruction. */
1502 f
= frag_more (opcode
->oplen
);
1503 memcpy (f
, insn
, opcode
->oplen
);
1504 dwarf2_emit_insn (opcode
->oplen
);
1506 /* Create any fixups. At this point we do not use a
1507 bfd_reloc_code_real_type, but instead just use the
1508 BFD_RELOC_UNUSED plus the operand index. This lets us easily
1509 handle fixups for any operand type, although that is admittedly
1510 not a very exciting feature. We pick a BFD reloc type in
1512 for (i
= 0; i
< fc
; i
++)
1515 if (fixups
[i
].opindex
< 0)
1517 /* Create tls instruction marker relocation. */
1518 fix_new_exp (frag_now
, f
- frag_now
->fr_literal
, opcode
->oplen
,
1519 &fixups
[i
].exp
, 0, fixups
[i
].reloc
);
1523 operand
= s390_operands
+ fixups
[i
].opindex
;
1525 if (fixups
[i
].reloc
!= BFD_RELOC_UNUSED
)
1527 reloc_howto_type
*reloc_howto
;
1531 reloc_howto
= bfd_reloc_type_lookup (stdoutput
, fixups
[i
].reloc
);
1535 size
= bfd_get_reloc_size (reloc_howto
);
1537 if (size
< 1 || size
> 4)
1540 fixP
= fix_new_exp (frag_now
,
1541 f
- frag_now
->fr_literal
+ (operand
->shift
/8),
1542 size
, &fixups
[i
].exp
, reloc_howto
->pc_relative
,
1544 /* Turn off overflow checking in fixup_segment. This is necessary
1545 because fixup_segment will signal an overflow for large 4 byte
1546 quantities for GOT12 relocations. */
1547 if ( fixups
[i
].reloc
== BFD_RELOC_390_GOT12
1548 || fixups
[i
].reloc
== BFD_RELOC_390_GOT20
1549 || fixups
[i
].reloc
== BFD_RELOC_390_GOT16
)
1550 fixP
->fx_no_overflow
= 1;
1553 fix_new_exp (frag_now
, f
- frag_now
->fr_literal
, 4, &fixups
[i
].exp
,
1554 (operand
->flags
& S390_OPERAND_PCREL
) != 0,
1555 ((bfd_reloc_code_real_type
)
1556 (fixups
[i
].opindex
+ (int) BFD_RELOC_UNUSED
)));
1561 /* This routine is called for each instruction to be assembled. */
1564 md_assemble (char *str
)
1566 const struct s390_opcode
*opcode
;
1567 unsigned char insn
[6];
1570 /* Get the opcode. */
1571 for (s
= str
; *s
!= '\0' && ! ISSPACE (*s
); s
++)
1576 /* Look up the opcode in the hash table. */
1577 opcode
= (struct s390_opcode
*) hash_find (s390_opcode_hash
, str
);
1578 if (opcode
== (const struct s390_opcode
*) NULL
)
1580 as_bad (_("Unrecognized opcode: `%s'"), str
);
1583 else if (!(opcode
->modes
& current_mode_mask
))
1585 as_bad (_("Opcode %s not available in this mode"), str
);
1588 memcpy (insn
, opcode
->opcode
, sizeof (insn
));
1589 md_gather_operands (s
, insn
, opcode
);
1592 #ifndef WORKING_DOT_WORD
1593 /* Handle long and short jumps. We don't support these */
1595 md_create_short_jump (ptr
, from_addr
, to_addr
, frag
, to_symbol
)
1597 addressT from_addr
, to_addr
;
1605 md_create_long_jump (ptr
, from_addr
, to_addr
, frag
, to_symbol
)
1607 addressT from_addr
, to_addr
;
1616 s390_bss (int ignore ATTRIBUTE_UNUSED
)
1618 /* We don't support putting frags in the BSS segment, we fake it
1619 by marking in_bss, then looking at s_skip for clues. */
1621 subseg_set (bss_section
, 0);
1622 demand_empty_rest_of_line ();
1625 /* Pseudo-op handling. */
1628 s390_insn (int ignore ATTRIBUTE_UNUSED
)
1631 const struct s390_opcode
*opformat
;
1632 unsigned char insn
[6];
1635 /* Get the opcode format. */
1636 s
= input_line_pointer
;
1637 while (*s
!= '\0' && *s
!= ',' && ! ISSPACE (*s
))
1640 as_bad (_("Invalid .insn format\n"));
1643 /* Look up the opcode in the hash table. */
1644 opformat
= (struct s390_opcode
*)
1645 hash_find (s390_opformat_hash
, input_line_pointer
);
1646 if (opformat
== (const struct s390_opcode
*) NULL
)
1648 as_bad (_("Unrecognized opcode format: `%s'"), input_line_pointer
);
1651 input_line_pointer
= s
;
1653 if (exp
.X_op
== O_constant
)
1655 if ( ( opformat
->oplen
== 6
1656 && (addressT
) exp
.X_add_number
< (1ULL << 48))
1657 || ( opformat
->oplen
== 4
1658 && (addressT
) exp
.X_add_number
< (1ULL << 32))
1659 || ( opformat
->oplen
== 2
1660 && (addressT
) exp
.X_add_number
< (1ULL << 16)))
1661 md_number_to_chars ((char *) insn
, exp
.X_add_number
, opformat
->oplen
);
1663 as_bad (_("Invalid .insn format\n"));
1665 else if (exp
.X_op
== O_big
)
1667 if (exp
.X_add_number
> 0
1668 && opformat
->oplen
== 6
1669 && generic_bignum
[3] == 0)
1671 md_number_to_chars ((char *) insn
, generic_bignum
[2], 2);
1672 md_number_to_chars ((char *) &insn
[2], generic_bignum
[1], 2);
1673 md_number_to_chars ((char *) &insn
[4], generic_bignum
[0], 2);
1676 as_bad (_("Invalid .insn format\n"));
1679 as_bad (_("second operand of .insn not a constant\n"));
1681 if (strcmp (opformat
->name
, "e") != 0 && *input_line_pointer
++ != ',')
1682 as_bad (_("missing comma after insn constant\n"));
1684 if ((s
= strchr (input_line_pointer
, '\n')) != NULL
)
1686 input_line_pointer
= md_gather_operands (input_line_pointer
, insn
,
1690 demand_empty_rest_of_line ();
1693 /* The .byte pseudo-op. This is similar to the normal .byte
1694 pseudo-op, but it can also take a single ASCII string. */
1697 s390_byte (int ignore ATTRIBUTE_UNUSED
)
1699 if (*input_line_pointer
!= '\"')
1705 /* Gather characters. A real double quote is doubled. Unusual
1706 characters are not permitted. */
1707 ++input_line_pointer
;
1712 c
= *input_line_pointer
++;
1716 if (*input_line_pointer
!= '\"')
1718 ++input_line_pointer
;
1721 FRAG_APPEND_1_CHAR (c
);
1724 demand_empty_rest_of_line ();
1727 /* The .ltorg pseudo-op.This emits all literals defined since the last
1728 .ltorg or the invocation of gas. Literals are defined with the
1732 s390_literals (int ignore ATTRIBUTE_UNUSED
)
1734 struct s390_lpe
*lpe
;
1736 if (lp_sym
== NULL
|| lpe_count
== 0)
1737 return; /* Nothing to be done. */
1739 /* Emit symbol for start of literal pool. */
1740 S_SET_SEGMENT (lp_sym
, now_seg
);
1741 S_SET_VALUE (lp_sym
, (valueT
) frag_now_fix ());
1742 lp_sym
->sy_frag
= frag_now
;
1747 lpe_list
= lpe_list
->next
;
1748 S_SET_SEGMENT (lpe
->sym
, now_seg
);
1749 S_SET_VALUE (lpe
->sym
, (valueT
) frag_now_fix ());
1750 lpe
->sym
->sy_frag
= frag_now
;
1752 /* Emit literal pool entry. */
1753 if (lpe
->reloc
!= BFD_RELOC_UNUSED
)
1755 reloc_howto_type
*reloc_howto
=
1756 bfd_reloc_type_lookup (stdoutput
, lpe
->reloc
);
1757 int size
= bfd_get_reloc_size (reloc_howto
);
1760 if (size
> lpe
->nbytes
)
1761 as_bad (_("%s relocations do not fit in %d bytes"),
1762 reloc_howto
->name
, lpe
->nbytes
);
1763 where
= frag_more (lpe
->nbytes
);
1764 md_number_to_chars (where
, 0, size
);
1765 fix_new_exp (frag_now
, where
- frag_now
->fr_literal
,
1766 size
, &lpe
->ex
, reloc_howto
->pc_relative
, lpe
->reloc
);
1770 if (lpe
->ex
.X_op
== O_big
)
1772 if (lpe
->ex
.X_add_number
<= 0)
1773 generic_floating_point_number
= lpe
->floatnum
;
1775 memcpy (generic_bignum
, lpe
->bignum
,
1776 lpe
->ex
.X_add_number
* sizeof (LITTLENUM_TYPE
));
1778 emit_expr (&lpe
->ex
, lpe
->nbytes
);
1781 lpe
->next
= lpe_free_list
;
1782 lpe_free_list
= lpe
;
1784 lpe_list_tail
= NULL
;
1790 /* The .machine pseudo op allows to switch to a different CPU level in
1791 the asm listing. The current CPU setting can be stored on a stack
1792 with .machine push and restored with .machined pop. */
1795 s390_machine (int ignore ATTRIBUTE_UNUSED
)
1798 #define MAX_HISTORY 100
1799 static unsigned int *cpu_history
;
1800 static int curr_hist
;
1804 if (*input_line_pointer
== '"')
1807 cpu_string
= demand_copy_C_string (&len
);
1812 cpu_string
= input_line_pointer
;
1813 c
= get_symbol_end ();
1814 cpu_string
= xstrdup (cpu_string
);
1815 *input_line_pointer
= c
;
1818 if (cpu_string
!= NULL
)
1820 unsigned int old_cpu
= current_cpu
;
1821 unsigned int new_cpu
;
1824 for (p
= cpu_string
; *p
!= 0; p
++)
1827 if (strcmp (cpu_string
, "push") == 0)
1829 if (cpu_history
== NULL
)
1830 cpu_history
= xmalloc (MAX_HISTORY
* sizeof (*cpu_history
));
1832 if (curr_hist
>= MAX_HISTORY
)
1833 as_bad (_(".machine stack overflow"));
1835 cpu_history
[curr_hist
++] = current_cpu
;
1837 else if (strcmp (cpu_string
, "pop") == 0)
1840 as_bad (_(".machine stack underflow"));
1842 current_cpu
= cpu_history
[--curr_hist
];
1844 else if ((new_cpu
= s390_parse_cpu (cpu_string
)) != (unsigned int)-1)
1845 current_cpu
= new_cpu
;
1847 as_bad (_("invalid machine `%s'"), cpu_string
);
1849 if (current_cpu
!= old_cpu
)
1850 s390_setup_opcodes ();
1853 demand_empty_rest_of_line ();
1857 md_atof (int type
, char *litp
, int *sizep
)
1859 return ieee_md_atof (type
, litp
, sizep
, TRUE
);
1862 /* Align a section (I don't know why this is machine dependent). */
1865 md_section_align (asection
*seg
, valueT addr
)
1867 int align
= bfd_get_section_alignment (stdoutput
, seg
);
1869 return ((addr
+ (1 << align
) - 1) & (-1 << align
));
1872 /* We don't have any form of relaxing. */
1875 md_estimate_size_before_relax (fragS
*fragp ATTRIBUTE_UNUSED
,
1876 asection
*seg ATTRIBUTE_UNUSED
)
1882 /* Convert a machine dependent frag. We never generate these. */
1885 md_convert_frag (bfd
*abfd ATTRIBUTE_UNUSED
,
1886 asection
*sec ATTRIBUTE_UNUSED
,
1887 fragS
*fragp ATTRIBUTE_UNUSED
)
1893 md_undefined_symbol (char *name
)
1895 if (*name
== '_' && *(name
+ 1) == 'G'
1896 && strcmp (name
, "_GLOBAL_OFFSET_TABLE_") == 0)
1900 if (symbol_find (name
))
1901 as_bad (_("GOT already in symbol table"));
1902 GOT_symbol
= symbol_new (name
, undefined_section
,
1903 (valueT
) 0, &zero_address_frag
);
1910 /* Functions concerning relocs. */
1912 /* The location from which a PC relative jump should be calculated,
1913 given a PC relative reloc. */
1916 md_pcrel_from_section (fixS
*fixp
, segT sec ATTRIBUTE_UNUSED
)
1918 return fixp
->fx_frag
->fr_address
+ fixp
->fx_where
;
1921 /* Here we decide which fixups can be adjusted to make them relative to
1922 the beginning of the section instead of the symbol. Basically we need
1923 to make sure that the dynamic relocations are done correctly, so in
1924 some cases we force the original symbol to be used. */
1926 tc_s390_fix_adjustable (fixS
*fixP
)
1928 /* Don't adjust references to merge sections. */
1929 if ((S_GET_SEGMENT (fixP
->fx_addsy
)->flags
& SEC_MERGE
) != 0)
1931 /* adjust_reloc_syms doesn't know about the GOT. */
1932 if ( fixP
->fx_r_type
== BFD_RELOC_16_GOTOFF
1933 || fixP
->fx_r_type
== BFD_RELOC_32_GOTOFF
1934 || fixP
->fx_r_type
== BFD_RELOC_390_GOTOFF64
1935 || fixP
->fx_r_type
== BFD_RELOC_390_PLTOFF16
1936 || fixP
->fx_r_type
== BFD_RELOC_390_PLTOFF32
1937 || fixP
->fx_r_type
== BFD_RELOC_390_PLTOFF64
1938 || fixP
->fx_r_type
== BFD_RELOC_390_PLT16DBL
1939 || fixP
->fx_r_type
== BFD_RELOC_390_PLT32
1940 || fixP
->fx_r_type
== BFD_RELOC_390_PLT32DBL
1941 || fixP
->fx_r_type
== BFD_RELOC_390_PLT64
1942 || fixP
->fx_r_type
== BFD_RELOC_390_GOT12
1943 || fixP
->fx_r_type
== BFD_RELOC_390_GOT20
1944 || fixP
->fx_r_type
== BFD_RELOC_390_GOT16
1945 || fixP
->fx_r_type
== BFD_RELOC_32_GOT_PCREL
1946 || fixP
->fx_r_type
== BFD_RELOC_390_GOT64
1947 || fixP
->fx_r_type
== BFD_RELOC_390_GOTENT
1948 || fixP
->fx_r_type
== BFD_RELOC_390_GOTPLT12
1949 || fixP
->fx_r_type
== BFD_RELOC_390_GOTPLT16
1950 || fixP
->fx_r_type
== BFD_RELOC_390_GOTPLT20
1951 || fixP
->fx_r_type
== BFD_RELOC_390_GOTPLT32
1952 || fixP
->fx_r_type
== BFD_RELOC_390_GOTPLT64
1953 || fixP
->fx_r_type
== BFD_RELOC_390_GOTPLTENT
1954 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_LOAD
1955 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_GDCALL
1956 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_LDCALL
1957 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_GD32
1958 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_GD64
1959 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_GOTIE12
1960 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_GOTIE20
1961 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_GOTIE32
1962 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_GOTIE64
1963 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_LDM32
1964 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_LDM64
1965 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_IE32
1966 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_IE64
1967 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_IEENT
1968 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_LE32
1969 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_LE64
1970 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_LDO32
1971 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_LDO64
1972 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_DTPMOD
1973 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_DTPOFF
1974 || fixP
->fx_r_type
== BFD_RELOC_390_TLS_TPOFF
1975 || fixP
->fx_r_type
== BFD_RELOC_VTABLE_INHERIT
1976 || fixP
->fx_r_type
== BFD_RELOC_VTABLE_ENTRY
)
1981 /* Return true if we must always emit a reloc for a type and false if
1982 there is some hope of resolving it at assembly time. */
1984 tc_s390_force_relocation (struct fix
*fixp
)
1986 /* Ensure we emit a relocation for every reference to the global
1987 offset table or to the procedure link table. */
1988 switch (fixp
->fx_r_type
)
1990 case BFD_RELOC_390_GOT12
:
1991 case BFD_RELOC_390_GOT20
:
1992 case BFD_RELOC_32_GOT_PCREL
:
1993 case BFD_RELOC_32_GOTOFF
:
1994 case BFD_RELOC_390_GOTOFF64
:
1995 case BFD_RELOC_390_PLTOFF16
:
1996 case BFD_RELOC_390_PLTOFF32
:
1997 case BFD_RELOC_390_PLTOFF64
:
1998 case BFD_RELOC_390_GOTPC
:
1999 case BFD_RELOC_390_GOT16
:
2000 case BFD_RELOC_390_GOTPCDBL
:
2001 case BFD_RELOC_390_GOT64
:
2002 case BFD_RELOC_390_GOTENT
:
2003 case BFD_RELOC_390_PLT32
:
2004 case BFD_RELOC_390_PLT16DBL
:
2005 case BFD_RELOC_390_PLT32DBL
:
2006 case BFD_RELOC_390_PLT64
:
2007 case BFD_RELOC_390_GOTPLT12
:
2008 case BFD_RELOC_390_GOTPLT16
:
2009 case BFD_RELOC_390_GOTPLT20
:
2010 case BFD_RELOC_390_GOTPLT32
:
2011 case BFD_RELOC_390_GOTPLT64
:
2012 case BFD_RELOC_390_GOTPLTENT
:
2018 return generic_force_reloc (fixp
);
2021 /* Apply a fixup to the object code. This is called for all the
2022 fixups we generated by the call to fix_new_exp, above. In the call
2023 above we used a reloc code which was the largest legal reloc code
2024 plus the operand index. Here we undo that to recover the operand
2025 index. At this point all symbol values should be fully resolved,
2026 and we attempt to completely resolve the reloc. If we can not do
2027 that, we determine the correct reloc code and put it back in the
2031 md_apply_fix (fixS
*fixP
, valueT
*valP
, segT seg ATTRIBUTE_UNUSED
)
2034 valueT value
= *valP
;
2036 where
= fixP
->fx_frag
->fr_literal
+ fixP
->fx_where
;
2038 if (fixP
->fx_subsy
!= NULL
)
2039 as_bad_where (fixP
->fx_file
, fixP
->fx_line
,
2040 _("cannot emit relocation %s against subsy symbol %s"),
2041 bfd_get_reloc_code_name (fixP
->fx_r_type
),
2042 S_GET_NAME (fixP
->fx_subsy
));
2044 if (fixP
->fx_addsy
!= NULL
)
2047 value
+= fixP
->fx_frag
->fr_address
+ fixP
->fx_where
;
2052 if ((int) fixP
->fx_r_type
>= (int) BFD_RELOC_UNUSED
)
2054 const struct s390_operand
*operand
;
2057 opindex
= (int) fixP
->fx_r_type
- (int) BFD_RELOC_UNUSED
;
2058 operand
= &s390_operands
[opindex
];
2062 /* Insert the fully resolved operand value. */
2063 s390_insert_operand ((unsigned char *) where
, operand
,
2064 (offsetT
) value
, fixP
->fx_file
, fixP
->fx_line
);
2068 /* Determine a BFD reloc value based on the operand information.
2069 We are only prepared to turn a few of the operands into
2071 fixP
->fx_offset
= value
;
2072 if (operand
->bits
== 12 && operand
->shift
== 20)
2075 fixP
->fx_where
+= 2;
2076 fixP
->fx_r_type
= BFD_RELOC_390_12
;
2078 else if (operand
->bits
== 12 && operand
->shift
== 36)
2081 fixP
->fx_where
+= 4;
2082 fixP
->fx_r_type
= BFD_RELOC_390_12
;
2084 else if (operand
->bits
== 20 && operand
->shift
== 20)
2087 fixP
->fx_where
+= 2;
2088 fixP
->fx_r_type
= BFD_RELOC_390_20
;
2090 else if (operand
->bits
== 8 && operand
->shift
== 8)
2093 fixP
->fx_where
+= 1;
2094 fixP
->fx_r_type
= BFD_RELOC_8
;
2096 else if (operand
->bits
== 16 && operand
->shift
== 16)
2099 fixP
->fx_where
+= 2;
2100 if (operand
->flags
& S390_OPERAND_PCREL
)
2102 fixP
->fx_r_type
= BFD_RELOC_390_PC16DBL
;
2103 fixP
->fx_offset
+= 2;
2106 fixP
->fx_r_type
= BFD_RELOC_16
;
2108 else if (operand
->bits
== 32 && operand
->shift
== 16
2109 && (operand
->flags
& S390_OPERAND_PCREL
))
2112 fixP
->fx_where
+= 2;
2113 fixP
->fx_offset
+= 2;
2114 fixP
->fx_r_type
= BFD_RELOC_390_PC32DBL
;
2121 /* Use expr_symbol_where to see if this is an expression
2123 if (expr_symbol_where (fixP
->fx_addsy
, &sfile
, &sline
))
2124 as_bad_where (fixP
->fx_file
, fixP
->fx_line
,
2125 _("unresolved expression that must be resolved"));
2127 as_bad_where (fixP
->fx_file
, fixP
->fx_line
,
2128 _("unsupported relocation type"));
2135 switch (fixP
->fx_r_type
)
2141 md_number_to_chars (where
, value
, 1);
2143 case BFD_RELOC_390_12
:
2144 case BFD_RELOC_390_GOT12
:
2145 case BFD_RELOC_390_GOTPLT12
:
2150 mop
= bfd_getb16 ((unsigned char *) where
);
2151 mop
|= (unsigned short) (value
& 0xfff);
2152 bfd_putb16 ((bfd_vma
) mop
, (unsigned char *) where
);
2156 case BFD_RELOC_390_20
:
2157 case BFD_RELOC_390_GOT20
:
2158 case BFD_RELOC_390_GOTPLT20
:
2162 mop
= bfd_getb32 ((unsigned char *) where
);
2163 mop
|= (unsigned int) ((value
& 0xfff) << 8 |
2164 (value
& 0xff000) >> 12);
2165 bfd_putb32 ((bfd_vma
) mop
, (unsigned char *) where
);
2170 case BFD_RELOC_GPREL16
:
2171 case BFD_RELOC_16_GOT_PCREL
:
2172 case BFD_RELOC_16_GOTOFF
:
2174 as_bad_where (fixP
->fx_file
, fixP
->fx_line
,
2175 _("cannot emit PC relative %s relocation%s%s"),
2176 bfd_get_reloc_code_name (fixP
->fx_r_type
),
2177 fixP
->fx_addsy
!= NULL
? " against " : "",
2178 (fixP
->fx_addsy
!= NULL
2179 ? S_GET_NAME (fixP
->fx_addsy
)
2182 md_number_to_chars (where
, value
, 2);
2184 case BFD_RELOC_390_GOT16
:
2185 case BFD_RELOC_390_PLTOFF16
:
2186 case BFD_RELOC_390_GOTPLT16
:
2188 md_number_to_chars (where
, value
, 2);
2190 case BFD_RELOC_390_PC16DBL
:
2191 case BFD_RELOC_390_PLT16DBL
:
2194 md_number_to_chars (where
, (offsetT
) value
>> 1, 2);
2199 fixP
->fx_r_type
= BFD_RELOC_32_PCREL
;
2201 fixP
->fx_r_type
= BFD_RELOC_32
;
2203 md_number_to_chars (where
, value
, 4);
2205 case BFD_RELOC_32_PCREL
:
2206 case BFD_RELOC_32_BASEREL
:
2207 fixP
->fx_r_type
= BFD_RELOC_32_PCREL
;
2209 md_number_to_chars (where
, value
, 4);
2211 case BFD_RELOC_32_GOT_PCREL
:
2212 case BFD_RELOC_390_PLTOFF32
:
2213 case BFD_RELOC_390_PLT32
:
2214 case BFD_RELOC_390_GOTPLT32
:
2216 md_number_to_chars (where
, value
, 4);
2218 case BFD_RELOC_390_PC32DBL
:
2219 case BFD_RELOC_390_PLT32DBL
:
2220 case BFD_RELOC_390_GOTPCDBL
:
2221 case BFD_RELOC_390_GOTENT
:
2222 case BFD_RELOC_390_GOTPLTENT
:
2225 md_number_to_chars (where
, (offsetT
) value
>> 1, 4);
2228 case BFD_RELOC_32_GOTOFF
:
2230 md_number_to_chars (where
, value
, sizeof (int));
2233 case BFD_RELOC_390_GOTOFF64
:
2235 md_number_to_chars (where
, value
, 8);
2238 case BFD_RELOC_390_GOT64
:
2239 case BFD_RELOC_390_PLTOFF64
:
2240 case BFD_RELOC_390_PLT64
:
2241 case BFD_RELOC_390_GOTPLT64
:
2243 md_number_to_chars (where
, value
, 8);
2248 fixP
->fx_r_type
= BFD_RELOC_64_PCREL
;
2250 fixP
->fx_r_type
= BFD_RELOC_64
;
2252 md_number_to_chars (where
, value
, 8);
2255 case BFD_RELOC_64_PCREL
:
2256 fixP
->fx_r_type
= BFD_RELOC_64_PCREL
;
2258 md_number_to_chars (where
, value
, 8);
2261 case BFD_RELOC_VTABLE_INHERIT
:
2262 case BFD_RELOC_VTABLE_ENTRY
:
2266 case BFD_RELOC_390_TLS_LOAD
:
2267 case BFD_RELOC_390_TLS_GDCALL
:
2268 case BFD_RELOC_390_TLS_LDCALL
:
2269 case BFD_RELOC_390_TLS_GD32
:
2270 case BFD_RELOC_390_TLS_GD64
:
2271 case BFD_RELOC_390_TLS_GOTIE12
:
2272 case BFD_RELOC_390_TLS_GOTIE20
:
2273 case BFD_RELOC_390_TLS_GOTIE32
:
2274 case BFD_RELOC_390_TLS_GOTIE64
:
2275 case BFD_RELOC_390_TLS_LDM32
:
2276 case BFD_RELOC_390_TLS_LDM64
:
2277 case BFD_RELOC_390_TLS_IE32
:
2278 case BFD_RELOC_390_TLS_IE64
:
2279 case BFD_RELOC_390_TLS_LE32
:
2280 case BFD_RELOC_390_TLS_LE64
:
2281 case BFD_RELOC_390_TLS_LDO32
:
2282 case BFD_RELOC_390_TLS_LDO64
:
2283 case BFD_RELOC_390_TLS_DTPMOD
:
2284 case BFD_RELOC_390_TLS_DTPOFF
:
2285 case BFD_RELOC_390_TLS_TPOFF
:
2286 S_SET_THREAD_LOCAL (fixP
->fx_addsy
);
2287 /* Fully resolved at link time. */
2289 case BFD_RELOC_390_TLS_IEENT
:
2290 /* Fully resolved at link time. */
2291 S_SET_THREAD_LOCAL (fixP
->fx_addsy
);
2297 const char *reloc_name
= bfd_get_reloc_code_name (fixP
->fx_r_type
);
2299 if (reloc_name
!= NULL
)
2300 as_fatal (_("Gas failure, reloc type %s\n"), reloc_name
);
2302 as_fatal (_("Gas failure, reloc type #%i\n"), fixP
->fx_r_type
);
2306 fixP
->fx_offset
= value
;
2310 /* Generate a reloc for a fixup. */
2313 tc_gen_reloc (asection
*seg ATTRIBUTE_UNUSED
, fixS
*fixp
)
2315 bfd_reloc_code_real_type code
;
2318 code
= fixp
->fx_r_type
;
2319 if (GOT_symbol
&& fixp
->fx_addsy
== GOT_symbol
)
2321 if ( (s390_arch_size
== 32 && code
== BFD_RELOC_32_PCREL
)
2322 || (s390_arch_size
== 64 && code
== BFD_RELOC_64_PCREL
))
2323 code
= BFD_RELOC_390_GOTPC
;
2324 if (code
== BFD_RELOC_390_PC32DBL
)
2325 code
= BFD_RELOC_390_GOTPCDBL
;
2328 reloc
= (arelent
*) xmalloc (sizeof (arelent
));
2329 reloc
->sym_ptr_ptr
= (asymbol
**) xmalloc (sizeof (asymbol
*));
2330 *reloc
->sym_ptr_ptr
= symbol_get_bfdsym (fixp
->fx_addsy
);
2331 reloc
->address
= fixp
->fx_frag
->fr_address
+ fixp
->fx_where
;
2332 reloc
->howto
= bfd_reloc_type_lookup (stdoutput
, code
);
2333 if (reloc
->howto
== NULL
)
2335 as_bad_where (fixp
->fx_file
, fixp
->fx_line
,
2336 _("cannot represent relocation type %s"),
2337 bfd_get_reloc_code_name (code
));
2338 /* Set howto to a garbage value so that we can keep going. */
2339 reloc
->howto
= bfd_reloc_type_lookup (stdoutput
, BFD_RELOC_32
);
2340 gas_assert (reloc
->howto
!= NULL
);
2342 reloc
->addend
= fixp
->fx_offset
;
2348 s390_cfi_frame_initial_instructions (void)
2350 cfi_add_CFA_def_cfa (15, s390_arch_size
== 64 ? 160 : 96);
2354 tc_s390_regname_to_dw2regnum (char *regname
)
2358 if (regname
[0] != 'c' && regname
[0] != 'a')
2360 regnum
= reg_name_search (pre_defined_registers
, REG_NAME_CNT
, regname
);
2361 if (regname
[0] == 'f' && regnum
!= -1)
2364 else if (strcmp (regname
, "ap") == 0)
2366 else if (strcmp (regname
, "cc") == 0)
2372 s390_elf_final_processing (void)
2374 if (s390_arch_size
== 32 && (current_mode_mask
& (1 << S390_OPCODE_ZARCH
)))
2375 elf_elfheader (stdoutput
)->e_flags
|= EF_S390_HIGH_GPRS
;