1 /* tc-sparc.c -- Assemble for the SPARC
2 Copyright (C) 1989, 90-95, 1996 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
26 /* careful, this file includes data *declarations* */
27 #include "opcode/sparc.h"
29 static void sparc_ip
PARAMS ((char *));
32 /* In a 32 bit environment, don't bump up to v9 unless necessary. */
34 static enum sparc_architecture initial_architecture
= v9
;
36 static enum sparc_architecture initial_architecture
= v6
;
39 static enum sparc_architecture initial_architecture
= v6
;
42 /* If sparc64 was the configured cpu, allow bumping up to v9 by default. */
44 static int can_bump_v9_p
= 1;
46 static int can_bump_v9_p
= 0;
49 static enum sparc_architecture current_architecture
;
50 static int architecture_requested
;
51 static int warn_on_bump
;
53 /* Non-zero if we are generating PIC code. */
56 extern int target_big_endian
;
58 /* handle of the OPCODE hash table */
59 static struct hash_control
*op_hash
;
61 static void s_data1
PARAMS ((void));
62 static void s_seg
PARAMS ((int));
63 static void s_proc
PARAMS ((int));
64 static void s_reserve
PARAMS ((int));
65 static void s_common
PARAMS ((int));
67 const pseudo_typeS md_pseudo_table
[] =
69 {"align", s_align_bytes
, 0}, /* Defaulting is invalid (0) */
70 {"common", s_common
, 0},
71 {"global", s_globl
, 0},
73 {"optim", s_ignore
, 0},
75 {"reserve", s_reserve
, 0},
84 /* these are specific to sparc/svr4 */
85 {"pushsection", obj_elf_section
, 0},
86 {"popsection", obj_elf_previous
, 0},
93 const int md_reloc_size
= 12; /* Size of relocation record */
95 /* This array holds the chars that always start a comment. If the
96 pre-processor is disabled, these aren't very useful */
97 const char comment_chars
[] = "!"; /* JF removed '|' from comment_chars */
99 /* This array holds the chars that only start a comment at the beginning of
100 a line. If the line seems to have the form '# 123 filename'
101 .line and .file directives will appear in the pre-processed output */
102 /* Note that input_file.c hand checks for '#' at the beginning of the
103 first line of the input file. This is because the compiler outputs
104 #NO_APP at the beginning of its output. */
105 /* Also note that comments started like this one will always
106 work if '/' isn't otherwise defined. */
107 const char line_comment_chars
[] = "#";
109 const char line_separator_chars
[] = "";
111 /* Chars that can be used to separate mant from exp in floating point nums */
112 const char EXP_CHARS
[] = "eE";
114 /* Chars that mean this number is a floating point constant */
117 const char FLT_CHARS
[] = "rRsSfFdDxXpP";
119 /* Also be aware that MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT may have to be
120 changed in read.c. Ideally it shouldn't have to know about it at all,
121 but nothing is ideal around here. */
123 static unsigned char octal
[256];
124 #define isoctal(c) octal[(unsigned char) (c)]
125 static unsigned char toHex
[256];
130 unsigned long opcode
;
131 struct nlist
*nlistp
;
134 bfd_reloc_code_real_type reloc
;
137 struct sparc_it the_insn
, set_insn
;
140 in_signed_range (val
, max
)
141 bfd_signed_vma val
, max
;
153 static void print_insn
PARAMS ((struct sparc_it
*insn
));
155 static int getExpression
PARAMS ((char *str
));
157 static char *expr_end
;
158 static int special_case
;
161 * Instructions that require wierd handling because they're longer than
164 #define SPECIAL_CASE_SET 1
165 #define SPECIAL_CASE_FDIV 2
168 * sort of like s_lcomm
172 static int max_alignment
= 15;
187 name
= input_line_pointer
;
188 c
= get_symbol_end ();
189 p
= input_line_pointer
;
193 if (*input_line_pointer
!= ',')
195 as_bad ("Expected comma after name");
196 ignore_rest_of_line ();
200 ++input_line_pointer
;
202 if ((size
= get_absolute_expression ()) < 0)
204 as_bad ("BSS length (%d.) <0! Ignored.", size
);
205 ignore_rest_of_line ();
210 symbolP
= symbol_find_or_make (name
);
213 if (strncmp (input_line_pointer
, ",\"bss\"", 6) != 0
214 && strncmp (input_line_pointer
, ",\".bss\"", 7) != 0)
216 as_bad ("bad .reserve segment -- expected BSS segment");
220 if (input_line_pointer
[2] == '.')
221 input_line_pointer
+= 7;
223 input_line_pointer
+= 6;
226 if (*input_line_pointer
== ',')
228 ++input_line_pointer
;
231 if (*input_line_pointer
== '\n')
233 as_bad ("Missing alignment");
237 align
= get_absolute_expression ();
239 if (align
> max_alignment
)
241 align
= max_alignment
;
242 as_warn ("Alignment too large: %d. assumed.", align
);
248 as_warn ("Alignment negative. 0 assumed.");
251 record_alignment (bss_section
, align
);
253 /* convert to a power of 2 alignment */
254 for (temp
= 0; (align
& 1) == 0; align
>>= 1, ++temp
);;
258 as_bad ("Alignment not a power of 2");
259 ignore_rest_of_line ();
261 } /* not a power of two */
264 } /* if has optional alignment */
268 if (!S_IS_DEFINED (symbolP
)
270 && S_GET_OTHER (symbolP
) == 0
271 && S_GET_DESC (symbolP
) == 0
278 segT current_seg
= now_seg
;
279 subsegT current_subseg
= now_subseg
;
281 subseg_set (bss_section
, 1); /* switch to bss */
284 frag_align (align
, 0); /* do alignment */
286 /* detach from old frag */
287 if (S_GET_SEGMENT(symbolP
) == bss_section
)
288 symbolP
->sy_frag
->fr_symbol
= NULL
;
290 symbolP
->sy_frag
= frag_now
;
291 pfrag
= frag_var (rs_org
, 1, 1, (relax_substateT
)0, symbolP
,
295 S_SET_SEGMENT (symbolP
, bss_section
);
297 subseg_set (current_seg
, current_subseg
);
302 as_warn("Ignoring attempt to re-define symbol %s",
303 S_GET_NAME (symbolP
));
304 } /* if not redefining */
306 demand_empty_rest_of_line ();
319 name
= input_line_pointer
;
320 c
= get_symbol_end ();
321 /* just after name is now '\0' */
322 p
= input_line_pointer
;
325 if (*input_line_pointer
!= ',')
327 as_bad ("Expected comma after symbol-name");
328 ignore_rest_of_line ();
331 input_line_pointer
++; /* skip ',' */
332 if ((temp
= get_absolute_expression ()) < 0)
334 as_bad (".COMMon length (%d.) <0! Ignored.", temp
);
335 ignore_rest_of_line ();
340 symbolP
= symbol_find_or_make (name
);
342 if (S_IS_DEFINED (symbolP
))
344 as_bad ("Ignoring attempt to re-define symbol");
345 ignore_rest_of_line ();
348 if (S_GET_VALUE (symbolP
) != 0)
350 if (S_GET_VALUE (symbolP
) != size
)
352 as_warn ("Length of .comm \"%s\" is already %ld. Not changed to %d.",
353 S_GET_NAME (symbolP
), (long) S_GET_VALUE (symbolP
), size
);
359 S_SET_VALUE (symbolP
, (valueT
) size
);
360 S_SET_EXTERNAL (symbolP
);
363 know (symbolP
->sy_frag
== &zero_address_frag
);
364 if (*input_line_pointer
!= ',')
366 as_bad ("Expected comma after common length");
367 ignore_rest_of_line ();
370 input_line_pointer
++;
372 if (*input_line_pointer
!= '"')
374 temp
= get_absolute_expression ();
376 if (temp
> max_alignment
)
378 temp
= max_alignment
;
379 as_warn ("Common alignment too large: %d. assumed", temp
);
385 as_warn ("Common alignment negative; 0 assumed");
397 old_subsec
= now_subseg
;
399 record_alignment (bss_section
, align
);
400 subseg_set (bss_section
, 0);
402 frag_align (align
, 0);
403 if (S_GET_SEGMENT (symbolP
) == bss_section
)
404 symbolP
->sy_frag
->fr_symbol
= 0;
405 symbolP
->sy_frag
= frag_now
;
406 p
= frag_var (rs_org
, 1, 1, (relax_substateT
) 0, symbolP
, size
,
409 S_SET_SEGMENT (symbolP
, bss_section
);
410 S_CLEAR_EXTERNAL (symbolP
);
411 subseg_set (old_sec
, old_subsec
);
417 S_SET_VALUE (symbolP
, (valueT
) size
);
419 S_SET_ALIGN (symbolP
, temp
);
421 S_SET_EXTERNAL (symbolP
);
422 /* should be common, but this is how gas does it for now */
423 S_SET_SEGMENT (symbolP
, bfd_und_section_ptr
);
428 input_line_pointer
++;
429 /* @@ Some use the dot, some don't. Can we get some consistency?? */
430 if (*input_line_pointer
== '.')
431 input_line_pointer
++;
432 /* @@ Some say data, some say bss. */
433 if (strncmp (input_line_pointer
, "bss\"", 4)
434 && strncmp (input_line_pointer
, "data\"", 5))
436 while (*--input_line_pointer
!= '"')
438 input_line_pointer
--;
439 goto bad_common_segment
;
441 while (*input_line_pointer
++ != '"')
443 goto allocate_common
;
445 demand_empty_rest_of_line ();
450 p
= input_line_pointer
;
451 while (*p
&& *p
!= '\n')
455 as_bad ("bad .common segment %s", input_line_pointer
+ 1);
457 input_line_pointer
= p
;
458 ignore_rest_of_line ();
468 if (strncmp (input_line_pointer
, "\"text\"", 6) == 0)
470 input_line_pointer
+= 6;
474 if (strncmp (input_line_pointer
, "\"data\"", 6) == 0)
476 input_line_pointer
+= 6;
480 if (strncmp (input_line_pointer
, "\"data1\"", 7) == 0)
482 input_line_pointer
+= 7;
486 if (strncmp (input_line_pointer
, "\"bss\"", 5) == 0)
488 input_line_pointer
+= 5;
489 /* We only support 2 segments -- text and data -- for now, so
490 things in the "bss segment" will have to go into data for now.
491 You can still allocate SEG_BSS stuff with .lcomm or .reserve. */
492 subseg_set (data_section
, 255); /* FIXME-SOMEDAY */
495 as_bad ("Unknown segment type");
496 demand_empty_rest_of_line ();
502 subseg_set (data_section
, 1);
503 demand_empty_rest_of_line ();
510 while (!is_end_of_line
[(unsigned char) *input_line_pointer
])
512 ++input_line_pointer
;
514 ++input_line_pointer
;
517 /* sparc64 priviledged registers */
519 struct priv_reg_entry
525 struct priv_reg_entry priv_reg_table
[] =
544 {"", -1}, /* end marker */
549 struct priv_reg_entry
*p
, *q
;
551 return strcmp (q
->name
, p
->name
);
554 /* This function is called once, at assembler startup time. It should
555 set up all the tables, etc. that the MD part of the assembler will need. */
560 register const char *retval
= NULL
;
562 register unsigned int i
= 0;
564 op_hash
= hash_new ();
566 while (i
< NUMOPCODES
)
568 const char *name
= sparc_opcodes
[i
].name
;
569 retval
= hash_insert (op_hash
, name
, &sparc_opcodes
[i
]);
572 fprintf (stderr
, "internal error: can't hash `%s': %s\n",
573 sparc_opcodes
[i
].name
, retval
);
578 if (sparc_opcodes
[i
].match
& sparc_opcodes
[i
].lose
)
580 fprintf (stderr
, "internal error: losing opcode: `%s' \"%s\"\n",
581 sparc_opcodes
[i
].name
, sparc_opcodes
[i
].args
);
586 while (i
< NUMOPCODES
587 && !strcmp (sparc_opcodes
[i
].name
, name
));
591 as_fatal ("Broken assembler. No assembly attempted.");
593 for (i
= '0'; i
< '8'; ++i
)
595 for (i
= '0'; i
<= '9'; ++i
)
597 for (i
= 'a'; i
<= 'f'; ++i
)
598 toHex
[i
] = i
+ 10 - 'a';
599 for (i
= 'A'; i
<= 'F'; ++i
)
600 toHex
[i
] = i
+ 10 - 'A';
602 qsort (priv_reg_table
, sizeof (priv_reg_table
) / sizeof (priv_reg_table
[0]),
603 sizeof (priv_reg_table
[0]), cmp_reg_entry
);
605 target_big_endian
= 1;
606 current_architecture
= initial_architecture
;
609 /* Called after all assembly has been done. */
614 /* If we bumped up in architecture, we need to change bfd's mach number. */
615 /* ??? We could delete this test, I think. */
616 if (current_architecture
!= initial_architecture
)
619 if (current_architecture
< v9
)
621 else if (current_architecture
== v9
)
622 bfd_set_arch_mach (stdoutput
, bfd_arch_sparc
, bfd_mach_sparc_v9
);
623 else if (current_architecture
== v9a
)
624 bfd_set_arch_mach (stdoutput
, bfd_arch_sparc
, bfd_mach_sparc_v9a
);
628 if (current_architecture
< v9
)
629 bfd_set_arch_mach (stdoutput
, bfd_arch_sparc
, bfd_mach_sparc
);
630 else if (current_architecture
== v9
)
631 bfd_set_arch_mach (stdoutput
, bfd_arch_sparc
, bfd_mach_sparc_v8plus
);
632 else if (current_architecture
== v9a
)
633 bfd_set_arch_mach (stdoutput
, bfd_arch_sparc
, bfd_mach_sparc_v8plusa
);
650 /* See if "set" operand is absolute and small; skip sethi if so. */
651 if (special_case
== SPECIAL_CASE_SET
652 && the_insn
.exp
.X_op
== O_constant
)
654 if (the_insn
.exp
.X_add_number
>= -(1 << 12)
655 && the_insn
.exp
.X_add_number
< (1 << 12))
657 the_insn
.opcode
= 0x80102000 /* or %g0,imm,... */
658 | (the_insn
.opcode
& 0x3E000000) /* dest reg */
659 | (the_insn
.exp
.X_add_number
& 0x1FFF); /* imm */
660 special_case
= 0; /* No longer special */
661 the_insn
.reloc
= BFD_RELOC_NONE
; /* No longer relocated */
666 /* put out the opcode */
667 md_number_to_chars (toP
, (valueT
) the_insn
.opcode
, 4);
669 /* put out the symbol-dependent stuff */
670 if (the_insn
.reloc
!= BFD_RELOC_NONE
)
672 fix_new_exp (frag_now
, /* which frag */
673 (toP
- frag_now
->fr_literal
), /* where */
680 switch (special_case
)
682 case SPECIAL_CASE_SET
:
684 assert (the_insn
.reloc
== BFD_RELOC_HI22
);
685 /* See if "set" operand has no low-order bits; skip OR if so. */
686 if (the_insn
.exp
.X_op
== O_constant
687 && ((the_insn
.exp
.X_add_number
& 0x3FF) == 0))
690 rsd
= (the_insn
.opcode
>> 25) & 0x1f;
691 the_insn
.opcode
= 0x80102000 | (rsd
<< 25) | (rsd
<< 14);
692 md_number_to_chars (toP
, (valueT
) the_insn
.opcode
, 4);
693 fix_new_exp (frag_now
, /* which frag */
694 (toP
- frag_now
->fr_literal
), /* where */
701 case SPECIAL_CASE_FDIV
:
702 /* According to information leaked from Sun, the "fdiv" instructions
703 on early SPARC machines would produce incorrect results sometimes.
704 The workaround is to add an fmovs of the destination register to
705 itself just after the instruction. This was true on machines
706 with Weitek 1165 float chips, such as the Sun-4/260 and /280. */
708 assert (the_insn
.reloc
== BFD_RELOC_NONE
);
710 rsd
= (the_insn
.opcode
>> 25) & 0x1f;
711 the_insn
.opcode
= 0x81A00020 | (rsd
<< 25) | rsd
; /* fmovs dest,dest */
712 md_number_to_chars (toP
, (valueT
) the_insn
.opcode
, 4);
719 as_fatal ("failed sanity check.");
723 /* Implement big shift right. */
729 if (sizeof (bfd_vma
) <= 4 && amount
>= 32)
730 as_fatal ("Support for 64-bit arithmetic not compiled in.");
731 return val
>> amount
;
734 /* Parse an argument that can be expressed as a keyword.
736 The result is a boolean indicating success.
737 If successful, INPUT_POINTER is updated. */
740 parse_keyword_arg (lookup_fn
, input_pointerP
, valueP
)
742 char **input_pointerP
;
749 for (q
= p
+ (*p
== '#'); isalpha (*q
) || *q
== '_'; ++q
)
753 value
= (*lookup_fn
) (p
);
762 /* Parse an argument that is a constant expression.
763 The result is a boolean indicating success. */
766 parse_const_expr_arg (input_pointerP
, valueP
)
767 char **input_pointerP
;
770 char *save
= input_line_pointer
;
773 input_line_pointer
= *input_pointerP
;
774 /* The next expression may be something other than a constant
775 (say if we're not processing the right variant of the insn).
776 Don't call expression unless we're sure it will succeed as it will
777 signal an error (which we want to defer until later). */
778 /* FIXME: It might be better to define md_operand and have it recognize
779 things like %asi, etc. but continuing that route through to the end
781 if (*input_line_pointer
== '%')
783 input_line_pointer
= save
;
787 *input_pointerP
= input_line_pointer
;
788 input_line_pointer
= save
;
789 if (exp
.X_op
!= O_constant
)
791 *valueP
= exp
.X_add_number
;
799 char *error_message
= "";
803 const struct sparc_opcode
*insn
;
805 unsigned long opcode
;
806 unsigned int mask
= 0;
809 long immediate_max
= 0;
812 for (s
= str
; islower (*s
) || (*s
>= '0' && *s
<= '3'); ++s
)
830 as_fatal ("Unknown opcode: `%s'", str
);
832 insn
= (struct sparc_opcode
*) hash_find (op_hash
, str
);
835 as_bad ("Unknown opcode: `%s'", str
);
846 opcode
= insn
->match
;
847 memset (&the_insn
, '\0', sizeof (the_insn
));
848 the_insn
.reloc
= BFD_RELOC_NONE
;
852 * Build the opcode, checking as we go to make
853 * sure that the operands match
855 for (args
= insn
->args
;; ++args
)
863 /* Parse a series of masks. */
870 if (! parse_keyword_arg (sparc_encode_membar
, &s
,
873 error_message
= ": invalid membar mask name";
877 while (*s
== ' ') { ++s
; continue; }
878 if (*s
== '|' || *s
== '+')
880 while (*s
== ' ') { ++s
; continue; }
885 if (! parse_const_expr_arg (&s
, &kmask
))
887 error_message
= ": invalid membar mask expression";
890 if (kmask
< 0 || kmask
> 127)
892 error_message
= ": invalid membar mask number";
897 opcode
|= MEMBAR (kmask
);
905 /* Parse a prefetch function. */
908 if (! parse_keyword_arg (sparc_encode_prefetch
, &s
, &fcn
))
910 error_message
= ": invalid prefetch function name";
916 if (! parse_const_expr_arg (&s
, &fcn
))
918 error_message
= ": invalid prefetch function expression";
921 if (fcn
< 0 || fcn
> 31)
923 error_message
= ": invalid prefetch function number";
933 /* Parse a sparc64 privileged register. */
936 struct priv_reg_entry
*p
= priv_reg_table
;
937 unsigned int len
= 9999999; /* init to make gcc happy */
940 while (p
->name
[0] > s
[0])
942 while (p
->name
[0] == s
[0])
944 len
= strlen (p
->name
);
945 if (strncmp (p
->name
, s
, len
) == 0)
949 if (p
->name
[0] != s
[0])
951 error_message
= ": unrecognizable privileged register";
955 opcode
|= (p
->regnum
<< 14);
957 opcode
|= (p
->regnum
<< 25);
963 error_message
= ": unrecognizable privileged register";
969 if (strncmp (s
, "%asr", 4) == 0)
979 num
= num
* 10 + *s
- '0';
983 if (num
< 16 || 31 < num
)
985 error_message
= ": asr number must be between 15 and 31";
989 opcode
|= (*args
== 'M' ? RS1 (num
) : RD (num
));
994 error_message
= ": expecting %asrN";
996 } /* if %asr followed by a number. */
1002 the_insn
.reloc
= BFD_RELOC_SPARC_11
;
1003 immediate_max
= 0x03FF;
1007 the_insn
.reloc
= BFD_RELOC_SPARC_10
;
1008 immediate_max
= 0x01FF;
1012 the_insn
.reloc
= /* RELOC_WDISP2_14 */ BFD_RELOC_SPARC_WDISP16
;
1017 the_insn
.reloc
= BFD_RELOC_SPARC_WDISP19
;
1022 if (*s
== 'p' && s
[1] == 'n')
1030 if (*s
== 'p' && s
[1] == 't')
1042 if (strncmp (s
, "%icc", 4) == 0)
1054 if (strncmp (s
, "%xcc", 4) == 0)
1066 if (strncmp (s
, "%fcc0", 5) == 0)
1078 if (strncmp (s
, "%fcc1", 5) == 0)
1090 if (strncmp (s
, "%fcc2", 5) == 0)
1102 if (strncmp (s
, "%fcc3", 5) == 0)
1110 if (strncmp (s
, "%pc", 3) == 0)
1118 if (strncmp (s
, "%tick", 5) == 0)
1125 case '\0': /* end of args */
1144 case '[': /* these must match exactly */
1152 case '#': /* must be at least one digit */
1155 while (isdigit (*s
))
1163 case 'C': /* coprocessor state register */
1164 if (strncmp (s
, "%csr", 4) == 0)
1171 case 'b': /* next operand is a coprocessor register */
1174 if (*s
++ == '%' && *s
++ == 'c' && isdigit (*s
))
1179 mask
= 10 * (mask
- '0') + (*s
++ - '0');
1193 opcode
|= mask
<< 14;
1201 opcode
|= mask
<< 25;
1207 case 'r': /* next operand must be a register */
1216 case 'f': /* frame pointer */
1224 case 'g': /* global register */
1225 if (isoctal (c
= *s
++))
1232 case 'i': /* in register */
1233 if (isoctal (c
= *s
++))
1235 mask
= c
- '0' + 24;
1240 case 'l': /* local register */
1241 if (isoctal (c
= *s
++))
1243 mask
= (c
- '0' + 16);
1248 case 'o': /* out register */
1249 if (isoctal (c
= *s
++))
1251 mask
= (c
- '0' + 8);
1256 case 's': /* stack pointer */
1264 case 'r': /* any register */
1265 if (!isdigit (c
= *s
++))
1282 if ((c
= 10 * (c
- '0') + (*s
++ - '0')) >= 32)
1298 /* Got the register, now figure out where
1299 it goes in the opcode. */
1304 opcode
|= mask
<< 14;
1312 opcode
|= mask
<< 25;
1316 opcode
|= (mask
<< 25) | (mask
<< 14);
1322 case 'e': /* next operand is a floating point register */
1337 && ((format
= *s
) == 'f')
1340 for (mask
= 0; isdigit (*s
); ++s
)
1342 mask
= 10 * mask
+ (*s
- '0');
1343 } /* read the number */
1351 } /* register must be even numbered */
1359 } /* register must be multiple of 4 */
1364 error_message
= ": There are only 64 f registers; [0-63]";
1366 error_message
= ": There are only 32 f registers; [0-31]";
1369 else if (mask
>= 32)
1374 mask
-= 31; /* wrap high bit */
1378 error_message
= ": There are only 32 f registers; [0-31]";
1386 } /* if not an 'f' register. */
1393 opcode
|= RS1 (mask
);
1400 opcode
|= RS2 (mask
);
1406 opcode
|= RD (mask
);
1415 if (strncmp (s
, "%fsr", 4) == 0)
1422 case 'h': /* high 22 bits */
1423 the_insn
.reloc
= BFD_RELOC_HI22
;
1426 case 'l': /* 22 bit PC relative immediate */
1427 the_insn
.reloc
= BFD_RELOC_SPARC_WDISP22
;
1431 case 'L': /* 30 bit immediate */
1432 the_insn
.reloc
= BFD_RELOC_32_PCREL_S2
;
1436 case 'n': /* 22 bit immediate */
1437 the_insn
.reloc
= BFD_RELOC_SPARC22
;
1440 case 'i': /* 13 bit immediate */
1441 the_insn
.reloc
= BFD_RELOC_SPARC13
;
1442 immediate_max
= 0x0FFF;
1451 if ((c
= s
[1]) == 'h' && s
[2] == 'i')
1453 the_insn
.reloc
= BFD_RELOC_HI22
;
1456 else if (c
== 'l' && s
[2] == 'o')
1458 the_insn
.reloc
= BFD_RELOC_LO10
;
1465 the_insn
.reloc
= BFD_RELOC_SPARC_HH22
;
1473 the_insn
.reloc
= BFD_RELOC_SPARC_HM10
;
1480 /* Note that if the getExpression() fails, we will still
1481 have created U entries in the symbol table for the
1482 'symbols' in the input string. Try not to create U
1483 symbols for registers, etc. */
1485 /* This stuff checks to see if the expression ends in
1486 +%reg. If it does, it removes the register from
1487 the expression, and re-sets 's' to point to the
1492 for (s1
= s
; *s1
&& *s1
!= ',' && *s1
!= ']'; s1
++);;
1494 if (s1
!= s
&& isdigit (s1
[-1]))
1496 if (s1
[-2] == '%' && s1
[-3] == '+')
1500 (void) getExpression (s
);
1505 else if (strchr ("goli0123456789", s1
[-2]) && s1
[-3] == '%' && s1
[-4] == '+')
1509 (void) getExpression (s
);
1516 (void) getExpression (s
);
1519 if (the_insn
.exp
.X_op
== O_constant
1520 && the_insn
.exp
.X_add_symbol
== 0
1521 && the_insn
.exp
.X_op_symbol
== 0)
1523 /* Handle %uhi/%ulo by moving the upper word to the lower
1524 one and pretending it's %hi/%lo. We also need to watch
1525 for %hi/%lo: the top word needs to be zeroed otherwise
1526 fixup_segment will complain the value is too big. */
1527 switch (the_insn
.reloc
)
1529 case BFD_RELOC_SPARC_HH22
:
1530 the_insn
.reloc
= BFD_RELOC_HI22
;
1531 the_insn
.exp
.X_add_number
= BSR (the_insn
.exp
.X_add_number
, 32);
1533 case BFD_RELOC_SPARC_HM10
:
1534 the_insn
.reloc
= BFD_RELOC_LO10
;
1535 the_insn
.exp
.X_add_number
= BSR (the_insn
.exp
.X_add_number
, 32);
1537 case BFD_RELOC_HI22
:
1538 case BFD_RELOC_LO10
:
1539 the_insn
.exp
.X_add_number
&= 0xffffffff;
1545 /* For pc-relative call instructions, we reject
1546 constants to get better code. */
1548 && the_insn
.reloc
== BFD_RELOC_32_PCREL_S2
1549 && in_signed_range (the_insn
.exp
.X_add_number
, 0x3fff)
1552 error_message
= ": PC-relative operand can't be a constant";
1555 /* Check for invalid constant values. Don't warn if
1556 constant was inside %hi or %lo, since these
1557 truncate the constant to fit. */
1558 if (immediate_max
!= 0
1559 && the_insn
.reloc
!= BFD_RELOC_LO10
1560 && the_insn
.reloc
!= BFD_RELOC_HI22
1561 && !in_signed_range (the_insn
.exp
.X_add_number
,
1566 /* Who knows? After relocation, we may be within
1567 range. Let the linker figure it out. */
1569 the_insn
.exp
.X_op
= O_symbol
;
1570 the_insn
.exp
.X_add_symbol
= section_symbol (absolute_section
);
1573 /* Immediate value is non-pcrel, and out of
1575 as_bad ("constant value %ld out of range (%ld .. %ld)",
1576 the_insn
.exp
.X_add_number
,
1577 ~immediate_max
, immediate_max
);
1581 /* Reset to prevent extraneous range check. */
1601 if (! parse_keyword_arg (sparc_encode_asi
, &s
, &asi
))
1603 error_message
= ": invalid ASI name";
1609 if (! parse_const_expr_arg (&s
, &asi
))
1611 error_message
= ": invalid ASI expression";
1614 if (asi
< 0 || asi
> 255)
1616 error_message
= ": invalid ASI number";
1620 opcode
|= ASI (asi
);
1622 } /* alternate space */
1625 if (strncmp (s
, "%psr", 4) == 0)
1632 case 'q': /* floating point queue */
1633 if (strncmp (s
, "%fq", 3) == 0)
1640 case 'Q': /* coprocessor queue */
1641 if (strncmp (s
, "%cq", 3) == 0)
1649 if (strcmp (str
, "set") == 0)
1651 special_case
= SPECIAL_CASE_SET
;
1654 else if (strncmp (str
, "fdiv", 4) == 0)
1656 special_case
= SPECIAL_CASE_FDIV
;
1662 if (strncmp (s
, "%asi", 4) != 0)
1668 if (strncmp (s
, "%fprs", 5) != 0)
1674 if (strncmp (s
, "%ccr", 4) != 0)
1680 if (strncmp (s
, "%tbr", 4) != 0)
1686 if (strncmp (s
, "%wim", 4) != 0)
1693 char *push
= input_line_pointer
;
1696 input_line_pointer
= s
;
1698 if (e
.X_op
== O_constant
)
1700 int n
= e
.X_add_number
;
1701 if (n
!= e
.X_add_number
|| (n
& ~0x1ff) != 0)
1702 as_bad ("OPF immediate operand out of range (0-0x1ff)");
1704 opcode
|= e
.X_add_number
<< 5;
1707 as_bad ("non-immediate OPF operand, ignored");
1708 s
= input_line_pointer
;
1709 input_line_pointer
= push
;
1714 if (strncmp (s
, "%y", 2) != 0)
1720 as_fatal ("failed sanity check.");
1721 } /* switch on arg code */
1723 /* Break out of for() loop. */
1725 } /* for each arg that we expect */
1730 /* Args don't match. */
1731 if (((unsigned) (&insn
[1] - sparc_opcodes
)) < NUMOPCODES
1732 && (insn
->name
== insn
[1].name
1733 || !strcmp (insn
->name
, insn
[1].name
)))
1741 as_bad ("Illegal operands%s", error_message
);
1747 if (insn
->architecture
> current_architecture
1748 || (insn
->architecture
!= current_architecture
1749 && current_architecture
> v8
)
1750 || (v9_arg_p
&& current_architecture
< v9
))
1752 enum sparc_architecture needed_architecture
=
1753 ((v9_arg_p
&& insn
->architecture
< v9
)
1754 ? v9
: insn
->architecture
);
1756 if ((!architecture_requested
|| warn_on_bump
)
1757 && !ARCHITECTURES_CONFLICT_P (current_architecture
,
1758 needed_architecture
)
1759 && !ARCHITECTURES_CONFLICT_P (needed_architecture
,
1760 current_architecture
)
1761 && (needed_architecture
< v9
|| can_bump_v9_p
))
1765 as_warn ("architecture bumped from \"%s\" to \"%s\" on \"%s\"",
1766 architecture_pname
[current_architecture
],
1767 architecture_pname
[needed_architecture
],
1771 if (needed_architecture
> current_architecture
)
1772 current_architecture
= needed_architecture
;
1776 as_bad ("Architecture mismatch on \"%s\".", str
);
1777 as_tsktsk (" (Requires %s; current architecture is %s.)",
1778 architecture_pname
[needed_architecture
],
1779 architecture_pname
[current_architecture
]);
1781 } /* if bump ok else error */
1782 } /* if architecture higher */
1786 } /* forever looking for a match */
1788 the_insn
.opcode
= opcode
;
1798 save_in
= input_line_pointer
;
1799 input_line_pointer
= str
;
1800 seg
= expression (&the_insn
.exp
);
1801 if (seg
!= absolute_section
1802 && seg
!= text_section
1803 && seg
!= data_section
1804 && seg
!= bss_section
1805 && seg
!= undefined_section
)
1807 the_insn
.error
= "bad segment";
1808 expr_end
= input_line_pointer
;
1809 input_line_pointer
= save_in
;
1812 expr_end
= input_line_pointer
;
1813 input_line_pointer
= save_in
;
1815 } /* getExpression() */
1819 This is identical to the md_atof in m68k.c. I think this is right,
1822 Turn a string in input_line_pointer into a floating point constant of type
1823 type, and store the appropriate bytes in *litP. The number of LITTLENUMS
1824 emitted is stored in *sizeP . An error message is returned, or NULL on OK.
1827 /* Equal to MAX_PRECISION in atof-ieee.c */
1828 #define MAX_LITTLENUMS 6
1831 md_atof (type
, litP
, sizeP
)
1837 LITTLENUM_TYPE words
[MAX_LITTLENUMS
];
1838 LITTLENUM_TYPE
*wordP
;
1871 return "Bad call to MD_ATOF()";
1873 t
= atof_ieee (input_line_pointer
, type
, words
);
1875 input_line_pointer
= t
;
1876 *sizeP
= prec
* sizeof (LITTLENUM_TYPE
);
1877 for (wordP
= words
; prec
--;)
1879 md_number_to_chars (litP
, (valueT
) (*wordP
++), sizeof (LITTLENUM_TYPE
));
1880 litP
+= sizeof (LITTLENUM_TYPE
);
1886 * Write out big-endian.
1889 md_number_to_chars (buf
, val
, n
)
1894 number_to_chars_bigendian (buf
, val
, n
);
1897 /* Apply a fixS to the frags, now that we know the value it ought to
1901 md_apply_fix (fixP
, value
)
1905 char *buf
= fixP
->fx_where
+ fixP
->fx_frag
->fr_literal
;
1910 assert (fixP
->fx_r_type
< BFD_RELOC_UNUSED
);
1912 fixP
->fx_addnumber
= val
; /* Remember value for emit_reloc */
1915 /* FIXME: SPARC ELF relocations don't use an addend in the data
1916 field itself. This whole approach should be somehow combined
1917 with the calls to bfd_perform_relocation. Also, the value passed
1918 in by fixup_segment includes the value of a defined symbol. We
1919 don't want to include the value of an externally visible symbol. */
1920 if (fixP
->fx_addsy
!= NULL
)
1922 if ((S_IS_EXTERN (fixP
->fx_addsy
)
1923 || (sparc_pic_code
&& ! fixP
->fx_pcrel
))
1924 && S_GET_SEGMENT (fixP
->fx_addsy
) != absolute_section
1925 && S_GET_SEGMENT (fixP
->fx_addsy
) != undefined_section
1926 && ! bfd_is_com_section (S_GET_SEGMENT (fixP
->fx_addsy
)))
1927 fixP
->fx_addnumber
-= S_GET_VALUE (fixP
->fx_addsy
);
1932 /* This is a hack. There should be a better way to
1933 handle this. Probably in terms of howto fields, once
1934 we can look at these fixups in terms of howtos. */
1935 if (fixP
->fx_r_type
== BFD_RELOC_32_PCREL_S2
&& fixP
->fx_addsy
)
1936 val
+= fixP
->fx_where
+ fixP
->fx_frag
->fr_address
;
1939 /* FIXME: More ridiculous gas reloc hacking. If we are going to
1940 generate a reloc, then we just want to let the reloc addend set
1941 the value. We do not want to also stuff the addend into the
1942 object file. Including the addend in the object file works when
1943 doing a static link, because the linker will ignore the object
1944 file contents. However, the dynamic linker does not ignore the
1945 object file contents. */
1946 if (fixP
->fx_addsy
!= NULL
1947 && fixP
->fx_r_type
!= BFD_RELOC_32_PCREL_S2
)
1950 /* When generating PIC code, we do not want an addend for a reloc
1951 against a local symbol. We adjust fx_addnumber to cancel out the
1952 value already included in val, and to also cancel out the
1953 adjustment which bfd_install_relocation will create. */
1955 && fixP
->fx_r_type
!= BFD_RELOC_32_PCREL_S2
1956 && fixP
->fx_addsy
!= NULL
1957 && ! S_IS_COMMON (fixP
->fx_addsy
)
1958 && (fixP
->fx_addsy
->bsym
->flags
& BSF_SECTION_SYM
) == 0)
1959 fixP
->fx_addnumber
-= 2 * S_GET_VALUE (fixP
->fx_addsy
);
1962 switch (fixP
->fx_r_type
)
1976 case BFD_RELOC_32_PCREL_S2
:
1978 if (! sparc_pic_code
1979 || fixP
->fx_addsy
== NULL
1980 || (fixP
->fx_addsy
->bsym
->flags
& BSF_SECTION_SYM
) != 0)
1982 buf
[0] |= (val
>> 24) & 0x3f;
1983 buf
[1] = (val
>> 16);
1990 bfd_vma valh
= BSR (val
, 32);
1991 buf
[0] = valh
>> 24;
1992 buf
[1] = valh
>> 16;
2002 case BFD_RELOC_SPARC_11
:
2003 if (((val
> 0) && (val
& ~0x7ff))
2004 || ((val
< 0) && (~(val
- 1) & ~0x7ff)))
2006 as_bad ("relocation overflow.");
2009 buf
[2] |= (val
>> 8) & 0x7;
2010 buf
[3] = val
& 0xff;
2013 case BFD_RELOC_SPARC_10
:
2014 if (((val
> 0) && (val
& ~0x3ff))
2015 || ((val
< 0) && (~(val
- 1) & ~0x3ff)))
2017 as_bad ("relocation overflow.");
2020 buf
[2] |= (val
>> 8) & 0x3;
2021 buf
[3] = val
& 0xff;
2024 case BFD_RELOC_SPARC_WDISP16
:
2025 if (((val
> 0) && (val
& ~0x3fffc))
2026 || ((val
< 0) && (~(val
- 1) & ~0x3fffc)))
2028 as_bad ("relocation overflow.");
2031 val
= (val
>>= 2) + 1;
2032 buf
[1] |= ((val
>> 14) & 0x3) << 4;
2033 buf
[2] |= (val
>> 8) & 0x3f;
2034 buf
[3] = val
& 0xff;
2037 case BFD_RELOC_SPARC_WDISP19
:
2038 if (((val
> 0) && (val
& ~0x1ffffc))
2039 || ((val
< 0) && (~(val
- 1) & ~0x1ffffc)))
2041 as_bad ("relocation overflow.");
2044 val
= (val
>>= 2) + 1;
2045 buf
[1] |= (val
>> 16) & 0x7;
2046 buf
[2] = (val
>> 8) & 0xff;
2047 buf
[3] = val
& 0xff;
2050 case BFD_RELOC_SPARC_HH22
:
2051 val
= BSR (val
, 32);
2052 /* intentional fallthrough */
2054 case BFD_RELOC_SPARC_LM22
:
2055 case BFD_RELOC_HI22
:
2056 if (!fixP
->fx_addsy
)
2058 buf
[1] |= (val
>> 26) & 0x3f;
2069 case BFD_RELOC_SPARC22
:
2070 if (val
& ~0x003fffff)
2072 as_bad ("relocation overflow");
2074 buf
[1] |= (val
>> 16) & 0x3f;
2076 buf
[3] = val
& 0xff;
2079 case BFD_RELOC_SPARC_HM10
:
2080 val
= BSR (val
, 32);
2081 /* intentional fallthrough */
2083 case BFD_RELOC_LO10
:
2084 if (!fixP
->fx_addsy
)
2086 buf
[2] |= (val
>> 8) & 0x03;
2093 case BFD_RELOC_SPARC13
:
2094 if (! in_signed_range (val
, 0x1fff))
2095 as_bad ("relocation overflow");
2097 buf
[2] |= (val
>> 8) & 0x1f;
2101 case BFD_RELOC_SPARC_WDISP22
:
2102 val
= (val
>> 2) + 1;
2104 case BFD_RELOC_SPARC_BASE22
:
2105 buf
[1] |= (val
>> 16) & 0x3f;
2110 case BFD_RELOC_NONE
:
2112 as_bad ("bad or unhandled relocation type: 0x%02x", fixP
->fx_r_type
);
2116 /* Are we finished with this relocation now? */
2117 if (fixP
->fx_addsy
== 0 && !fixP
->fx_pcrel
)
2123 /* Translate internal representation of relocation info to BFD target
2126 tc_gen_reloc (section
, fixp
)
2131 bfd_reloc_code_real_type code
;
2133 reloc
= (arelent
*) bfd_alloc_by_size_t (stdoutput
, sizeof (arelent
));
2134 assert (reloc
!= 0);
2136 reloc
->sym_ptr_ptr
= &fixp
->fx_addsy
->bsym
;
2137 reloc
->address
= fixp
->fx_frag
->fr_address
+ fixp
->fx_where
;
2139 switch (fixp
->fx_r_type
)
2143 case BFD_RELOC_HI22
:
2144 case BFD_RELOC_LO10
:
2145 case BFD_RELOC_32_PCREL_S2
:
2146 case BFD_RELOC_SPARC13
:
2147 case BFD_RELOC_SPARC_BASE13
:
2148 case BFD_RELOC_SPARC_WDISP16
:
2149 case BFD_RELOC_SPARC_WDISP19
:
2150 case BFD_RELOC_SPARC_WDISP22
:
2152 case BFD_RELOC_SPARC_10
:
2153 case BFD_RELOC_SPARC_11
:
2154 case BFD_RELOC_SPARC_HH22
:
2155 case BFD_RELOC_SPARC_HM10
:
2156 case BFD_RELOC_SPARC_LM22
:
2157 case BFD_RELOC_SPARC_PC_HH22
:
2158 case BFD_RELOC_SPARC_PC_HM10
:
2159 case BFD_RELOC_SPARC_PC_LM22
:
2160 code
= fixp
->fx_r_type
;
2166 #if defined (OBJ_ELF) || defined (OBJ_AOUT)
2167 /* If we are generating PIC code, we need to generate a different
2171 #define GOT_NAME "_GLOBAL_OFFSET_TABLE_"
2173 #define GOT_NAME "__GLOBAL_OFFSET_TABLE_"
2180 case BFD_RELOC_32_PCREL_S2
:
2181 if (! S_IS_DEFINED (fixp
->fx_addsy
)
2182 || S_IS_EXTERNAL (fixp
->fx_addsy
))
2183 code
= BFD_RELOC_SPARC_WPLT30
;
2185 case BFD_RELOC_HI22
:
2186 if (fixp
->fx_addsy
!= NULL
2187 && strcmp (S_GET_NAME (fixp
->fx_addsy
), GOT_NAME
) == 0)
2188 code
= BFD_RELOC_SPARC_PC22
;
2190 code
= BFD_RELOC_SPARC_GOT22
;
2192 case BFD_RELOC_LO10
:
2193 if (fixp
->fx_addsy
!= NULL
2194 && strcmp (S_GET_NAME (fixp
->fx_addsy
), GOT_NAME
) == 0)
2195 code
= BFD_RELOC_SPARC_PC10
;
2197 code
= BFD_RELOC_SPARC_GOT10
;
2199 case BFD_RELOC_SPARC13
:
2200 code
= BFD_RELOC_SPARC_GOT13
;
2206 #endif /* defined (OBJ_ELF) || defined (OBJ_AOUT) */
2208 reloc
->howto
= bfd_reloc_type_lookup (stdoutput
, code
);
2209 if (reloc
->howto
== 0)
2211 as_bad_where (fixp
->fx_file
, fixp
->fx_line
,
2212 "internal error: can't export reloc type %d (`%s')",
2213 fixp
->fx_r_type
, bfd_get_reloc_code_name (code
));
2217 /* @@ Why fx_addnumber sometimes and fx_offset other times? */
2220 if (reloc
->howto
->pc_relative
== 0
2221 || code
== BFD_RELOC_SPARC_PC10
2222 || code
== BFD_RELOC_SPARC_PC22
)
2223 reloc
->addend
= fixp
->fx_addnumber
;
2225 reloc
->addend
= fixp
->fx_offset
- reloc
->address
;
2227 #else /* elf or coff */
2229 if (reloc
->howto
->pc_relative
== 0
2230 || code
== BFD_RELOC_SPARC_PC10
2231 || code
== BFD_RELOC_SPARC_PC22
)
2232 reloc
->addend
= fixp
->fx_addnumber
;
2233 else if ((fixp
->fx_addsy
->bsym
->flags
& BSF_SECTION_SYM
) != 0)
2234 reloc
->addend
= (section
->vma
2235 + fixp
->fx_addnumber
2236 + md_pcrel_from (fixp
));
2238 reloc
->addend
= fixp
->fx_offset
;
2246 /* for debugging only */
2249 struct sparc_it
*insn
;
2251 const char *const Reloc
[] = {
2280 fprintf (stderr
, "ERROR: %s\n");
2281 fprintf (stderr
, "opcode=0x%08x\n", insn
->opcode
);
2282 fprintf (stderr
, "reloc = %s\n", Reloc
[insn
->reloc
]);
2283 fprintf (stderr
, "exp = {\n");
2284 fprintf (stderr
, "\t\tX_add_symbol = %s\n",
2285 ((insn
->exp
.X_add_symbol
!= NULL
)
2286 ? ((S_GET_NAME (insn
->exp
.X_add_symbol
) != NULL
)
2287 ? S_GET_NAME (insn
->exp
.X_add_symbol
)
2290 fprintf (stderr
, "\t\tX_sub_symbol = %s\n",
2291 ((insn
->exp
.X_op_symbol
!= NULL
)
2292 ? (S_GET_NAME (insn
->exp
.X_op_symbol
)
2293 ? S_GET_NAME (insn
->exp
.X_op_symbol
)
2296 fprintf (stderr
, "\t\tX_add_number = %d\n",
2297 insn
->exp
.X_add_number
);
2298 fprintf (stderr
, "}\n");
2304 * Invocation line includes a switch not recognized by the base assembler.
2305 * See if it's a processor-specific option. These are:
2308 * Warn on architecture bumps. See also -A.
2310 * -Av6, -Av7, -Av8, -Av9, -Asparclite
2311 * Select the architecture. Instructions or features not
2312 * supported by the selected architecture cause fatal errors.
2314 * The default is to start at v6, and bump the architecture up
2315 * whenever an instruction is seen at a higher level. If sparc64
2316 * was not the target cpu, v9 is not bumped up to, the user must
2319 * If -bump is specified, a warning is printing when bumping to
2322 * If an architecture is specified, all instructions must match
2323 * that architecture. Any higher level instructions are flagged
2326 * If both an architecture and -bump are specified, the
2327 * architecture starts at the specified level, but bumps are
2331 * Bumping between incompatible architectures is always an
2332 * error. For example, from sparclite to v9.
2336 CONST
char *md_shortopts
= "A:K:VQ:sq";
2339 CONST
char *md_shortopts
= "A:k";
2341 CONST
char *md_shortopts
= "A:";
2344 struct option md_longopts
[] = {
2345 #define OPTION_BUMP (OPTION_MD_BASE)
2346 {"bump", no_argument
, NULL
, OPTION_BUMP
},
2347 #define OPTION_SPARC (OPTION_MD_BASE + 1)
2348 {"sparc", no_argument
, NULL
, OPTION_SPARC
},
2349 {NULL
, no_argument
, NULL
, 0}
2351 size_t md_longopts_size
= sizeof(md_longopts
);
2354 md_parse_option (c
, arg
)
2369 for (arch
= architecture_pname
; *arch
!= NULL
; ++arch
)
2371 if (strcmp (p
, *arch
) == 0)
2377 as_bad ("invalid architecture -A%s", p
);
2382 enum sparc_architecture new_arch
= arch
- architecture_pname
;
2384 initial_architecture
= new_arch
;
2385 architecture_requested
= 1;
2387 /* ??? May wish an option to explicitly set `can_bump_v9_p'. */
2388 /* Set `can_bump_v9_p' if v9: we assume that if the current
2389 architecture is v9, it's set. */
2399 /* Ignore -sparc, used by SunOS make default .s.o rule. */
2410 print_version_id ();
2414 /* Qy - do emit .comment
2415 Qn - do not emit .comment */
2419 /* use .stab instead of .stab.excl */
2423 /* quick -- native assembler does fewer checks */
2427 if (strcmp (arg
, "PIC") != 0)
2428 as_warn ("Unrecognized option following -K");
2442 md_show_usage (stream
)
2446 fprintf(stream
, "SPARC options:\n");
2447 for (arch
= architecture_pname
; *arch
; arch
++)
2449 if (arch
!= architecture_pname
)
2450 fprintf (stream
, " | ");
2451 fprintf (stream
, "-A%s", *arch
);
2453 fprintf (stream
, "\n\
2454 specify variant of SPARC architecture\n\
2455 -bump warn when assembler switches architectures\n\
2459 -k generate PIC\n");
2463 -KPIC generate PIC\n\
2464 -V print assembler version number\n\
2471 /* We have no need to default values of symbols. */
2475 md_undefined_symbol (name
)
2479 } /* md_undefined_symbol() */
2481 /* Round up a section size to the appropriate boundary. */
2483 md_section_align (segment
, size
)
2488 /* This is not right for ELF; a.out wants it, and COFF will force
2489 the alignment anyways. */
2490 valueT align
= ((valueT
) 1
2491 << (valueT
) bfd_get_section_alignment (stdoutput
, segment
));
2493 /* turn alignment value into a mask */
2495 newsize
= (size
+ align
) & ~align
;
2502 /* Exactly what point is a PC-relative offset relative TO?
2503 On the sparc, they're relative to the address of the offset, plus
2504 its size. This gets us to the following instruction.
2505 (??? Is this right? FIXME-SOON) */
2507 md_pcrel_from (fixP
)
2512 ret
= fixP
->fx_where
+ fixP
->fx_frag
->fr_address
;
2513 if (! sparc_pic_code
2514 || fixP
->fx_addsy
== NULL
2515 || (fixP
->fx_addsy
->bsym
->flags
& BSF_SECTION_SYM
) != 0)
2516 ret
+= fixP
->fx_size
;
2520 /* end of tc-sparc.c */