1 /* coff object file format
2 Copyright (C) 1989, 90, 91, 92, 93, 94, 95, 96, 1997
3 Free Software Foundation, Inc.
5 This file is part of GAS.
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
26 /* I think this is probably always correct. */
27 #ifndef KEEP_RELOC_INFO
28 #define KEEP_RELOC_INFO
31 const char *s_get_name
PARAMS ((symbolS
* s
));
32 static symbolS
*def_symbol_in_progress
;
38 unsigned long chunk_size
;
39 unsigned long element_size
;
42 unsigned long pointer
;
47 stack_init (chunk_size
, element_size
)
48 unsigned long chunk_size
;
49 unsigned long element_size
;
53 st
= (stack
*) malloc (sizeof (stack
));
56 st
->data
= malloc (chunk_size
);
63 st
->size
= chunk_size
;
64 st
->chunk_size
= chunk_size
;
65 st
->element_size
= element_size
;
70 /* Not currently used. */
81 stack_push (st
, element
)
85 if (st
->pointer
+ st
->element_size
>= st
->size
)
87 st
->size
+= st
->chunk_size
;
88 if ((st
->data
= xrealloc (st
->data
, st
->size
)) == (char *) 0)
91 memcpy (st
->data
+ st
->pointer
, element
, st
->element_size
);
92 st
->pointer
+= st
->element_size
;
93 return st
->data
+ st
->pointer
;
100 if (st
->pointer
< st
->element_size
)
105 st
->pointer
-= st
->element_size
;
106 return st
->data
+ st
->pointer
;
110 * Maintain a list of the tagnames of the structres.
113 static struct hash_control
*tag_hash
;
118 tag_hash
= hash_new ();
122 tag_insert (name
, symbolP
)
126 const char *error_string
;
128 if ((error_string
= hash_jam (tag_hash
, name
, (char *) symbolP
)))
130 as_fatal ("Inserting \"%s\" into structure table failed: %s",
139 #ifdef STRIP_UNDERSCORE
142 #endif /* STRIP_UNDERSCORE */
143 return (symbolS
*) hash_find (tag_hash
, name
);
147 tag_find_or_make (name
)
152 if ((symbolP
= tag_find (name
)) == NULL
)
154 symbolP
= symbol_new (name
, undefined_section
,
155 0, &zero_address_frag
);
157 tag_insert (S_GET_NAME (symbolP
), symbolP
);
159 symbol_table_insert (symbolP
);
170 static void SA_SET_SYM_TAGNDX
PARAMS ((symbolS
*, symbolS
*));
172 #define GET_FILENAME_STRING(X) \
173 ((char*)(&((X)->sy_symbol.ost_auxent->x_file.x_n.x_offset))[1])
177 fetch_coff_debug_section ()
179 static segT debug_section
;
183 s
= bfd_make_debug_symbol (stdoutput
, (char *) 0, 0);
185 debug_section
= s
->section
;
187 return debug_section
;
191 SA_SET_SYM_ENDNDX (sym
, val
)
195 combined_entry_type
*entry
, *p
;
197 entry
= &coffsymbol (sym
->bsym
)->native
[1];
198 p
= coffsymbol (val
->bsym
)->native
;
199 entry
->u
.auxent
.x_sym
.x_fcnary
.x_fcn
.x_endndx
.p
= p
;
204 SA_SET_SYM_TAGNDX (sym
, val
)
208 combined_entry_type
*entry
, *p
;
210 entry
= &coffsymbol (sym
->bsym
)->native
[1];
211 p
= coffsymbol (val
->bsym
)->native
;
212 entry
->u
.auxent
.x_sym
.x_tagndx
.p
= p
;
217 S_GET_DATA_TYPE (sym
)
220 return coffsymbol (sym
->bsym
)->native
->u
.syment
.n_type
;
224 S_SET_DATA_TYPE (sym
, val
)
228 coffsymbol (sym
->bsym
)->native
->u
.syment
.n_type
= val
;
233 S_GET_STORAGE_CLASS (sym
)
236 return coffsymbol (sym
->bsym
)->native
->u
.syment
.n_sclass
;
240 S_SET_STORAGE_CLASS (sym
, val
)
244 coffsymbol (sym
->bsym
)->native
->u
.syment
.n_sclass
= val
;
248 /* Merge a debug symbol containing debug information into a normal symbol. */
251 c_symbol_merge (debug
, normal
)
255 S_SET_DATA_TYPE (normal
, S_GET_DATA_TYPE (debug
));
256 S_SET_STORAGE_CLASS (normal
, S_GET_STORAGE_CLASS (debug
));
258 if (S_GET_NUMBER_AUXILIARY (debug
) > S_GET_NUMBER_AUXILIARY (normal
))
259 /* take the most we have */
260 S_SET_NUMBER_AUXILIARY (normal
, S_GET_NUMBER_AUXILIARY (debug
));
262 if (S_GET_NUMBER_AUXILIARY (debug
) > 0)
264 /* Move all the auxiliary information. */
265 /* @@ How many fields do we want to preserve? Would it make more
266 sense to pick and choose those we want to copy? Should look
267 into this further.... [raeburn:19920512.2209EST] */
269 linenos
= coffsymbol (normal
->bsym
)->lineno
;
270 memcpy ((char *) &coffsymbol (normal
->bsym
)->native
,
271 (char *) &coffsymbol (debug
->bsym
)->native
,
272 S_GET_NUMBER_AUXILIARY(debug
) * AUXESZ
);
273 coffsymbol (normal
->bsym
)->lineno
= linenos
;
276 /* Move the debug flags. */
277 SF_SET_DEBUG_FIELD (normal
, SF_GET_DEBUG_FIELD (debug
));
281 c_dot_file_symbol (filename
)
286 symbolP
= symbol_new (filename
, bfd_abs_section_ptr
, 0, &zero_address_frag
);
288 S_SET_STORAGE_CLASS (symbolP
, C_FILE
);
289 S_SET_NUMBER_AUXILIARY (symbolP
, 1);
291 symbolP
->bsym
->flags
= BSF_DEBUGGING
;
298 listing_source_file (filename
);
303 /* Make sure that the symbol is first on the symbol chain */
304 if (symbol_rootP
!= symbolP
)
306 symbol_remove (symbolP
, &symbol_rootP
, &symbol_lastP
);
307 symbol_insert (symbolP
, symbol_rootP
, &symbol_rootP
, &symbol_lastP
);
308 } /* if not first on the list */
311 /* Line number handling */
314 struct line_no
*next
;
321 /* Symbol of last function, which we should hang line#s off of. */
322 static symbolS
*line_fsym
;
324 #define in_function() (line_fsym != 0)
325 #define clear_function() (line_fsym = 0)
326 #define set_function(F) (line_fsym = (F), coff_add_linesym (F))
330 obj_symbol_new_hook (symbolP
)
333 char underscore
= 0; /* Symbol has leading _ */
336 long sz
= (OBJ_COFF_MAX_AUXENTRIES
+ 1) * sizeof (combined_entry_type
);
337 char *s
= (char *) bfd_alloc_by_size_t (stdoutput
, sz
);
339 coffsymbol (symbolP
->bsym
)->native
= (combined_entry_type
*) s
;
341 S_SET_DATA_TYPE (symbolP
, T_NULL
);
342 S_SET_STORAGE_CLASS (symbolP
, 0);
343 S_SET_NUMBER_AUXILIARY (symbolP
, 0);
345 if (S_IS_STRING (symbolP
))
346 SF_SET_STRING (symbolP
);
347 if (!underscore
&& S_IS_LOCAL (symbolP
))
348 SF_SET_LOCAL (symbolP
);
353 * Handle .ln directives.
356 static symbolS
*current_lineno_sym
;
357 static struct line_no
*line_nos
;
358 /* @@ Blindly assume all .ln directives will be in the .text section... */
362 add_lineno (frag
, offset
, num
)
367 struct line_no
*new_line
= (struct line_no
*) bfd_alloc_by_size_t (stdoutput
,
368 sizeof (struct line_no
));
369 if (!current_lineno_sym
)
373 new_line
->next
= line_nos
;
374 new_line
->frag
= frag
;
375 new_line
->l
.line_number
= num
;
376 new_line
->l
.u
.offset
= offset
;
382 coff_add_linesym (sym
)
387 coffsymbol (current_lineno_sym
->bsym
)->lineno
= (alent
*) line_nos
;
391 current_lineno_sym
= sym
;
395 obj_coff_ln (appline
)
400 if (! appline
&& def_symbol_in_progress
!= NULL
)
402 as_warn (".ln pseudo-op inside .def/.endef: ignored.");
403 demand_empty_rest_of_line ();
407 l
= get_absolute_expression ();
410 add_lineno (frag_now
, frag_now_fix (), l
);
420 l
+= coff_line_base
- 1;
421 listing_source_line (l
);
426 demand_empty_rest_of_line ();
432 * Handle .def directives.
434 * One might ask : why can't we symbol_new if the symbol does not
435 * already exist and fill it with debug information. Because of
436 * the C_EFCN special symbol. It would clobber the value of the
437 * function symbol before we have a chance to notice that it is
438 * a C_EFCN. And a second reason is that the code is more clear this
439 * way. (at least I think it is :-).
443 #define SKIP_SEMI_COLON() while (*input_line_pointer++ != ';')
444 #define SKIP_WHITESPACES() while (*input_line_pointer == ' ' || \
445 *input_line_pointer == '\t') \
446 input_line_pointer++;
452 char name_end
; /* Char after the end of name */
453 char *symbol_name
; /* Name of the debug symbol */
454 char *symbol_name_copy
; /* Temporary copy of the name */
455 unsigned int symbol_name_length
;
457 if (def_symbol_in_progress
!= NULL
)
459 as_warn (".def pseudo-op used inside of .def/.endef: ignored.");
460 demand_empty_rest_of_line ();
462 } /* if not inside .def/.endef */
466 symbol_name
= input_line_pointer
;
467 #ifdef STRIP_UNDERSCORE
468 if (symbol_name
[0] == '_' && symbol_name
[1] != 0)
470 #endif /* STRIP_UNDERSCORE */
472 name_end
= get_symbol_end ();
473 symbol_name_length
= strlen (symbol_name
);
474 symbol_name_copy
= xmalloc (symbol_name_length
+ 1);
475 strcpy (symbol_name_copy
, symbol_name
);
477 /* Initialize the new symbol */
478 def_symbol_in_progress
= symbol_make (symbol_name_copy
);
479 def_symbol_in_progress
->sy_frag
= &zero_address_frag
;
480 S_SET_VALUE (def_symbol_in_progress
, 0);
482 if (S_IS_STRING (def_symbol_in_progress
))
483 SF_SET_STRING (def_symbol_in_progress
);
485 *input_line_pointer
= name_end
;
487 demand_empty_rest_of_line ();
490 unsigned int dim_index
;
493 obj_coff_endef (ignore
)
497 /* DIM BUG FIX sac@cygnus.com */
499 if (def_symbol_in_progress
== NULL
)
501 as_warn (".endef pseudo-op used outside of .def/.endef: ignored.");
502 demand_empty_rest_of_line ();
504 } /* if not inside .def/.endef */
506 /* Set the section number according to storage class. */
507 switch (S_GET_STORAGE_CLASS (def_symbol_in_progress
))
512 SF_SET_TAG (def_symbol_in_progress
);
513 /* intentional fallthrough */
516 SF_SET_DEBUG (def_symbol_in_progress
);
517 S_SET_SEGMENT (def_symbol_in_progress
, fetch_coff_debug_section ());
521 SF_SET_LOCAL (def_symbol_in_progress
); /* Do not emit this symbol. */
522 /* intentional fallthrough */
524 SF_SET_PROCESS (def_symbol_in_progress
); /* Will need processing before writing */
525 /* intentional fallthrough */
529 S_SET_SEGMENT (def_symbol_in_progress
, text_section
);
531 name
= bfd_asymbol_name (def_symbol_in_progress
->bsym
);
532 if (name
[1] == 'b' && name
[2] == 'f')
534 if (! in_function ())
535 as_warn ("`%s' symbol without preceding function", name
);
536 /* SA_SET_SYM_LNNO (def_symbol_in_progress, 12345);*/
537 /* Will need relocating */
538 SF_SET_PROCESS (def_symbol_in_progress
);
546 #endif /* C_AUTOARG */
552 SF_SET_DEBUG (def_symbol_in_progress
);
553 S_SET_SEGMENT (def_symbol_in_progress
, absolute_section
);
560 S_SET_SEGMENT (def_symbol_in_progress
, absolute_section
);
566 /* Valid but set somewhere else (s_comm, s_lcomm, colon) */
572 as_warn ("unexpected storage class %d",
573 S_GET_STORAGE_CLASS (def_symbol_in_progress
));
575 } /* switch on storage class */
577 /* Now that we have built a debug symbol, try to find if we should
578 merge with an existing symbol or not. If a symbol is C_EFCN or
579 SEG_ABSOLUTE or untagged SEG_DEBUG it never merges. */
581 /* Two cases for functions. Either debug followed by definition or
582 definition followed by debug. For definition first, we will
583 merge the debug symbol into the definition. For debug first, the
584 lineno entry MUST point to the definition function or else it
585 will point off into space when obj_crawl_symbol_chain() merges
586 the debug symbol into the real symbol. Therefor, let's presume
587 the debug symbol is a real function reference. */
589 /* FIXME-SOON If for some reason the definition label/symbol is
590 never seen, this will probably leave an undefined symbol at link
593 if (S_GET_STORAGE_CLASS (def_symbol_in_progress
) == C_EFCN
594 || (!strcmp (bfd_get_section_name (stdoutput
,
595 S_GET_SEGMENT (def_symbol_in_progress
)),
597 && !SF_GET_TAG (def_symbol_in_progress
))
598 || S_GET_SEGMENT (def_symbol_in_progress
) == absolute_section
599 || (symbolP
= symbol_find_base (S_GET_NAME (def_symbol_in_progress
), DO_NOT_STRIP
)) == NULL
)
601 if (def_symbol_in_progress
!= symbol_lastP
)
602 symbol_append (def_symbol_in_progress
, symbol_lastP
, &symbol_rootP
,
607 /* This symbol already exists, merge the newly created symbol
608 into the old one. This is not mandatory. The linker can
609 handle duplicate symbols correctly. But I guess that it save
610 a *lot* of space if the assembly file defines a lot of
613 /* The debug entry (def_symbol_in_progress) is merged into the
614 previous definition. */
616 c_symbol_merge (def_symbol_in_progress
, symbolP
);
617 symbol_remove (def_symbol_in_progress
, &symbol_rootP
, &symbol_lastP
);
619 def_symbol_in_progress
= symbolP
;
621 if (SF_GET_FUNCTION (def_symbol_in_progress
)
622 || SF_GET_TAG (def_symbol_in_progress
)
623 || S_GET_STORAGE_CLASS (def_symbol_in_progress
) == C_STAT
)
625 /* For functions, and tags, and static symbols, the symbol
626 *must* be where the debug symbol appears. Move the
627 existing symbol to the current place. */
628 /* If it already is at the end of the symbol list, do nothing */
629 if (def_symbol_in_progress
!= symbol_lastP
)
631 symbol_remove (def_symbol_in_progress
, &symbol_rootP
, &symbol_lastP
);
632 symbol_append (def_symbol_in_progress
, symbol_lastP
, &symbol_rootP
, &symbol_lastP
);
637 if (SF_GET_TAG (def_symbol_in_progress
))
641 oldtag
= symbol_find_base (S_GET_NAME (def_symbol_in_progress
),
643 if (oldtag
== NULL
|| ! SF_GET_TAG (oldtag
))
644 tag_insert (S_GET_NAME (def_symbol_in_progress
),
645 def_symbol_in_progress
);
648 if (SF_GET_FUNCTION (def_symbol_in_progress
))
650 know (sizeof (def_symbol_in_progress
) <= sizeof (long));
651 set_function (def_symbol_in_progress
);
652 SF_SET_PROCESS (def_symbol_in_progress
);
656 /* That is, if this is the first time we've seen the
658 symbol_table_insert (def_symbol_in_progress
);
659 } /* definition follows debug */
660 } /* Create the line number entry pointing to the function being defined */
662 def_symbol_in_progress
= NULL
;
663 demand_empty_rest_of_line ();
667 obj_coff_dim (ignore
)
672 if (def_symbol_in_progress
== NULL
)
674 as_warn (".dim pseudo-op used outside of .def/.endef: ignored.");
675 demand_empty_rest_of_line ();
677 } /* if not inside .def/.endef */
679 S_SET_NUMBER_AUXILIARY (def_symbol_in_progress
, 1);
681 for (dim_index
= 0; dim_index
< DIMNUM
; dim_index
++)
684 SA_SET_SYM_DIMEN (def_symbol_in_progress
, dim_index
,
685 get_absolute_expression ());
687 switch (*input_line_pointer
)
690 input_line_pointer
++;
694 as_warn ("badly formed .dim directive ignored");
695 /* intentional fallthrough */
703 demand_empty_rest_of_line ();
707 obj_coff_line (ignore
)
712 if (def_symbol_in_progress
== NULL
)
714 /* Probably stabs-style line? */
719 this_base
= get_absolute_expression ();
720 if (!strcmp (".bf", S_GET_NAME (def_symbol_in_progress
)))
721 coff_line_base
= this_base
;
723 S_SET_NUMBER_AUXILIARY (def_symbol_in_progress
, 1);
724 SA_SET_SYM_LNNO (def_symbol_in_progress
, coff_line_base
);
726 demand_empty_rest_of_line ();
729 if (strcmp (".bf", S_GET_NAME (def_symbol_in_progress
)) == 0)
734 listing_source_line ((unsigned int) coff_line_base
);
740 obj_coff_size (ignore
)
743 if (def_symbol_in_progress
== NULL
)
745 as_warn (".size pseudo-op used outside of .def/.endef ignored.");
746 demand_empty_rest_of_line ();
748 } /* if not inside .def/.endef */
750 S_SET_NUMBER_AUXILIARY (def_symbol_in_progress
, 1);
751 SA_SET_SYM_SIZE (def_symbol_in_progress
, get_absolute_expression ());
752 demand_empty_rest_of_line ();
756 obj_coff_scl (ignore
)
759 if (def_symbol_in_progress
== NULL
)
761 as_warn (".scl pseudo-op used outside of .def/.endef ignored.");
762 demand_empty_rest_of_line ();
764 } /* if not inside .def/.endef */
766 S_SET_STORAGE_CLASS (def_symbol_in_progress
, get_absolute_expression ());
767 demand_empty_rest_of_line ();
771 obj_coff_tag (ignore
)
777 if (def_symbol_in_progress
== NULL
)
779 as_warn (".tag pseudo-op used outside of .def/.endef ignored.");
780 demand_empty_rest_of_line ();
784 S_SET_NUMBER_AUXILIARY (def_symbol_in_progress
, 1);
785 symbol_name
= input_line_pointer
;
786 name_end
= get_symbol_end ();
788 /* Assume that the symbol referred to by .tag is always defined.
789 This was a bad assumption. I've added find_or_make. xoxorich. */
790 SA_SET_SYM_TAGNDX (def_symbol_in_progress
,
791 tag_find_or_make (symbol_name
));
792 if (SA_GET_SYM_TAGNDX (def_symbol_in_progress
) == 0L)
794 as_warn ("tag not found for .tag %s", symbol_name
);
797 SF_SET_TAGGED (def_symbol_in_progress
);
798 *input_line_pointer
= name_end
;
800 demand_empty_rest_of_line ();
804 obj_coff_type (ignore
)
807 if (def_symbol_in_progress
== NULL
)
809 as_warn (".type pseudo-op used outside of .def/.endef ignored.");
810 demand_empty_rest_of_line ();
812 } /* if not inside .def/.endef */
814 S_SET_DATA_TYPE (def_symbol_in_progress
, get_absolute_expression ());
816 if (ISFCN (S_GET_DATA_TYPE (def_symbol_in_progress
)) &&
817 S_GET_STORAGE_CLASS (def_symbol_in_progress
) != C_TPDEF
)
819 SF_SET_FUNCTION (def_symbol_in_progress
);
820 } /* is a function */
822 demand_empty_rest_of_line ();
826 obj_coff_val (ignore
)
829 if (def_symbol_in_progress
== NULL
)
831 as_warn (".val pseudo-op used outside of .def/.endef ignored.");
832 demand_empty_rest_of_line ();
834 } /* if not inside .def/.endef */
836 if (is_name_beginner (*input_line_pointer
))
838 char *symbol_name
= input_line_pointer
;
839 char name_end
= get_symbol_end ();
841 if (!strcmp (symbol_name
, "."))
843 def_symbol_in_progress
->sy_frag
= frag_now
;
844 S_SET_VALUE (def_symbol_in_progress
, (valueT
) frag_now_fix ());
845 /* If the .val is != from the .def (e.g. statics) */
847 else if (strcmp (S_GET_NAME (def_symbol_in_progress
), symbol_name
))
849 def_symbol_in_progress
->sy_value
.X_op
= O_symbol
;
850 def_symbol_in_progress
->sy_value
.X_add_symbol
=
851 symbol_find_or_make (symbol_name
);
852 def_symbol_in_progress
->sy_value
.X_op_symbol
= NULL
;
853 def_symbol_in_progress
->sy_value
.X_add_number
= 0;
855 /* If the segment is undefined when the forward reference is
856 resolved, then copy the segment id from the forward
858 SF_SET_GET_SEGMENT (def_symbol_in_progress
);
860 /* Otherwise, it is the name of a non debug symbol and its value will be calculated later. */
861 *input_line_pointer
= name_end
;
865 S_SET_VALUE (def_symbol_in_progress
, get_absolute_expression ());
866 } /* if symbol based */
868 demand_empty_rest_of_line ();
872 obj_read_begin_hook ()
874 /* These had better be the same. Usually 18 bytes. */
876 know (sizeof (SYMENT
) == sizeof (AUXENT
));
877 know (SYMESZ
== AUXESZ
);
883 symbolS
*coff_last_function
;
884 static symbolS
*coff_last_bf
;
887 coff_frob_symbol (symp
, punt
)
891 static symbolS
*last_tagP
;
892 static stack
*block_stack
;
893 static symbolS
*set_end
;
894 symbolS
*next_set_end
= NULL
;
896 if (symp
== &abs_symbol
)
902 if (current_lineno_sym
)
903 coff_add_linesym ((symbolS
*) 0);
906 block_stack
= stack_init (512, sizeof (symbolS
*));
908 if (!S_IS_DEFINED (symp
) && S_GET_STORAGE_CLASS (symp
) != C_STAT
)
909 S_SET_STORAGE_CLASS (symp
, C_EXT
);
911 if (!SF_GET_DEBUG (symp
))
914 if (!SF_GET_LOCAL (symp
)
915 && !SF_GET_STATICS (symp
)
916 && (real
= symbol_find_base (S_GET_NAME (symp
), DO_NOT_STRIP
))
919 c_symbol_merge (symp
, real
);
922 if (!S_IS_DEFINED (symp
) && !SF_GET_LOCAL (symp
))
924 assert (S_GET_VALUE (symp
) == 0);
925 S_SET_EXTERNAL (symp
);
927 else if (S_GET_STORAGE_CLASS (symp
) == C_NULL
)
929 if (S_GET_SEGMENT (symp
) == text_section
930 && symp
!= seg_info (text_section
)->sym
)
931 S_SET_STORAGE_CLASS (symp
, C_LABEL
);
933 S_SET_STORAGE_CLASS (symp
, C_STAT
);
935 if (SF_GET_PROCESS (symp
))
937 if (S_GET_STORAGE_CLASS (symp
) == C_BLOCK
)
939 if (!strcmp (S_GET_NAME (symp
), ".bb"))
940 stack_push (block_stack
, (char *) &symp
);
944 begin
= *(symbolS
**) stack_pop (block_stack
);
946 as_warn ("mismatched .eb");
948 next_set_end
= begin
;
951 if (coff_last_function
== 0 && SF_GET_FUNCTION (symp
))
953 union internal_auxent
*auxp
;
954 coff_last_function
= symp
;
955 if (S_GET_NUMBER_AUXILIARY (symp
) < 1)
956 S_SET_NUMBER_AUXILIARY (symp
, 1);
957 auxp
= &coffsymbol (symp
->bsym
)->native
[1].u
.auxent
;
958 memset (auxp
->x_sym
.x_fcnary
.x_ary
.x_dimen
, 0,
959 sizeof (auxp
->x_sym
.x_fcnary
.x_ary
.x_dimen
));
961 if (S_GET_STORAGE_CLASS (symp
) == C_EFCN
)
963 if (coff_last_function
== 0)
964 as_fatal ("C_EFCN symbol out of scope");
965 SA_SET_SYM_FSIZE (coff_last_function
,
966 (long) (S_GET_VALUE (symp
)
967 - S_GET_VALUE (coff_last_function
)));
968 next_set_end
= coff_last_function
;
969 coff_last_function
= 0;
972 if (S_IS_EXTERNAL (symp
))
973 S_SET_STORAGE_CLASS (symp
, C_EXT
);
974 else if (SF_GET_LOCAL (symp
))
977 if (SF_GET_FUNCTION (symp
))
978 symp
->bsym
->flags
|= BSF_FUNCTION
;
983 if (SF_GET_TAG (symp
))
985 else if (S_GET_STORAGE_CLASS (symp
) == C_EOS
)
986 next_set_end
= last_tagP
;
989 /* This is pretty horrible, but we have to set *punt correctly in
990 order to call SA_SET_SYM_ENDNDX correctly. */
991 if (! symp
->sy_used_in_reloc
992 && ((symp
->bsym
->flags
& BSF_SECTION_SYM
) != 0
993 || (! S_IS_EXTERNAL (symp
)
994 && ! symp
->sy_tc
.output
995 && S_GET_STORAGE_CLASS (symp
) != C_FILE
)))
999 if (set_end
!= (symbolS
*) NULL
1001 && ((symp
->bsym
->flags
& BSF_NOT_AT_END
) != 0
1002 || (S_IS_DEFINED (symp
)
1003 && ! S_IS_COMMON (symp
)
1004 && (! S_IS_EXTERNAL (symp
) || SF_GET_FUNCTION (symp
)))))
1006 SA_SET_SYM_ENDNDX (set_end
, symp
);
1010 if (next_set_end
!= NULL
1012 set_end
= next_set_end
;
1015 && S_GET_STORAGE_CLASS (symp
) == C_FCN
1016 && strcmp (S_GET_NAME (symp
), ".bf") == 0)
1018 if (coff_last_bf
!= NULL
)
1019 SA_SET_SYM_ENDNDX (coff_last_bf
, symp
);
1020 coff_last_bf
= symp
;
1023 if (coffsymbol (symp
->bsym
)->lineno
)
1026 struct line_no
*lptr
;
1029 lptr
= (struct line_no
*) coffsymbol (symp
->bsym
)->lineno
;
1030 for (i
= 0; lptr
; lptr
= lptr
->next
)
1032 lptr
= (struct line_no
*) coffsymbol (symp
->bsym
)->lineno
;
1034 /* We need i entries for line numbers, plus 1 for the first
1035 entry which BFD will override, plus 1 for the last zero
1036 entry (a marker for BFD). */
1037 l
= (alent
*) bfd_alloc_by_size_t (stdoutput
, (i
+ 2) * sizeof (alent
));
1038 coffsymbol (symp
->bsym
)->lineno
= l
;
1039 l
[i
+ 1].line_number
= 0;
1040 l
[i
+ 1].u
.sym
= NULL
;
1044 lptr
->l
.u
.offset
+= lptr
->frag
->fr_address
;
1052 coff_adjust_section_syms (abfd
, sec
, x
)
1058 segment_info_type
*seginfo
= seg_info (sec
);
1059 int nlnno
, nrelocs
= 0;
1061 /* RS/6000 gas creates a .debug section manually in ppc_frob_file in
1062 tc-ppc.c. Do not get confused by it. */
1063 if (seginfo
== NULL
)
1066 if (!strcmp (sec
->name
, ".text"))
1067 nlnno
= coff_n_line_nos
;
1071 /* @@ Hope that none of the fixups expand to more than one reloc
1073 fixS
*fixp
= seginfo
->fix_root
;
1076 fixp
= fixp
->fx_next
;
1080 if (bfd_get_section_size_before_reloc (sec
) == 0
1083 && sec
!= text_section
1084 && sec
!= data_section
1085 && sec
!= bss_section
)
1087 secsym
= section_symbol (sec
);
1088 SA_SET_SCN_NRELOC (secsym
, nrelocs
);
1089 SA_SET_SCN_NLINNO (secsym
, nlnno
);
1095 bfd_map_over_sections (stdoutput
, coff_adjust_section_syms
, (char*) 0);
1099 * implement the .section pseudo op:
1100 * .section name {, "flags"}
1102 * | +--- optional flags: 'b' for bss
1104 * +-- section name 'l' for lib
1108 * 'd' (apparently m88k for data)
1110 * But if the argument is not a quoted string, treat it as a
1111 * subsegment number.
1115 obj_coff_section (ignore
)
1118 /* Strip out the section name */
1134 section_name
= input_line_pointer
;
1135 c
= get_symbol_end ();
1137 name
= xmalloc (input_line_pointer
- section_name
+ 1);
1138 strcpy (name
, section_name
);
1140 *input_line_pointer
= c
;
1145 flags
= SEC_NO_FLAGS
;
1147 if (*input_line_pointer
== ',')
1149 ++input_line_pointer
;
1151 if (*input_line_pointer
!= '"')
1152 exp
= get_absolute_expression ();
1155 ++input_line_pointer
;
1156 while (*input_line_pointer
!= '"'
1157 && ! is_end_of_line
[(unsigned char) *input_line_pointer
])
1159 switch (*input_line_pointer
)
1161 case 'b': flags
|= SEC_ALLOC
; flags
&=~ SEC_LOAD
; break;
1162 case 'n': flags
&=~ SEC_LOAD
; break;
1164 case 'w': flags
&=~ SEC_READONLY
; break;
1165 case 'x': flags
|= SEC_CODE
; break;
1167 case 'i': /* STYP_INFO */
1168 case 'l': /* STYP_LIB */
1169 case 'o': /* STYP_OVER */
1170 as_warn ("unsupported section attribute '%c'",
1171 *input_line_pointer
);
1175 as_warn("unknown section attribute '%c'",
1176 *input_line_pointer
);
1179 ++input_line_pointer
;
1181 if (*input_line_pointer
== '"')
1182 ++input_line_pointer
;
1186 sec
= subseg_new (name
, (subsegT
) exp
);
1188 if (flags
!= SEC_NO_FLAGS
)
1190 if (! bfd_set_section_flags (stdoutput
, sec
, flags
))
1191 as_warn ("error setting flags for \"%s\": %s",
1192 bfd_section_name (stdoutput
, sec
),
1193 bfd_errmsg (bfd_get_error ()));
1196 demand_empty_rest_of_line ();
1200 coff_adjust_symtab ()
1202 if (symbol_rootP
== NULL
1203 || S_GET_STORAGE_CLASS (symbol_rootP
) != C_FILE
)
1204 c_dot_file_symbol ("fake");
1208 coff_frob_section (sec
)
1214 bfd_vma size
, n_entries
, mask
;
1216 /* The COFF back end in BFD requires that all section sizes be
1217 rounded up to multiples of the corresponding section alignments.
1218 Seems kinda silly to me, but that's the way it is. */
1219 size
= bfd_get_section_size_before_reloc (sec
);
1220 mask
= ((bfd_vma
) 1 << (bfd_vma
) sec
->alignment_power
) - 1;
1223 size
= (size
+ mask
) & ~mask
;
1224 bfd_set_section_size (stdoutput
, sec
, size
);
1227 /* If the section size is non-zero, the section symbol needs an aux
1228 entry associated with it, indicating the size. We don't know
1229 all the values yet; coff_frob_symbol will fill them in later. */
1231 || sec
== text_section
1232 || sec
== data_section
1233 || sec
== bss_section
)
1235 symbolS
*secsym
= section_symbol (sec
);
1237 S_SET_STORAGE_CLASS (secsym
, C_STAT
);
1238 S_SET_NUMBER_AUXILIARY (secsym
, 1);
1239 SF_SET_STATICS (secsym
);
1240 SA_SET_SCN_SCNLEN (secsym
, size
);
1243 /* @@ these should be in a "stabs.h" file, or maybe as.h */
1244 #ifndef STAB_SECTION_NAME
1245 #define STAB_SECTION_NAME ".stab"
1247 #ifndef STAB_STRING_SECTION_NAME
1248 #define STAB_STRING_SECTION_NAME ".stabstr"
1250 if (strcmp (STAB_STRING_SECTION_NAME
, sec
->name
))
1254 sec
= subseg_get (STAB_SECTION_NAME
, 0);
1255 /* size is already rounded up, since other section will be listed first */
1256 size
= bfd_get_section_size_before_reloc (strsec
);
1258 n_entries
= bfd_get_section_size_before_reloc (sec
) / 12 - 1;
1260 /* Find first non-empty frag. It should be large enough. */
1261 fragp
= seg_info (sec
)->frchainP
->frch_root
;
1262 while (fragp
&& fragp
->fr_fix
== 0)
1263 fragp
= fragp
->fr_next
;
1264 assert (fragp
!= 0 && fragp
->fr_fix
>= 12);
1266 /* Store the values. */
1267 p
= fragp
->fr_literal
;
1268 bfd_h_put_16 (stdoutput
, n_entries
, (bfd_byte
*) p
+ 6);
1269 bfd_h_put_32 (stdoutput
, size
, (bfd_byte
*) p
+ 8);
1273 obj_coff_init_stab_section (seg
)
1279 unsigned int stroff
;
1281 /* Make space for this first symbol. */
1285 as_where (&file
, (unsigned int *) NULL
);
1286 stabstr_name
= (char *) alloca (strlen (seg
->name
) + 4);
1287 strcpy (stabstr_name
, seg
->name
);
1288 strcat (stabstr_name
, "str");
1289 stroff
= get_stab_string_offset (file
, stabstr_name
);
1291 md_number_to_chars (p
, stroff
, 4);
1300 return ((s
== NULL
) ? "(NULL)" : S_GET_NAME (s
));
1308 for (symbolP
= symbol_rootP
; symbolP
; symbolP
= symbol_next (symbolP
))
1310 printf("0x%lx: \"%s\" type = %ld, class = %d, segment = %d\n",
1311 (unsigned long) symbolP
,
1312 S_GET_NAME(symbolP
),
1313 (long) S_GET_DATA_TYPE(symbolP
),
1314 S_GET_STORAGE_CLASS(symbolP
),
1315 (int) S_GET_SEGMENT(symbolP
));
1321 #else /* not BFD_ASSEMBLER */
1324 /* This is needed because we include internal bfd things. */
1328 #include "libcoff.h"
1331 #include "coff/pe.h"
1334 /* The NOP_OPCODE is for the alignment fill value. Fill with nop so
1335 that we can stick sections together without causing trouble. */
1337 #define NOP_OPCODE 0x00
1340 /* The zeroes if symbol name is longer than 8 chars */
1341 #define S_SET_ZEROES(s,v) ((s)->sy_symbol.ost_entry.n_zeroes = (v))
1343 #define MIN(a,b) ((a) < (b)? (a) : (b))
1344 /* This vector is used to turn an internal segment into a section #
1345 suitable for insertion into a coff symbol table
1348 const short seg_N_TYPE
[] =
1349 { /* in: segT out: N_TYPE bits */
1351 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1352 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
1353 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
1354 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
1355 C_UNDEF_SECTION
, /* SEG_UNKNOWN */
1356 C_UNDEF_SECTION
, /* SEG_GOOF */
1357 C_UNDEF_SECTION
, /* SEG_EXPR */
1358 C_DEBUG_SECTION
, /* SEG_DEBUG */
1359 C_NTV_SECTION
, /* SEG_NTV */
1360 C_PTV_SECTION
, /* SEG_PTV */
1361 C_REGISTER_SECTION
, /* SEG_REGISTER */
1364 int function_lineoff
= -1; /* Offset in line#s where the last function
1365 started (the odd entry for line #0) */
1367 /* structure used to keep the filenames which
1368 are too long around so that we can stick them
1369 into the string table */
1370 struct filename_list
1373 struct filename_list
*next
;
1376 static struct filename_list
*filename_list_head
;
1377 static struct filename_list
*filename_list_tail
;
1379 static symbolS
*last_line_symbol
;
1381 /* Add 4 to the real value to get the index and compensate the
1382 negatives. This vector is used by S_GET_SEGMENT to turn a coff
1383 section number into a segment number
1385 static symbolS
*previous_file_symbol
;
1386 void c_symbol_merge ();
1387 static int line_base
;
1389 symbolS
*c_section_symbol ();
1392 static void fixup_segment
PARAMS ((segment_info_type
*segP
,
1393 segT this_segment_type
));
1396 static void fixup_mdeps
PARAMS ((fragS
*,
1401 static void fill_section
PARAMS ((bfd
* abfd
,
1406 static int c_line_new
PARAMS ((symbolS
* symbol
, long paddr
,
1411 static void w_symbols
PARAMS ((bfd
* abfd
, char *where
,
1412 symbolS
* symbol_rootP
));
1414 static void adjust_stab_section
PARAMS ((bfd
*abfd
, segT seg
));
1416 static void obj_coff_lcomm
PARAMS ((int));
1417 static void obj_coff_text
PARAMS ((int));
1418 static void obj_coff_data
PARAMS ((int));
1419 static void obj_coff_bss
PARAMS ((int));
1420 static void obj_coff_ident
PARAMS ((int));
1421 void obj_coff_section
PARAMS ((int));
1425 We allow more than just the standard 3 sections, infact, we allow
1426 40 sections, (though the usual three have to be there).
1428 This structure performs the mappings for us:
1438 static const seg_info_type seg_info_off_by_4
[] =
1445 {SEG_E0
}, {SEG_E1
}, {SEG_E2
}, {SEG_E3
}, {SEG_E4
},
1446 {SEG_E5
}, {SEG_E6
}, {SEG_E7
}, {SEG_E8
}, {SEG_E9
},
1447 {SEG_E10
},{SEG_E11
},{SEG_E12
},{SEG_E13
},{SEG_E14
},
1448 {SEG_E15
},{SEG_E16
},{SEG_E17
},{SEG_E18
},{SEG_E19
},
1449 {SEG_E20
},{SEG_E21
},{SEG_E22
},{SEG_E23
},{SEG_E24
},
1450 {SEG_E25
},{SEG_E26
},{SEG_E27
},{SEG_E28
},{SEG_E29
},
1451 {SEG_E30
},{SEG_E31
},{SEG_E32
},{SEG_E33
},{SEG_E34
},
1452 {SEG_E35
},{SEG_E36
},{SEG_E37
},{SEG_E38
},{SEG_E39
},
1467 #define SEG_INFO_FROM_SECTION_NUMBER(x) (seg_info_off_by_4[(x)+4])
1469 static relax_addressT
1470 relax_align (address
, alignment
)
1471 relax_addressT address
;
1474 relax_addressT mask
;
1475 relax_addressT new_address
;
1477 mask
= ~((~0) << alignment
);
1478 new_address
= (address
+ mask
) & (~mask
);
1479 return (new_address
- address
);
1487 return SEG_INFO_FROM_SECTION_NUMBER (x
->sy_symbol
.ost_entry
.n_scnum
).seg_t
;
1492 /* calculate the size of the frag chain and fill in the section header
1493 to contain all of it, also fill in the addr of the sections */
1495 size_section (abfd
, idx
)
1500 unsigned int size
= 0;
1501 fragS
*frag
= segment_info
[idx
].frchainP
->frch_root
;
1504 size
= frag
->fr_address
;
1505 if (frag
->fr_address
!= size
)
1507 fprintf (stderr
, "Out of step\n");
1508 size
= frag
->fr_address
;
1511 switch (frag
->fr_type
)
1513 #ifdef TC_COFF_SIZEMACHDEP
1514 case rs_machine_dependent
:
1515 size
+= TC_COFF_SIZEMACHDEP (frag
);
1519 assert (frag
->fr_symbol
== 0);
1522 size
+= frag
->fr_fix
;
1523 size
+= frag
->fr_offset
* frag
->fr_var
;
1527 size
+= frag
->fr_fix
;
1528 size
+= relax_align (size
, frag
->fr_offset
);
1531 BAD_CASE (frag
->fr_type
);
1534 frag
= frag
->fr_next
;
1536 segment_info
[idx
].scnhdr
.s_size
= size
;
1542 count_entries_in_chain (idx
)
1545 unsigned int nrelocs
;
1548 /* Count the relocations */
1549 fixup_ptr
= segment_info
[idx
].fix_root
;
1551 while (fixup_ptr
!= (fixS
*) NULL
)
1553 if (fixup_ptr
->fx_done
== 0 && TC_COUNT_RELOC (fixup_ptr
))
1556 if (fixup_ptr
->fx_r_type
== RELOC_CONSTH
)
1565 fixup_ptr
= fixup_ptr
->fx_next
;
1572 static int compare_external_relocs
PARAMS ((const PTR
, const PTR
));
1574 /* AUX's ld expects relocations to be sorted */
1576 compare_external_relocs (x
, y
)
1580 struct external_reloc
*a
= (struct external_reloc
*) x
;
1581 struct external_reloc
*b
= (struct external_reloc
*) y
;
1582 bfd_vma aadr
= bfd_getb32 (a
->r_vaddr
);
1583 bfd_vma badr
= bfd_getb32 (b
->r_vaddr
);
1584 return (aadr
< badr
? -1 : badr
< aadr
? 1 : 0);
1589 /* output all the relocations for a section */
1591 do_relocs_for (abfd
, h
, file_cursor
)
1594 unsigned long *file_cursor
;
1596 unsigned int nrelocs
;
1598 unsigned long reloc_start
= *file_cursor
;
1600 for (idx
= SEG_E0
; idx
< SEG_LAST
; idx
++)
1602 if (segment_info
[idx
].scnhdr
.s_name
[0])
1604 struct external_reloc
*ext_ptr
;
1605 struct external_reloc
*external_reloc_vec
;
1606 unsigned int external_reloc_size
;
1607 unsigned int base
= segment_info
[idx
].scnhdr
.s_paddr
;
1608 fixS
*fix_ptr
= segment_info
[idx
].fix_root
;
1609 nrelocs
= count_entries_in_chain (idx
);
1612 /* Bypass this stuff if no relocs. This also incidentally
1613 avoids a SCO bug, where free(malloc(0)) tends to crash. */
1615 external_reloc_size
= nrelocs
* RELSZ
;
1616 external_reloc_vec
=
1617 (struct external_reloc
*) malloc (external_reloc_size
);
1619 ext_ptr
= external_reloc_vec
;
1621 /* Fill in the internal coff style reloc struct from the
1622 internal fix list. */
1625 struct internal_reloc intr
;
1627 /* Only output some of the relocations */
1628 if (fix_ptr
->fx_done
== 0 && TC_COUNT_RELOC (fix_ptr
))
1630 #ifdef TC_RELOC_MANGLE
1631 TC_RELOC_MANGLE (&segment_info
[idx
], fix_ptr
, &intr
,
1636 symbolS
*symbol_ptr
= fix_ptr
->fx_addsy
;
1638 intr
.r_type
= TC_COFF_FIX2RTYPE (fix_ptr
);
1640 base
+ fix_ptr
->fx_frag
->fr_address
+ fix_ptr
->fx_where
;
1642 #ifdef TC_KEEP_FX_OFFSET
1643 intr
.r_offset
= fix_ptr
->fx_offset
;
1648 while (symbol_ptr
->sy_value
.X_op
== O_symbol
1649 && (! S_IS_DEFINED (symbol_ptr
)
1650 || S_IS_COMMON (symbol_ptr
)))
1651 symbol_ptr
= symbol_ptr
->sy_value
.X_add_symbol
;
1653 /* Turn the segment of the symbol into an offset. */
1656 resolve_symbol_value (symbol_ptr
);
1657 if (! symbol_ptr
->sy_resolved
)
1662 if (expr_symbol_where (symbol_ptr
, &file
, &line
))
1663 as_bad_where (file
, line
,
1664 "unresolved relocation");
1666 as_bad ("bad relocation: symbol `%s' not in symbol table",
1667 S_GET_NAME (symbol_ptr
));
1669 dot
= segment_info
[S_GET_SEGMENT (symbol_ptr
)].dot
;
1672 intr
.r_symndx
= dot
->sy_number
;
1676 intr
.r_symndx
= symbol_ptr
->sy_number
;
1686 (void) bfd_coff_swap_reloc_out (abfd
, &intr
, ext_ptr
);
1689 #if defined(TC_A29K)
1691 /* The 29k has a special kludge for the high 16 bit
1692 reloc. Two relocations are emited, R_IHIHALF,
1693 and R_IHCONST. The second one doesn't contain a
1694 symbol, but uses the value for offset. */
1696 if (intr
.r_type
== R_IHIHALF
)
1698 /* now emit the second bit */
1699 intr
.r_type
= R_IHCONST
;
1700 intr
.r_symndx
= fix_ptr
->fx_addnumber
;
1701 (void) bfd_coff_swap_reloc_out (abfd
, &intr
, ext_ptr
);
1707 fix_ptr
= fix_ptr
->fx_next
;
1711 /* Sort the reloc table */
1712 qsort ((PTR
) external_reloc_vec
, nrelocs
,
1713 sizeof (struct external_reloc
), compare_external_relocs
);
1716 /* Write out the reloc table */
1717 bfd_write ((PTR
) external_reloc_vec
, 1, external_reloc_size
,
1719 free (external_reloc_vec
);
1721 /* Fill in section header info. */
1722 segment_info
[idx
].scnhdr
.s_relptr
= *file_cursor
;
1723 *file_cursor
+= external_reloc_size
;
1724 segment_info
[idx
].scnhdr
.s_nreloc
= nrelocs
;
1729 segment_info
[idx
].scnhdr
.s_relptr
= 0;
1733 /* Set relocation_size field in file headers */
1734 H_SET_RELOCATION_SIZE (h
, *file_cursor
- reloc_start
, 0);
1738 /* run through a frag chain and write out the data to go with it, fill
1739 in the scnhdrs with the info on the file postions
1742 fill_section (abfd
, h
, file_cursor
)
1745 unsigned long *file_cursor
;
1749 unsigned int paddr
= 0;
1751 for (i
= SEG_E0
; i
< SEG_UNKNOWN
; i
++)
1753 unsigned int offset
= 0;
1754 struct internal_scnhdr
*s
= &(segment_info
[i
].scnhdr
);
1760 fragS
*frag
= segment_info
[i
].frchainP
->frch_root
;
1767 buffer
= xmalloc (s
->s_size
);
1768 s
->s_scnptr
= *file_cursor
;
1770 know (s
->s_paddr
== paddr
);
1772 if (strcmp (s
->s_name
, ".text") == 0)
1773 s
->s_flags
|= STYP_TEXT
;
1774 else if (strcmp (s
->s_name
, ".data") == 0)
1775 s
->s_flags
|= STYP_DATA
;
1776 else if (strcmp (s
->s_name
, ".bss") == 0)
1779 s
->s_flags
|= STYP_BSS
;
1781 /* @@ Should make the i386 and a29k coff targets define
1782 COFF_NOLOAD_PROBLEM, and have only one test here. */
1785 #ifndef COFF_NOLOAD_PROBLEM
1786 /* Apparently the SVR3 linker (and exec syscall) and UDI
1787 mondfe progrem are confused by noload sections. */
1788 s
->s_flags
|= STYP_NOLOAD
;
1793 else if (strcmp (s
->s_name
, ".lit") == 0)
1794 s
->s_flags
= STYP_LIT
| STYP_TEXT
;
1795 else if (strcmp (s
->s_name
, ".init") == 0)
1796 s
->s_flags
|= STYP_TEXT
;
1797 else if (strcmp (s
->s_name
, ".fini") == 0)
1798 s
->s_flags
|= STYP_TEXT
;
1799 else if (strncmp (s
->s_name
, ".comment", 8) == 0)
1800 s
->s_flags
|= STYP_INFO
;
1804 unsigned int fill_size
;
1805 switch (frag
->fr_type
)
1807 case rs_machine_dependent
:
1810 memcpy (buffer
+ frag
->fr_address
,
1812 (unsigned int) frag
->fr_fix
);
1813 offset
+= frag
->fr_fix
;
1818 assert (frag
->fr_symbol
== 0);
1825 memcpy (buffer
+ frag
->fr_address
,
1827 (unsigned int) frag
->fr_fix
);
1828 offset
+= frag
->fr_fix
;
1831 fill_size
= frag
->fr_var
;
1832 if (fill_size
&& frag
->fr_offset
> 0)
1835 unsigned int off
= frag
->fr_fix
;
1836 for (count
= frag
->fr_offset
; count
; count
--)
1838 if (fill_size
+ frag
->fr_address
+ off
<= s
->s_size
)
1840 memcpy (buffer
+ frag
->fr_address
+ off
,
1841 frag
->fr_literal
+ frag
->fr_fix
,
1844 offset
+= fill_size
;
1849 case rs_broken_word
:
1854 frag
= frag
->fr_next
;
1859 if (s
->s_scnptr
!= 0)
1861 bfd_write (buffer
, s
->s_size
, 1, abfd
);
1862 *file_cursor
+= s
->s_size
;
1871 /* Coff file generation & utilities */
1874 coff_header_append (abfd
, h
)
1882 bfd_seek (abfd
, 0, 0);
1884 #ifndef OBJ_COFF_OMIT_OPTIONAL_HEADER
1885 H_SET_MAGIC_NUMBER (h
, COFF_MAGIC
);
1886 H_SET_VERSION_STAMP (h
, 0);
1887 H_SET_ENTRY_POINT (h
, 0);
1888 H_SET_TEXT_START (h
, segment_info
[SEG_E0
].frchainP
->frch_root
->fr_address
);
1889 H_SET_DATA_START (h
, segment_info
[SEG_E1
].frchainP
->frch_root
->fr_address
);
1890 H_SET_SIZEOF_OPTIONAL_HEADER (h
, bfd_coff_swap_aouthdr_out(abfd
, &h
->aouthdr
,
1892 #else /* defined (OBJ_COFF_OMIT_OPTIONAL_HEADER) */
1893 H_SET_SIZEOF_OPTIONAL_HEADER (h
, 0);
1894 #endif /* defined (OBJ_COFF_OMIT_OPTIONAL_HEADER) */
1896 i
= bfd_coff_swap_filehdr_out (abfd
, &h
->filehdr
, buffer
);
1898 bfd_write (buffer
, i
, 1, abfd
);
1899 bfd_write (buffero
, H_GET_SIZEOF_OPTIONAL_HEADER (h
), 1, abfd
);
1901 for (i
= SEG_E0
; i
< SEG_LAST
; i
++)
1903 #ifdef COFF_LONG_SECTION_NAMES
1904 unsigned long string_size
= 4;
1907 if (segment_info
[i
].scnhdr
.s_name
[0])
1911 #ifdef COFF_LONG_SECTION_NAMES
1912 /* Support long section names as found in PE. This code
1913 must coordinate with that in write_object_file and
1915 if (strlen (segment_info
[i
].name
) > SCNNMLEN
)
1917 memset (segment_info
[i
].scnhdr
.s_name
, 0, SCNNMLEN
);
1918 sprintf (segment_info
[i
].scnhdr
.s_name
, "/%lu", string_size
);
1919 string_size
+= strlen (segment_info
[i
].name
) + 1;
1923 size
= bfd_coff_swap_scnhdr_out (abfd
,
1924 &(segment_info
[i
].scnhdr
),
1927 as_bad ("bfd_coff_swap_scnhdr_out failed");
1928 bfd_write (buffer
, size
, 1, abfd
);
1935 symbol_to_chars (abfd
, where
, symbolP
)
1940 unsigned int numaux
= symbolP
->sy_symbol
.ost_entry
.n_numaux
;
1944 /* Turn any symbols with register attributes into abs symbols */
1945 if (S_GET_SEGMENT (symbolP
) == reg_section
)
1947 S_SET_SEGMENT (symbolP
, absolute_section
);
1949 /* At the same time, relocate all symbols to their output value */
1951 val
= (segment_info
[S_GET_SEGMENT (symbolP
)].scnhdr
.s_paddr
1952 + S_GET_VALUE (symbolP
));
1954 S_SET_VALUE (symbolP
, val
);
1956 symbolP
->sy_symbol
.ost_entry
.n_value
= val
;
1958 where
+= bfd_coff_swap_sym_out (abfd
, &symbolP
->sy_symbol
.ost_entry
,
1961 for (i
= 0; i
< numaux
; i
++)
1963 where
+= bfd_coff_swap_aux_out (abfd
,
1964 &symbolP
->sy_symbol
.ost_auxent
[i
],
1965 S_GET_DATA_TYPE (symbolP
),
1966 S_GET_STORAGE_CLASS (symbolP
),
1974 obj_symbol_new_hook (symbolP
)
1977 char underscore
= 0; /* Symbol has leading _ */
1979 /* Effective symbol */
1980 /* Store the pointer in the offset. */
1981 S_SET_ZEROES (symbolP
, 0L);
1982 S_SET_DATA_TYPE (symbolP
, T_NULL
);
1983 S_SET_STORAGE_CLASS (symbolP
, 0);
1984 S_SET_NUMBER_AUXILIARY (symbolP
, 0);
1985 /* Additional information */
1986 symbolP
->sy_symbol
.ost_flags
= 0;
1987 /* Auxiliary entries */
1988 memset ((char *) &symbolP
->sy_symbol
.ost_auxent
[0], 0, AUXESZ
);
1990 if (S_IS_STRING (symbolP
))
1991 SF_SET_STRING (symbolP
);
1992 if (!underscore
&& S_IS_LOCAL (symbolP
))
1993 SF_SET_LOCAL (symbolP
);
1997 * Handle .ln directives.
2001 obj_coff_ln (appline
)
2006 if (! appline
&& def_symbol_in_progress
!= NULL
)
2008 as_warn (".ln pseudo-op inside .def/.endef: ignored.");
2009 demand_empty_rest_of_line ();
2011 } /* wrong context */
2013 l
= get_absolute_expression ();
2014 c_line_new (0, frag_now_fix (), l
, frag_now
);
2023 listing_source_line ((unsigned int) l
);
2028 demand_empty_rest_of_line ();
2034 * Handle .def directives.
2036 * One might ask : why can't we symbol_new if the symbol does not
2037 * already exist and fill it with debug information. Because of
2038 * the C_EFCN special symbol. It would clobber the value of the
2039 * function symbol before we have a chance to notice that it is
2040 * a C_EFCN. And a second reason is that the code is more clear this
2041 * way. (at least I think it is :-).
2045 #define SKIP_SEMI_COLON() while (*input_line_pointer++ != ';')
2046 #define SKIP_WHITESPACES() while (*input_line_pointer == ' ' || \
2047 *input_line_pointer == '\t') \
2048 input_line_pointer++;
2054 char name_end
; /* Char after the end of name */
2055 char *symbol_name
; /* Name of the debug symbol */
2056 char *symbol_name_copy
; /* Temporary copy of the name */
2057 unsigned int symbol_name_length
;
2059 if (def_symbol_in_progress
!= NULL
)
2061 as_warn (".def pseudo-op used inside of .def/.endef: ignored.");
2062 demand_empty_rest_of_line ();
2064 } /* if not inside .def/.endef */
2066 SKIP_WHITESPACES ();
2068 def_symbol_in_progress
= (symbolS
*) obstack_alloc (¬es
, sizeof (*def_symbol_in_progress
));
2069 memset (def_symbol_in_progress
, 0, sizeof (*def_symbol_in_progress
));
2071 symbol_name
= input_line_pointer
;
2072 name_end
= get_symbol_end ();
2073 symbol_name_length
= strlen (symbol_name
);
2074 symbol_name_copy
= xmalloc (symbol_name_length
+ 1);
2075 strcpy (symbol_name_copy
, symbol_name
);
2077 /* Initialize the new symbol */
2078 #ifdef STRIP_UNDERSCORE
2079 S_SET_NAME (def_symbol_in_progress
, (*symbol_name_copy
== '_'
2080 ? symbol_name_copy
+ 1
2081 : symbol_name_copy
));
2082 #else /* STRIP_UNDERSCORE */
2083 S_SET_NAME (def_symbol_in_progress
, symbol_name_copy
);
2084 #endif /* STRIP_UNDERSCORE */
2085 /* free(symbol_name_copy); */
2086 def_symbol_in_progress
->sy_name_offset
= (unsigned long) ~0;
2087 def_symbol_in_progress
->sy_number
= ~0;
2088 def_symbol_in_progress
->sy_frag
= &zero_address_frag
;
2089 S_SET_VALUE (def_symbol_in_progress
, 0);
2091 if (S_IS_STRING (def_symbol_in_progress
))
2092 SF_SET_STRING (def_symbol_in_progress
);
2094 *input_line_pointer
= name_end
;
2096 demand_empty_rest_of_line ();
2099 unsigned int dim_index
;
2103 obj_coff_endef (ignore
)
2106 symbolS
*symbolP
= 0;
2107 /* DIM BUG FIX sac@cygnus.com */
2109 if (def_symbol_in_progress
== NULL
)
2111 as_warn (".endef pseudo-op used outside of .def/.endef: ignored.");
2112 demand_empty_rest_of_line ();
2114 } /* if not inside .def/.endef */
2116 /* Set the section number according to storage class. */
2117 switch (S_GET_STORAGE_CLASS (def_symbol_in_progress
))
2122 SF_SET_TAG (def_symbol_in_progress
);
2123 /* intentional fallthrough */
2126 SF_SET_DEBUG (def_symbol_in_progress
);
2127 S_SET_SEGMENT (def_symbol_in_progress
, SEG_DEBUG
);
2131 SF_SET_LOCAL (def_symbol_in_progress
); /* Do not emit this symbol. */
2132 /* intentional fallthrough */
2134 SF_SET_PROCESS (def_symbol_in_progress
); /* Will need processing before writing */
2135 /* intentional fallthrough */
2137 S_SET_SEGMENT (def_symbol_in_progress
, SEG_E0
);
2139 if (strcmp (S_GET_NAME (def_symbol_in_progress
), ".bf") == 0)
2141 if (function_lineoff
< 0)
2143 fprintf (stderr
, "`.bf' symbol without preceding function\n");
2144 } /* missing function symbol */
2145 SA_GET_SYM_LNNOPTR (last_line_symbol
) = function_lineoff
;
2147 SF_SET_PROCESS (last_line_symbol
);
2148 SF_SET_ADJ_LNNOPTR (last_line_symbol
);
2149 SF_SET_PROCESS (def_symbol_in_progress
);
2150 function_lineoff
= -1;
2152 /* Value is always set to . */
2153 def_symbol_in_progress
->sy_frag
= frag_now
;
2154 S_SET_VALUE (def_symbol_in_progress
, (valueT
) frag_now_fix ());
2159 #endif /* C_AUTOARG */
2169 SF_SET_DEBUG (def_symbol_in_progress
);
2170 S_SET_SEGMENT (def_symbol_in_progress
, absolute_section
);
2176 /* Valid but set somewhere else (s_comm, s_lcomm, colon) */
2182 as_warn ("unexpected storage class %d", S_GET_STORAGE_CLASS (def_symbol_in_progress
));
2184 } /* switch on storage class */
2186 /* Now that we have built a debug symbol, try to find if we should
2187 merge with an existing symbol or not. If a symbol is C_EFCN or
2188 absolute_section or untagged SEG_DEBUG it never merges. We also
2189 don't merge labels, which are in a different namespace, nor
2190 symbols which have not yet been defined since they are typically
2191 unique, nor do we merge tags with non-tags. */
2193 /* Two cases for functions. Either debug followed by definition or
2194 definition followed by debug. For definition first, we will
2195 merge the debug symbol into the definition. For debug first, the
2196 lineno entry MUST point to the definition function or else it
2197 will point off into space when crawl_symbols() merges the debug
2198 symbol into the real symbol. Therefor, let's presume the debug
2199 symbol is a real function reference. */
2201 /* FIXME-SOON If for some reason the definition label/symbol is
2202 never seen, this will probably leave an undefined symbol at link
2205 if (S_GET_STORAGE_CLASS (def_symbol_in_progress
) == C_EFCN
2206 || S_GET_STORAGE_CLASS (def_symbol_in_progress
) == C_LABEL
2207 || (S_GET_SEGMENT (def_symbol_in_progress
) == SEG_DEBUG
2208 && !SF_GET_TAG (def_symbol_in_progress
))
2209 || S_GET_SEGMENT (def_symbol_in_progress
) == absolute_section
2210 || def_symbol_in_progress
->sy_value
.X_op
!= O_constant
2211 || (symbolP
= symbol_find_base (S_GET_NAME (def_symbol_in_progress
), DO_NOT_STRIP
)) == NULL
2212 || (SF_GET_TAG (def_symbol_in_progress
) != SF_GET_TAG (symbolP
)))
2214 symbol_append (def_symbol_in_progress
, symbol_lastP
, &symbol_rootP
,
2219 /* This symbol already exists, merge the newly created symbol
2220 into the old one. This is not mandatory. The linker can
2221 handle duplicate symbols correctly. But I guess that it save
2222 a *lot* of space if the assembly file defines a lot of
2225 /* The debug entry (def_symbol_in_progress) is merged into the
2226 previous definition. */
2228 c_symbol_merge (def_symbol_in_progress
, symbolP
);
2229 /* FIXME-SOON Should *def_symbol_in_progress be free'd? xoxorich. */
2230 def_symbol_in_progress
= symbolP
;
2232 if (SF_GET_FUNCTION (def_symbol_in_progress
)
2233 || SF_GET_TAG (def_symbol_in_progress
)
2234 || S_GET_STORAGE_CLASS (def_symbol_in_progress
) == C_STAT
)
2236 /* For functions, and tags, and static symbols, the symbol
2237 *must* be where the debug symbol appears. Move the
2238 existing symbol to the current place. */
2239 /* If it already is at the end of the symbol list, do nothing */
2240 if (def_symbol_in_progress
!= symbol_lastP
)
2242 symbol_remove (def_symbol_in_progress
, &symbol_rootP
,
2244 symbol_append (def_symbol_in_progress
, symbol_lastP
,
2245 &symbol_rootP
, &symbol_lastP
);
2246 } /* if not already in place */
2248 } /* normal or mergable */
2250 if (SF_GET_TAG (def_symbol_in_progress
))
2254 oldtag
= symbol_find_base (S_GET_NAME (def_symbol_in_progress
),
2256 if (oldtag
== NULL
|| ! SF_GET_TAG (oldtag
))
2257 tag_insert (S_GET_NAME (def_symbol_in_progress
),
2258 def_symbol_in_progress
);
2261 if (SF_GET_FUNCTION (def_symbol_in_progress
))
2263 know (sizeof (def_symbol_in_progress
) <= sizeof (long));
2265 = c_line_new (def_symbol_in_progress
, 0, 0, &zero_address_frag
);
2267 SF_SET_PROCESS (def_symbol_in_progress
);
2269 if (symbolP
== NULL
)
2271 /* That is, if this is the first time we've seen the
2273 symbol_table_insert (def_symbol_in_progress
);
2274 } /* definition follows debug */
2275 } /* Create the line number entry pointing to the function being defined */
2277 def_symbol_in_progress
= NULL
;
2278 demand_empty_rest_of_line ();
2282 obj_coff_dim (ignore
)
2287 if (def_symbol_in_progress
== NULL
)
2289 as_warn (".dim pseudo-op used outside of .def/.endef: ignored.");
2290 demand_empty_rest_of_line ();
2292 } /* if not inside .def/.endef */
2294 S_SET_NUMBER_AUXILIARY (def_symbol_in_progress
, 1);
2296 for (dim_index
= 0; dim_index
< DIMNUM
; dim_index
++)
2298 SKIP_WHITESPACES ();
2299 SA_SET_SYM_DIMEN (def_symbol_in_progress
, dim_index
,
2300 get_absolute_expression ());
2302 switch (*input_line_pointer
)
2305 input_line_pointer
++;
2309 as_warn ("badly formed .dim directive ignored");
2310 /* intentional fallthrough */
2318 demand_empty_rest_of_line ();
2322 obj_coff_line (ignore
)
2328 if (def_symbol_in_progress
== NULL
)
2334 name
= S_GET_NAME (def_symbol_in_progress
);
2335 this_base
= get_absolute_expression ();
2337 /* Only .bf symbols indicate the use of a new base line number; the
2338 line numbers associated with .ef, .bb, .eb are relative to the
2339 start of the containing function. */
2340 if (!strcmp (".bf", name
))
2342 #if 0 /* XXX Can we ever have line numbers going backwards? */
2343 if (this_base
> line_base
)
2346 line_base
= this_base
;
2354 listing_source_line ((unsigned int) line_base
);
2360 S_SET_NUMBER_AUXILIARY (def_symbol_in_progress
, 1);
2361 SA_SET_SYM_LNNO (def_symbol_in_progress
, this_base
);
2363 demand_empty_rest_of_line ();
2367 obj_coff_size (ignore
)
2370 if (def_symbol_in_progress
== NULL
)
2372 as_warn (".size pseudo-op used outside of .def/.endef ignored.");
2373 demand_empty_rest_of_line ();
2375 } /* if not inside .def/.endef */
2377 S_SET_NUMBER_AUXILIARY (def_symbol_in_progress
, 1);
2378 SA_SET_SYM_SIZE (def_symbol_in_progress
, get_absolute_expression ());
2379 demand_empty_rest_of_line ();
2383 obj_coff_scl (ignore
)
2386 if (def_symbol_in_progress
== NULL
)
2388 as_warn (".scl pseudo-op used outside of .def/.endef ignored.");
2389 demand_empty_rest_of_line ();
2391 } /* if not inside .def/.endef */
2393 S_SET_STORAGE_CLASS (def_symbol_in_progress
, get_absolute_expression ());
2394 demand_empty_rest_of_line ();
2398 obj_coff_tag (ignore
)
2404 if (def_symbol_in_progress
== NULL
)
2406 as_warn (".tag pseudo-op used outside of .def/.endef ignored.");
2407 demand_empty_rest_of_line ();
2411 S_SET_NUMBER_AUXILIARY (def_symbol_in_progress
, 1);
2412 symbol_name
= input_line_pointer
;
2413 name_end
= get_symbol_end ();
2415 /* Assume that the symbol referred to by .tag is always defined.
2416 This was a bad assumption. I've added find_or_make. xoxorich. */
2417 SA_SET_SYM_TAGNDX (def_symbol_in_progress
,
2418 (long) tag_find_or_make (symbol_name
));
2419 if (SA_GET_SYM_TAGNDX (def_symbol_in_progress
) == 0L)
2421 as_warn ("tag not found for .tag %s", symbol_name
);
2424 SF_SET_TAGGED (def_symbol_in_progress
);
2425 *input_line_pointer
= name_end
;
2427 demand_empty_rest_of_line ();
2431 obj_coff_type (ignore
)
2434 if (def_symbol_in_progress
== NULL
)
2436 as_warn (".type pseudo-op used outside of .def/.endef ignored.");
2437 demand_empty_rest_of_line ();
2439 } /* if not inside .def/.endef */
2441 S_SET_DATA_TYPE (def_symbol_in_progress
, get_absolute_expression ());
2443 if (ISFCN (S_GET_DATA_TYPE (def_symbol_in_progress
)) &&
2444 S_GET_STORAGE_CLASS (def_symbol_in_progress
) != C_TPDEF
)
2446 SF_SET_FUNCTION (def_symbol_in_progress
);
2447 } /* is a function */
2449 demand_empty_rest_of_line ();
2453 obj_coff_val (ignore
)
2456 if (def_symbol_in_progress
== NULL
)
2458 as_warn (".val pseudo-op used outside of .def/.endef ignored.");
2459 demand_empty_rest_of_line ();
2461 } /* if not inside .def/.endef */
2463 if (is_name_beginner (*input_line_pointer
))
2465 char *symbol_name
= input_line_pointer
;
2466 char name_end
= get_symbol_end ();
2468 if (!strcmp (symbol_name
, "."))
2470 def_symbol_in_progress
->sy_frag
= frag_now
;
2471 S_SET_VALUE (def_symbol_in_progress
, (valueT
) frag_now_fix ());
2472 /* If the .val is != from the .def (e.g. statics) */
2474 else if (strcmp (S_GET_NAME (def_symbol_in_progress
), symbol_name
))
2476 def_symbol_in_progress
->sy_value
.X_op
= O_symbol
;
2477 def_symbol_in_progress
->sy_value
.X_add_symbol
=
2478 symbol_find_or_make (symbol_name
);
2479 def_symbol_in_progress
->sy_value
.X_op_symbol
= NULL
;
2480 def_symbol_in_progress
->sy_value
.X_add_number
= 0;
2482 /* If the segment is undefined when the forward reference is
2483 resolved, then copy the segment id from the forward
2485 SF_SET_GET_SEGMENT (def_symbol_in_progress
);
2487 /* FIXME: gcc can generate address expressions
2488 here in unusual cases (search for "obscure"
2489 in sdbout.c). We just ignore the offset
2490 here, thus generating incorrect debugging
2491 information. We ignore the rest of the
2494 /* Otherwise, it is the name of a non debug symbol and
2495 its value will be calculated later. */
2496 *input_line_pointer
= name_end
;
2498 /* FIXME: this is to avoid an error message in the
2499 FIXME case mentioned just above. */
2500 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
2501 ++input_line_pointer
;
2505 S_SET_VALUE (def_symbol_in_progress
,
2506 (valueT
) get_absolute_expression ());
2507 } /* if symbol based */
2509 demand_empty_rest_of_line ();
2514 /* Handle the .linkonce pseudo-op. This is parsed by s_linkonce in
2515 read.c, which then calls this object file format specific routine. */
2518 obj_coff_pe_handle_link_once (type
)
2519 enum linkonce_type type
;
2521 seg_info (now_seg
)->scnhdr
.s_flags
|= IMAGE_SCN_LNK_COMDAT
;
2523 /* We store the type in the seg_info structure, and use it to set up
2524 the auxiliary entry for the section symbol in c_section_symbol. */
2525 seg_info (now_seg
)->linkonce
= type
;
2531 obj_read_begin_hook ()
2533 /* These had better be the same. Usually 18 bytes. */
2535 know (sizeof (SYMENT
) == sizeof (AUXENT
));
2536 know (SYMESZ
== AUXESZ
);
2541 /* This function runs through the symbol table and puts all the
2542 externals onto another chain */
2544 /* The chain of globals. */
2545 symbolS
*symbol_globalP
;
2546 symbolS
*symbol_global_lastP
;
2548 /* The chain of externals */
2549 symbolS
*symbol_externP
;
2550 symbolS
*symbol_extern_lastP
;
2553 symbolS
*last_functionP
;
2554 static symbolS
*last_bfP
;
2561 unsigned int symbol_number
= 0;
2562 unsigned int last_file_symno
= 0;
2564 struct filename_list
*filename_list_scan
= filename_list_head
;
2566 for (symbolP
= symbol_rootP
;
2568 symbolP
= symbolP
? symbol_next (symbolP
) : symbol_rootP
)
2570 if (symbolP
->sy_mri_common
)
2572 if (S_GET_STORAGE_CLASS (symbolP
) == C_EXT
)
2573 as_bad ("%s: global symbols not supported in common sections",
2574 S_GET_NAME (symbolP
));
2575 symbol_remove (symbolP
, &symbol_rootP
, &symbol_lastP
);
2579 if (!SF_GET_DEBUG (symbolP
))
2581 /* Debug symbols do not need all this rubbish */
2582 symbolS
*real_symbolP
;
2584 /* L* and C_EFCN symbols never merge. */
2585 if (!SF_GET_LOCAL (symbolP
)
2586 && !SF_GET_STATICS (symbolP
)
2587 && S_GET_STORAGE_CLASS (symbolP
) != C_LABEL
2588 && symbolP
->sy_value
.X_op
== O_constant
2589 && (real_symbolP
= symbol_find_base (S_GET_NAME (symbolP
), DO_NOT_STRIP
))
2590 && real_symbolP
!= symbolP
)
2592 /* FIXME-SOON: where do dups come from?
2593 Maybe tag references before definitions? xoxorich. */
2594 /* Move the debug data from the debug symbol to the
2595 real symbol. Do NOT do the oposite (i.e. move from
2596 real symbol to debug symbol and remove real symbol from the
2597 list.) Because some pointers refer to the real symbol
2598 whereas no pointers refer to the debug symbol. */
2599 c_symbol_merge (symbolP
, real_symbolP
);
2600 /* Replace the current symbol by the real one */
2601 /* The symbols will never be the last or the first
2602 because : 1st symbol is .file and 3 last symbols are
2603 .text, .data, .bss */
2604 symbol_remove (real_symbolP
, &symbol_rootP
, &symbol_lastP
);
2605 symbol_insert (real_symbolP
, symbolP
, &symbol_rootP
, &symbol_lastP
);
2606 symbol_remove (symbolP
, &symbol_rootP
, &symbol_lastP
);
2607 symbolP
= real_symbolP
;
2608 } /* if not local but dup'd */
2610 if (flag_readonly_data_in_text
&& (S_GET_SEGMENT (symbolP
) == SEG_E1
))
2612 S_SET_SEGMENT (symbolP
, SEG_E0
);
2613 } /* push data into text */
2615 resolve_symbol_value (symbolP
);
2617 if (S_GET_STORAGE_CLASS (symbolP
) == C_NULL
)
2619 if (!S_IS_DEFINED (symbolP
) && !SF_GET_LOCAL (symbolP
))
2621 S_SET_EXTERNAL (symbolP
);
2623 else if (S_GET_SEGMENT (symbolP
) == SEG_E0
)
2625 S_SET_STORAGE_CLASS (symbolP
, C_LABEL
);
2629 S_SET_STORAGE_CLASS (symbolP
, C_STAT
);
2633 /* Mainly to speed up if not -g */
2634 if (SF_GET_PROCESS (symbolP
))
2636 /* Handle the nested blocks auxiliary info. */
2637 if (S_GET_STORAGE_CLASS (symbolP
) == C_BLOCK
)
2639 if (!strcmp (S_GET_NAME (symbolP
), ".bb"))
2640 stack_push (block_stack
, (char *) &symbolP
);
2643 register symbolS
*begin_symbolP
;
2644 begin_symbolP
= *(symbolS
**) stack_pop (block_stack
);
2645 if (begin_symbolP
== (symbolS
*) 0)
2646 as_warn ("mismatched .eb");
2648 SA_SET_SYM_ENDNDX (begin_symbolP
, symbol_number
+ 2);
2651 /* If we are able to identify the type of a function, and we
2652 are out of a function (last_functionP == 0) then, the
2653 function symbol will be associated with an auxiliary
2655 if (last_functionP
== (symbolS
*) 0 &&
2656 SF_GET_FUNCTION (symbolP
))
2658 last_functionP
= symbolP
;
2660 if (S_GET_NUMBER_AUXILIARY (symbolP
) < 1)
2662 S_SET_NUMBER_AUXILIARY (symbolP
, 1);
2663 } /* make it at least 1 */
2665 /* Clobber possible stale .dim information. */
2667 /* Iffed out by steve - this fries the lnnoptr info too */
2668 bzero (symbolP
->sy_symbol
.ost_auxent
[0].x_sym
.x_fcnary
.x_ary
.x_dimen
,
2669 sizeof (symbolP
->sy_symbol
.ost_auxent
[0].x_sym
.x_fcnary
.x_ary
.x_dimen
));
2672 if (S_GET_STORAGE_CLASS (symbolP
) == C_FCN
)
2674 if (strcmp (S_GET_NAME (symbolP
), ".bf") == 0)
2676 if (last_bfP
!= NULL
)
2677 SA_SET_SYM_ENDNDX (last_bfP
, symbol_number
);
2681 else if (S_GET_STORAGE_CLASS (symbolP
) == C_EFCN
)
2683 /* I don't even know if this is needed for sdb. But
2684 the standard assembler generates it, so... */
2685 if (last_functionP
== (symbolS
*) 0)
2686 as_fatal ("C_EFCN symbol out of scope");
2687 SA_SET_SYM_FSIZE (last_functionP
,
2688 (long) (S_GET_VALUE (symbolP
) -
2689 S_GET_VALUE (last_functionP
)));
2690 SA_SET_SYM_ENDNDX (last_functionP
, symbol_number
);
2691 last_functionP
= (symbolS
*) 0;
2695 else if (SF_GET_TAG (symbolP
))
2697 /* First descriptor of a structure must point to
2698 the first slot after the structure description. */
2699 last_tagP
= symbolP
;
2702 else if (S_GET_STORAGE_CLASS (symbolP
) == C_EOS
)
2704 /* +2 take in account the current symbol */
2705 SA_SET_SYM_ENDNDX (last_tagP
, symbol_number
+ 2);
2707 else if (S_GET_STORAGE_CLASS (symbolP
) == C_FILE
)
2709 /* If the filename was too long to fit in the
2710 auxent, put it in the string table */
2711 if (SA_GET_FILE_FNAME_ZEROS (symbolP
) == 0
2712 && SA_GET_FILE_FNAME_OFFSET (symbolP
) != 0)
2714 SA_SET_FILE_FNAME_OFFSET (symbolP
, string_byte_count
);
2715 string_byte_count
+= strlen (filename_list_scan
->filename
) + 1;
2716 filename_list_scan
= filename_list_scan
->next
;
2718 if (S_GET_VALUE (symbolP
))
2720 S_SET_VALUE (symbolP
, last_file_symno
);
2721 last_file_symno
= symbol_number
;
2722 } /* no one points at the first .file symbol */
2723 } /* if debug or tag or eos or file */
2725 #ifdef tc_frob_coff_symbol
2726 tc_frob_coff_symbol (symbolP
);
2729 /* We must put the external symbols apart. The loader
2730 does not bomb if we do not. But the references in
2731 the endndx field for a .bb symbol are not corrected
2732 if an external symbol is removed between .bb and .be.
2733 I.e in the following case :
2734 [20] .bb endndx = 22
2737 ld will move the symbol 21 to the end of the list but
2738 endndx will still be 22 instead of 21. */
2741 if (SF_GET_LOCAL (symbolP
))
2743 /* remove C_EFCN and LOCAL (L...) symbols */
2744 /* next pointer remains valid */
2745 symbol_remove (symbolP
, &symbol_rootP
, &symbol_lastP
);
2748 else if (symbolP
->sy_value
.X_op
== O_symbol
2749 && (! S_IS_DEFINED (symbolP
) || S_IS_COMMON (symbolP
)))
2751 /* Skip symbols which were equated to undefined or common
2753 symbol_remove (symbolP
, &symbol_rootP
, &symbol_lastP
);
2755 else if (!S_IS_DEFINED (symbolP
)
2756 && !S_IS_DEBUG (symbolP
)
2757 && !SF_GET_STATICS (symbolP
) &&
2758 S_GET_STORAGE_CLASS (symbolP
) == C_EXT
)
2759 { /* C_EXT && !SF_GET_FUNCTION(symbolP)) */
2760 /* if external, Remove from the list */
2761 symbolS
*hold
= symbol_previous (symbolP
);
2763 symbol_remove (symbolP
, &symbol_rootP
, &symbol_lastP
);
2764 symbol_clear_list_pointers (symbolP
);
2765 symbol_append (symbolP
, symbol_extern_lastP
, &symbol_externP
, &symbol_extern_lastP
);
2768 else if (! S_IS_DEBUG (symbolP
)
2769 && ! SF_GET_STATICS (symbolP
)
2770 && ! SF_GET_FUNCTION (symbolP
)
2771 && S_GET_STORAGE_CLASS (symbolP
) == C_EXT
)
2773 symbolS
*hold
= symbol_previous (symbolP
);
2775 /* The O'Reilly COFF book says that defined global symbols
2776 come at the end of the symbol table, just before
2777 undefined global symbols. */
2779 symbol_remove (symbolP
, &symbol_rootP
, &symbol_lastP
);
2780 symbol_clear_list_pointers (symbolP
);
2781 symbol_append (symbolP
, symbol_global_lastP
, &symbol_globalP
,
2782 &symbol_global_lastP
);
2787 if (SF_GET_STRING (symbolP
))
2789 symbolP
->sy_name_offset
= string_byte_count
;
2790 string_byte_count
+= strlen (S_GET_NAME (symbolP
)) + 1;
2794 symbolP
->sy_name_offset
= 0;
2795 } /* fix "long" names */
2797 symbolP
->sy_number
= symbol_number
;
2798 symbol_number
+= 1 + S_GET_NUMBER_AUXILIARY (symbolP
);
2799 } /* if local symbol */
2800 } /* traverse the symbol list */
2801 return symbol_number
;
2807 glue_symbols (head
, tail
)
2811 unsigned int symbol_number
= 0;
2814 for (symbolP
= *head
; *head
!= NULL
;)
2816 symbolS
*tmp
= *head
;
2819 symbol_remove (tmp
, head
, tail
);
2820 symbol_append (tmp
, symbol_lastP
, &symbol_rootP
, &symbol_lastP
);
2823 if (SF_GET_STRING (tmp
))
2825 tmp
->sy_name_offset
= string_byte_count
;
2826 string_byte_count
+= strlen (S_GET_NAME (tmp
)) + 1;
2830 tmp
->sy_name_offset
= 0;
2831 } /* fix "long" names */
2833 tmp
->sy_number
= symbol_number
;
2834 symbol_number
+= 1 + S_GET_NUMBER_AUXILIARY (tmp
);
2835 } /* append the entire extern chain */
2837 return symbol_number
;
2843 unsigned int symbol_number
= 0;
2846 for (symbolP
= symbol_rootP
; symbolP
; symbolP
=
2847 symbol_next (symbolP
))
2849 symbolP
->sy_number
= symbol_number
;
2853 if (SF_GET_TAGGED (symbolP
))
2857 ((symbolS
*) SA_GET_SYM_TAGNDX (symbolP
))->sy_number
);
2860 symbol_number
+= 1 + S_GET_NUMBER_AUXILIARY (symbolP
);
2862 return symbol_number
;
2867 crawl_symbols (h
, abfd
)
2873 /* Initialize the stack used to keep track of the matching .bb .be */
2875 block_stack
= stack_init (512, sizeof (symbolS
*));
2877 /* The symbol list should be ordered according to the following sequence
2880 * . debug entries for functions
2881 * . fake symbols for the sections, including.text .data and .bss
2883 * . undefined symbols
2884 * But this is not mandatory. The only important point is to put the
2885 * undefined symbols at the end of the list.
2888 if (symbol_rootP
== NULL
2889 || S_GET_STORAGE_CLASS (symbol_rootP
) != C_FILE
)
2891 c_dot_file_symbol ("fake");
2893 /* Is there a .file symbol ? If not insert one at the beginning. */
2896 * Build up static symbols for the sections, they are filled in later
2900 for (i
= SEG_E0
; i
< SEG_LAST
; i
++)
2901 if (segment_info
[i
].scnhdr
.s_name
[0])
2902 segment_info
[i
].dot
= c_section_symbol (segment_info
[i
].name
,
2905 /* Take all the externals out and put them into another chain */
2906 H_SET_SYMBOL_TABLE_SIZE (h
, yank_symbols ());
2907 /* Take the externals and glue them onto the end.*/
2908 H_SET_SYMBOL_TABLE_SIZE (h
,
2909 (H_GET_SYMBOL_COUNT (h
)
2910 + glue_symbols (&symbol_globalP
,
2911 &symbol_global_lastP
)
2912 + glue_symbols (&symbol_externP
,
2913 &symbol_extern_lastP
)));
2915 H_SET_SYMBOL_TABLE_SIZE (h
, tie_tags ());
2916 know (symbol_globalP
== NULL
);
2917 know (symbol_global_lastP
== NULL
);
2918 know (symbol_externP
== NULL
);
2919 know (symbol_extern_lastP
== NULL
);
2923 * Find strings by crawling along symbol table chain.
2931 struct filename_list
*filename_list_scan
= filename_list_head
;
2933 /* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */
2934 md_number_to_chars (where
, (valueT
) string_byte_count
, 4);
2937 #ifdef COFF_LONG_SECTION_NAMES
2938 /* Support long section names as found in PE. This code must
2939 coordinate with that in coff_header_append and write_object_file. */
2943 for (i
= SEG_E0
; i
< SEG_LAST
; i
++)
2945 if (segment_info
[i
].scnhdr
.s_name
[0]
2946 && strlen (segment_info
[i
].name
) > SCNNMLEN
)
2950 size
= strlen (segment_info
[i
].name
) + 1;
2951 memcpy (where
, segment_info
[i
].name
, size
);
2956 #endif /* COFF_LONG_SECTION_NAMES */
2958 for (symbolP
= symbol_rootP
;
2960 symbolP
= symbol_next (symbolP
))
2964 if (SF_GET_STRING (symbolP
))
2966 size
= strlen (S_GET_NAME (symbolP
)) + 1;
2967 memcpy (where
, S_GET_NAME (symbolP
), size
);
2970 if (S_GET_STORAGE_CLASS (symbolP
) == C_FILE
2971 && SA_GET_FILE_FNAME_ZEROS (symbolP
) == 0
2972 && SA_GET_FILE_FNAME_OFFSET (symbolP
) != 0)
2974 size
= strlen (filename_list_scan
->filename
) + 1;
2975 memcpy (where
, filename_list_scan
->filename
, size
);
2976 filename_list_scan
= filename_list_scan
->next
;
2983 do_linenos_for (abfd
, h
, file_cursor
)
2986 unsigned long *file_cursor
;
2989 unsigned long start
= *file_cursor
;
2991 for (idx
= SEG_E0
; idx
< SEG_LAST
; idx
++)
2993 segment_info_type
*s
= segment_info
+ idx
;
2996 if (s
->scnhdr
.s_nlnno
!= 0)
2998 struct lineno_list
*line_ptr
;
3000 struct external_lineno
*buffer
=
3001 (struct external_lineno
*) xmalloc (s
->scnhdr
.s_nlnno
* LINESZ
);
3003 struct external_lineno
*dst
= buffer
;
3005 /* Run through the table we've built and turn it into its external
3006 form, take this chance to remove duplicates */
3008 for (line_ptr
= s
->lineno_list_head
;
3009 line_ptr
!= (struct lineno_list
*) NULL
;
3010 line_ptr
= line_ptr
->next
)
3013 if (line_ptr
->line
.l_lnno
== 0)
3015 /* Turn a pointer to a symbol into the symbols' index */
3016 line_ptr
->line
.l_addr
.l_symndx
=
3017 ((symbolS
*) line_ptr
->line
.l_addr
.l_symndx
)->sy_number
;
3021 line_ptr
->line
.l_addr
.l_paddr
+= ((struct frag
*) (line_ptr
->frag
))->fr_address
;
3025 (void) bfd_coff_swap_lineno_out (abfd
, &(line_ptr
->line
), dst
);
3030 s
->scnhdr
.s_lnnoptr
= *file_cursor
;
3032 bfd_write (buffer
, 1, s
->scnhdr
.s_nlnno
* LINESZ
, abfd
);
3035 *file_cursor
+= s
->scnhdr
.s_nlnno
* LINESZ
;
3038 H_SET_LINENO_SIZE (h
, *file_cursor
- start
);
3042 /* Now we run through the list of frag chains in a segment and
3043 make all the subsegment frags appear at the end of the
3044 list, as if the seg 0 was extra long */
3051 for (i
= SEG_E0
; i
< SEG_UNKNOWN
; i
++)
3053 frchainS
*head
= segment_info
[i
].frchainP
;
3055 fragS
*prev_frag
= &dummy
;
3057 while (head
&& head
->frch_seg
== i
)
3059 prev_frag
->fr_next
= head
->frch_root
;
3060 prev_frag
= head
->frch_last
;
3061 head
= head
->frch_next
;
3063 prev_frag
->fr_next
= 0;
3067 unsigned long machine
;
3070 write_object_file ()
3074 struct frchain
*frchain_ptr
;
3076 object_headers headers
;
3077 unsigned long file_cursor
;
3080 abfd
= bfd_openw (out_file_name
, TARGET_FORMAT
);
3085 as_perror ("FATAL: Can't create %s", out_file_name
);
3086 exit (EXIT_FAILURE
);
3088 bfd_set_format (abfd
, bfd_object
);
3089 bfd_set_arch_mach (abfd
, BFD_ARCH
, machine
);
3091 string_byte_count
= 4;
3093 for (frchain_ptr
= frchain_root
;
3094 frchain_ptr
!= (struct frchain
*) NULL
;
3095 frchain_ptr
= frchain_ptr
->frch_next
)
3097 /* Run through all the sub-segments and align them up. Also
3098 close any open frags. We tack a .fill onto the end of the
3099 frag chain so that any .align's size can be worked by looking
3100 at the next frag. */
3102 subseg_set (frchain_ptr
->frch_seg
, frchain_ptr
->frch_subseg
);
3103 #ifndef SUB_SEGMENT_ALIGN
3104 #define SUB_SEGMENT_ALIGN(SEG) 1
3108 static char nop
= NOP_OPCODE
;
3109 md_do_align (SUB_SEGMENT_ALIGN (now_seg
), &nop
, 1, alignment_done
);
3112 frag_align (SUB_SEGMENT_ALIGN (now_seg
), NOP_OPCODE
);
3116 frag_wane (frag_now
);
3117 frag_now
->fr_fix
= 0;
3118 know (frag_now
->fr_next
== NULL
);
3125 for (i
= SEG_E0
; i
< SEG_UNKNOWN
; i
++)
3127 relax_segment (segment_info
[i
].frchainP
->frch_root
, i
);
3130 H_SET_NUMBER_OF_SECTIONS (&headers
, 0);
3132 /* Find out how big the sections are, and set the addresses. */
3134 for (i
= SEG_E0
; i
< SEG_UNKNOWN
; i
++)
3138 segment_info
[i
].scnhdr
.s_paddr
= addr
;
3139 segment_info
[i
].scnhdr
.s_vaddr
= addr
;
3141 if (segment_info
[i
].scnhdr
.s_name
[0])
3143 H_SET_NUMBER_OF_SECTIONS (&headers
,
3144 H_GET_NUMBER_OF_SECTIONS (&headers
) + 1);
3146 #ifdef COFF_LONG_SECTION_NAMES
3147 /* Support long section names as found in PE. This code
3148 must coordinate with that in coff_header_append and
3153 len
= strlen (segment_info
[i
].name
);
3155 string_byte_count
+= len
+ 1;
3157 #endif /* COFF_LONG_SECTION_NAMES */
3160 size
= size_section (abfd
, (unsigned int) i
);
3163 /* I think the section alignment is only used on the i960; the
3164 i960 needs it, and it should do no harm on other targets. */
3165 segment_info
[i
].scnhdr
.s_align
= 1 << section_alignment
[i
];
3168 H_SET_TEXT_SIZE (&headers
, size
);
3169 else if (i
== SEG_E1
)
3170 H_SET_DATA_SIZE (&headers
, size
);
3171 else if (i
== SEG_E2
)
3172 H_SET_BSS_SIZE (&headers
, size
);
3175 /* Turn the gas native symbol table shape into a coff symbol table */
3176 crawl_symbols (&headers
, abfd
);
3178 if (string_byte_count
== 4)
3179 string_byte_count
= 0;
3181 H_SET_STRING_SIZE (&headers
, string_byte_count
);
3187 for (i
= SEG_E0
; i
< SEG_UNKNOWN
; i
++)
3189 fixup_mdeps (segment_info
[i
].frchainP
->frch_root
, &headers
, i
);
3190 fixup_segment (&segment_info
[i
], i
);
3193 /* Look for ".stab" segments and fill in their initial symbols
3195 for (i
= SEG_E0
; i
< SEG_UNKNOWN
; i
++)
3197 name
= segment_info
[i
].name
;
3200 && strncmp (".stab", name
, 5) == 0
3201 && strncmp (".stabstr", name
, 8) != 0)
3202 adjust_stab_section (abfd
, i
);
3205 file_cursor
= H_GET_TEXT_FILE_OFFSET (&headers
);
3207 bfd_seek (abfd
, (file_ptr
) file_cursor
, 0);
3209 /* Plant the data */
3211 fill_section (abfd
, &headers
, &file_cursor
);
3213 do_relocs_for (abfd
, &headers
, &file_cursor
);
3215 do_linenos_for (abfd
, &headers
, &file_cursor
);
3217 H_SET_FILE_MAGIC_NUMBER (&headers
, COFF_MAGIC
);
3218 #ifndef OBJ_COFF_OMIT_TIMESTAMP
3219 H_SET_TIME_STAMP (&headers
, (long)time((time_t *)0));
3221 H_SET_TIME_STAMP (&headers
, 0);
3223 #ifdef TC_COFF_SET_MACHINE
3224 TC_COFF_SET_MACHINE (&headers
);
3228 #define COFF_FLAGS 0
3231 #ifdef KEEP_RELOC_INFO
3232 H_SET_FLAGS (&headers
, ((H_GET_LINENO_SIZE(&headers
) ? 0 : F_LNNO
) |
3233 COFF_FLAGS
| coff_flags
));
3235 H_SET_FLAGS (&headers
, ((H_GET_LINENO_SIZE(&headers
) ? 0 : F_LNNO
) |
3236 (H_GET_RELOCATION_SIZE(&headers
) ? 0 : F_RELFLG
) |
3237 COFF_FLAGS
| coff_flags
));
3241 unsigned int symtable_size
= H_GET_SYMBOL_TABLE_SIZE (&headers
);
3242 char *buffer1
= xmalloc (symtable_size
+ string_byte_count
+ 1);
3244 H_SET_SYMBOL_TABLE_POINTER (&headers
, bfd_tell (abfd
));
3245 w_symbols (abfd
, buffer1
, symbol_rootP
);
3246 if (string_byte_count
> 0)
3247 w_strings (buffer1
+ symtable_size
);
3248 bfd_write (buffer1
, 1, symtable_size
+ string_byte_count
, abfd
);
3252 coff_header_append (abfd
, &headers
);
3254 /* Recent changes to write need this, but where it should
3255 go is up to Ken.. */
3256 if (bfd_close_all_done (abfd
) == false)
3257 as_fatal ("Can't close %s: %s", out_file_name
,
3258 bfd_errmsg (bfd_get_error ()));
3261 extern bfd
*stdoutput
;
3268 /* Add a new segment. This is called from subseg_new via the
3269 obj_new_segment macro. */
3272 obj_coff_add_segment (name
)
3277 #ifndef COFF_LONG_SECTION_NAMES
3278 char buf
[SCNNMLEN
+ 1];
3280 strncpy (buf
, name
, SCNNMLEN
);
3281 buf
[SCNNMLEN
] = '\0';
3285 for (i
= SEG_E0
; i
< SEG_LAST
&& segment_info
[i
].scnhdr
.s_name
[0]; i
++)
3286 if (strcmp (name
, segment_info
[i
].name
) == 0)
3291 as_bad ("Too many new sections; can't add \"%s\"", name
);
3295 /* Add a new section. */
3296 strncpy (segment_info
[i
].scnhdr
.s_name
, name
,
3297 sizeof (segment_info
[i
].scnhdr
.s_name
));
3298 segment_info
[i
].scnhdr
.s_flags
= STYP_REG
;
3299 segment_info
[i
].name
= xstrdup (name
);
3305 * implement the .section pseudo op:
3306 * .section name {, "flags"}
3308 * | +--- optional flags: 'b' for bss
3310 * +-- section name 'l' for lib
3314 * 'd' (apparently m88k for data)
3316 * But if the argument is not a quoted string, treat it as a
3317 * subsegment number.
3321 obj_coff_section (ignore
)
3324 /* Strip out the section name */
3325 char *section_name
, *name
;
3338 else if (type
== 'D')
3340 segment_info
[now_seg
].scnhdr
.s_flags
|= flags
;
3345 section_name
= input_line_pointer
;
3346 c
= get_symbol_end ();
3348 name
= xmalloc (input_line_pointer
- section_name
+ 1);
3349 strcpy (name
, section_name
);
3351 *input_line_pointer
= c
;
3357 if (*input_line_pointer
== ',')
3359 ++input_line_pointer
;
3362 if (*input_line_pointer
!= '"')
3363 exp
= get_absolute_expression ();
3366 ++input_line_pointer
;
3367 while (*input_line_pointer
!= '"'
3368 && ! is_end_of_line
[(unsigned char) *input_line_pointer
])
3370 switch (*input_line_pointer
)
3372 case 'b': flags
|= STYP_BSS
; break;
3373 case 'i': flags
|= STYP_INFO
; break;
3374 case 'l': flags
|= STYP_LIB
; break;
3375 case 'n': flags
|= STYP_NOLOAD
; break;
3376 case 'o': flags
|= STYP_OVER
; break;
3378 case 'w': flags
|= STYP_DATA
; break;
3379 case 'x': flags
|= STYP_TEXT
; break;
3381 as_warn("unknown section attribute '%c'",
3382 *input_line_pointer
);
3385 ++input_line_pointer
;
3387 if (*input_line_pointer
== '"')
3388 ++input_line_pointer
;
3392 subseg_new (name
, (subsegT
) exp
);
3394 segment_info
[now_seg
].scnhdr
.s_flags
|= flags
;
3396 demand_empty_rest_of_line ();
3401 obj_coff_text (ignore
)
3404 subseg_new (".text", get_absolute_expression ());
3409 obj_coff_data (ignore
)
3412 if (flag_readonly_data_in_text
)
3413 subseg_new (".text", get_absolute_expression () + 1000);
3415 subseg_new (".data", get_absolute_expression ());
3419 obj_coff_bss (ignore
)
3422 if (*input_line_pointer
== '\n') /* .bss */
3423 subseg_new(".bss", get_absolute_expression());
3424 else /* .bss id,expr */
3429 obj_coff_ident (ignore
)
3432 segT current_seg
= now_seg
; /* save current seg */
3433 subsegT current_subseg
= now_subseg
;
3434 subseg_new (".comment", 0); /* .comment seg */
3435 stringer (1); /* read string */
3436 subseg_set (current_seg
, current_subseg
); /* restore current seg */
3440 c_symbol_merge (debug
, normal
)
3444 S_SET_DATA_TYPE (normal
, S_GET_DATA_TYPE (debug
));
3445 S_SET_STORAGE_CLASS (normal
, S_GET_STORAGE_CLASS (debug
));
3447 if (S_GET_NUMBER_AUXILIARY (debug
) > S_GET_NUMBER_AUXILIARY (normal
))
3449 S_SET_NUMBER_AUXILIARY (normal
, S_GET_NUMBER_AUXILIARY (debug
));
3450 } /* take the most we have */
3452 if (S_GET_NUMBER_AUXILIARY (debug
) > 0)
3454 memcpy ((char *) &normal
->sy_symbol
.ost_auxent
[0],
3455 (char *) &debug
->sy_symbol
.ost_auxent
[0],
3456 (unsigned int) (S_GET_NUMBER_AUXILIARY (debug
) * AUXESZ
));
3457 } /* Move all the auxiliary information */
3459 /* Move the debug flags. */
3460 SF_SET_DEBUG_FIELD (normal
, SF_GET_DEBUG_FIELD (debug
));
3461 } /* c_symbol_merge() */
3464 c_line_new (symbol
, paddr
, line_number
, frag
)
3470 struct lineno_list
*new_line
=
3471 (struct lineno_list
*) xmalloc (sizeof (struct lineno_list
));
3473 segment_info_type
*s
= segment_info
+ now_seg
;
3474 new_line
->line
.l_lnno
= line_number
;
3476 if (line_number
== 0)
3478 last_line_symbol
= symbol
;
3479 new_line
->line
.l_addr
.l_symndx
= (long) symbol
;
3483 new_line
->line
.l_addr
.l_paddr
= paddr
;
3486 new_line
->frag
= (char *) frag
;
3487 new_line
->next
= (struct lineno_list
*) NULL
;
3490 if (s
->lineno_list_head
== (struct lineno_list
*) NULL
)
3492 s
->lineno_list_head
= new_line
;
3496 s
->lineno_list_tail
->next
= new_line
;
3498 s
->lineno_list_tail
= new_line
;
3499 return LINESZ
* s
->scnhdr
.s_nlnno
++;
3503 c_dot_file_symbol (filename
)
3508 symbolP
= symbol_new (".file",
3511 &zero_address_frag
);
3513 S_SET_STORAGE_CLASS (symbolP
, C_FILE
);
3514 S_SET_NUMBER_AUXILIARY (symbolP
, 1);
3516 if (strlen (filename
) > FILNMLEN
)
3518 /* Filename is too long to fit into an auxent,
3519 we stick it into the string table instead. We keep
3520 a linked list of the filenames we find so we can emit
3522 struct filename_list
*f
= ((struct filename_list
*)
3523 xmalloc (sizeof (struct filename_list
)));
3525 f
->filename
= filename
;
3528 SA_SET_FILE_FNAME_ZEROS (symbolP
, 0);
3529 SA_SET_FILE_FNAME_OFFSET (symbolP
, 1);
3531 if (filename_list_tail
)
3532 filename_list_tail
->next
= f
;
3534 filename_list_head
= f
;
3535 filename_list_tail
= f
;
3539 SA_SET_FILE_FNAME (symbolP
, filename
);
3546 listing_source_file (filename
);
3552 SF_SET_DEBUG (symbolP
);
3553 S_SET_VALUE (symbolP
, (valueT
) previous_file_symbol
);
3555 previous_file_symbol
= symbolP
;
3557 /* Make sure that the symbol is first on the symbol chain */
3558 if (symbol_rootP
!= symbolP
)
3560 if (symbolP
== symbol_lastP
)
3562 symbol_lastP
= symbol_lastP
->sy_previous
;
3563 } /* if it was the last thing on the list */
3565 symbol_remove (symbolP
, &symbol_rootP
, &symbol_lastP
);
3566 symbol_insert (symbolP
, symbol_rootP
, &symbol_rootP
, &symbol_lastP
);
3567 symbol_rootP
= symbolP
;
3568 } /* if not first on the list */
3570 } /* c_dot_file_symbol() */
3573 * Build a 'section static' symbol.
3577 c_section_symbol (name
, idx
)
3583 symbolP
= symbol_new (name
, idx
,
3585 &zero_address_frag
);
3587 S_SET_STORAGE_CLASS (symbolP
, C_STAT
);
3588 S_SET_NUMBER_AUXILIARY (symbolP
, 1);
3590 SF_SET_STATICS (symbolP
);
3593 /* If the .linkonce pseudo-op was used for this section, we must
3594 store the information in the auxiliary entry for the section
3596 if (segment_info
[idx
].linkonce
!= LINKONCE_UNSET
)
3600 switch (segment_info
[idx
].linkonce
)
3604 case LINKONCE_DISCARD
:
3605 type
= IMAGE_COMDAT_SELECT_ANY
;
3607 case LINKONCE_ONE_ONLY
:
3608 type
= IMAGE_COMDAT_SELECT_NODUPLICATES
;
3610 case LINKONCE_SAME_SIZE
:
3611 type
= IMAGE_COMDAT_SELECT_SAME_SIZE
;
3613 case LINKONCE_SAME_CONTENTS
:
3614 type
= IMAGE_COMDAT_SELECT_EXACT_MATCH
;
3618 SYM_AUXENT (symbolP
)->x_scn
.x_comdat
= type
;
3623 } /* c_section_symbol() */
3626 w_symbols (abfd
, where
, symbol_rootP
)
3629 symbolS
* symbol_rootP
;
3634 /* First fill in those values we have only just worked out */
3635 for (i
= SEG_E0
; i
< SEG_LAST
; i
++)
3637 symbolP
= segment_info
[i
].dot
;
3640 SA_SET_SCN_SCNLEN (symbolP
, segment_info
[i
].scnhdr
.s_size
);
3641 SA_SET_SCN_NRELOC (symbolP
, segment_info
[i
].scnhdr
.s_nreloc
);
3642 SA_SET_SCN_NLINNO (symbolP
, segment_info
[i
].scnhdr
.s_nlnno
);
3647 * Emit all symbols left in the symbol chain.
3649 for (symbolP
= symbol_rootP
; symbolP
; symbolP
= symbol_next (symbolP
))
3651 /* Used to save the offset of the name. It is used to point
3652 to the string in memory but must be a file offset. */
3653 register char *temp
;
3655 /* We can't fix the lnnoptr field in yank_symbols with the other
3656 adjustments, because we have to wait until we know where they
3658 if (SF_GET_ADJ_LNNOPTR (symbolP
))
3660 SA_GET_SYM_LNNOPTR (symbolP
) +=
3661 segment_info
[S_GET_SEGMENT (symbolP
)].scnhdr
.s_lnnoptr
;
3664 tc_coff_symbol_emit_hook (symbolP
);
3666 temp
= S_GET_NAME (symbolP
);
3667 if (SF_GET_STRING (symbolP
))
3669 S_SET_OFFSET (symbolP
, symbolP
->sy_name_offset
);
3670 S_SET_ZEROES (symbolP
, 0);
3674 memset (symbolP
->sy_symbol
.ost_entry
.n_name
, 0, SYMNMLEN
);
3675 strncpy (symbolP
->sy_symbol
.ost_entry
.n_name
, temp
, SYMNMLEN
);
3677 where
= symbol_to_chars (abfd
, where
, symbolP
);
3678 S_SET_NAME (symbolP
, temp
);
3684 obj_coff_lcomm (ignore
)
3697 name
= input_line_pointer
;
3699 c
= get_symbol_end ();
3700 p
= input_line_pointer
;
3703 if (*input_line_pointer
!= ',')
3705 as_bad ("Expected comma after name");
3706 ignore_rest_of_line ();
3709 if (*input_line_pointer
== '\n')
3711 as_bad ("Missing size expression");
3714 input_line_pointer
++;
3715 if ((temp
= get_absolute_expression ()) < 0)
3717 as_warn ("lcomm length (%d.) <0! Ignored.", temp
);
3718 ignore_rest_of_line ();
3723 symbolP
= symbol_find_or_make(name
);
3725 if (S_GET_SEGMENT(symbolP
) == SEG_UNKNOWN
&&
3726 S_GET_VALUE(symbolP
) == 0)
3731 segT current_seg
= now_seg
; /* save current seg */
3732 subsegT current_subseg
= now_subseg
;
3734 subseg_set (SEG_E2
, 1);
3735 symbolP
->sy_frag
= frag_now
;
3736 p
= frag_var(rs_org
, 1, 1, (relax_substateT
)0, symbolP
,
3739 subseg_set (current_seg
, current_subseg
); /* restore current seg */
3740 S_SET_SEGMENT(symbolP
, SEG_E2
);
3741 S_SET_STORAGE_CLASS(symbolP
, C_STAT
);
3745 as_bad("Symbol %s already defined", name
);
3747 demand_empty_rest_of_line();
3752 fixup_mdeps (frags
, h
, this_segment
)
3757 subseg_change (this_segment
, 0);
3760 switch (frags
->fr_type
)
3766 HANDLE_ALIGN (frags
);
3768 frags
->fr_type
= rs_fill
;
3770 ((frags
->fr_next
->fr_address
- frags
->fr_address
- frags
->fr_fix
)
3773 case rs_machine_dependent
:
3774 md_convert_frag (h
, this_segment
, frags
);
3780 frags
= frags
->fr_next
;
3786 #ifndef TC_FORCE_RELOCATION
3787 #define TC_FORCE_RELOCATION(fix) 0
3791 fixup_segment (segP
, this_segment_type
)
3792 segment_info_type
* segP
;
3793 segT this_segment_type
;
3795 register fixS
* fixP
;
3796 register symbolS
*add_symbolP
;
3797 register symbolS
*sub_symbolP
;
3800 register char *place
;
3801 register long where
;
3802 register char pcrel
;
3803 register fragS
*fragP
;
3804 register segT add_symbol_segment
= absolute_section
;
3806 for (fixP
= segP
->fix_root
; fixP
; fixP
= fixP
->fx_next
)
3808 fragP
= fixP
->fx_frag
;
3810 where
= fixP
->fx_where
;
3811 place
= fragP
->fr_literal
+ where
;
3812 size
= fixP
->fx_size
;
3813 add_symbolP
= fixP
->fx_addsy
;
3814 sub_symbolP
= fixP
->fx_subsy
;
3815 add_number
= fixP
->fx_offset
;
3816 pcrel
= fixP
->fx_pcrel
;
3818 /* We want function-relative stabs to work on systems which
3819 may use a relaxing linker; thus we must handle the sym1-sym2
3820 fixups function-relative stabs generates.
3822 Of course, if you actually enable relaxing in the linker, the
3823 line and block scoping information is going to be incorrect
3824 in some cases. The only way to really fix this is to support
3825 a reloc involving the difference of two symbols. */
3827 && (!sub_symbolP
|| pcrel
))
3831 if (fixP
->fx_tcbit
&& SF_GET_CALLNAME (add_symbolP
))
3833 /* Relocation should be done via the associated 'bal' entry
3836 if (!SF_GET_BALNAME (tc_get_bal_of_call (add_symbolP
)))
3838 as_bad_where (fixP
->fx_file
, fixP
->fx_line
,
3839 "No 'bal' entry point for leafproc %s",
3840 S_GET_NAME (add_symbolP
));
3843 fixP
->fx_addsy
= add_symbolP
= tc_get_bal_of_call (add_symbolP
);
3847 /* Make sure the symbols have been resolved; this may not have
3848 happened if these are expression symbols. */
3849 if (add_symbolP
!= NULL
&& ! add_symbolP
->sy_resolved
)
3850 resolve_symbol_value (add_symbolP
);
3851 if (sub_symbolP
!= NULL
&& ! sub_symbolP
->sy_resolved
)
3852 resolve_symbol_value (sub_symbolP
);
3854 if (add_symbolP
!= NULL
3855 && add_symbolP
->sy_mri_common
)
3857 know (add_symbolP
->sy_value
.X_op
== O_symbol
);
3858 add_number
+= S_GET_VALUE (add_symbolP
);
3859 fixP
->fx_offset
= add_number
;
3860 add_symbolP
= fixP
->fx_addsy
= add_symbolP
->sy_value
.X_add_symbol
;
3865 add_symbol_segment
= S_GET_SEGMENT (add_symbolP
);
3866 } /* if there is an addend */
3870 if (add_symbolP
== NULL
|| add_symbol_segment
== absolute_section
)
3872 if (add_symbolP
!= NULL
)
3874 add_number
+= S_GET_VALUE (add_symbolP
);
3876 fixP
->fx_addsy
= NULL
;
3879 /* It's just -sym. */
3880 if (S_GET_SEGMENT (sub_symbolP
) == absolute_section
)
3882 add_number
-= S_GET_VALUE (sub_symbolP
);
3889 as_bad_where (fixP
->fx_file
, fixP
->fx_line
,
3890 "Negative of non-absolute symbol %s",
3891 S_GET_NAME (sub_symbolP
));
3893 add_number
-= S_GET_VALUE (sub_symbolP
);
3894 } /* not absolute */
3896 /* if sub_symbol is in the same segment that add_symbol
3897 and add_symbol is either in DATA, TEXT, BSS or ABSOLUTE */
3899 else if (S_GET_SEGMENT (sub_symbolP
) == add_symbol_segment
3900 && SEG_NORMAL (add_symbol_segment
))
3902 /* Difference of 2 symbols from same segment. Can't
3903 make difference of 2 undefineds: 'value' means
3904 something different for N_UNDF. */
3906 /* Makes no sense to use the difference of 2 arbitrary symbols
3907 as the target of a call instruction. */
3910 as_bad_where (fixP
->fx_file
, fixP
->fx_line
,
3911 "callj to difference of 2 symbols");
3913 #endif /* TC_I960 */
3914 add_number
+= S_GET_VALUE (add_symbolP
) -
3915 S_GET_VALUE (sub_symbolP
);
3918 if (!TC_FORCE_RELOCATION (fixP
))
3920 fixP
->fx_addsy
= NULL
;
3921 fixP
->fx_subsy
= NULL
;
3923 #ifdef TC_M68K /* is this right? */
3931 /* Different segments in subtraction. */
3932 know (!(S_IS_EXTERNAL (sub_symbolP
) && (S_GET_SEGMENT (sub_symbolP
) == absolute_section
)));
3934 if ((S_GET_SEGMENT (sub_symbolP
) == absolute_section
))
3936 add_number
-= S_GET_VALUE (sub_symbolP
);
3939 else if (S_GET_SEGMENT (sub_symbolP
) == this_segment_type
3940 #if 0 /* Okay for 68k, at least... */
3945 /* Make it pc-relative. */
3946 add_number
+= (md_pcrel_from (fixP
)
3947 - S_GET_VALUE (sub_symbolP
));
3956 as_bad_where (fixP
->fx_file
, fixP
->fx_line
,
3957 "Can't emit reloc {- %s-seg symbol \"%s\"} @ file address %ld.",
3958 segment_name (S_GET_SEGMENT (sub_symbolP
)),
3959 S_GET_NAME (sub_symbolP
),
3960 (long) (fragP
->fr_address
+ where
));
3963 } /* if sub_symbolP */
3967 if (add_symbol_segment
== this_segment_type
&& pcrel
)
3970 * This fixup was made when the symbol's segment was
3971 * SEG_UNKNOWN, but it is now in the local segment.
3972 * So we know how to do the address without relocation.
3975 /* reloc_callj() may replace a 'call' with a 'calls' or a 'bal',
3976 * in which cases it modifies *fixP as appropriate. In the case
3977 * of a 'calls', no further work is required, and *fixP has been
3978 * set up to make the rest of the code below a no-op.
3981 #endif /* TC_I960 */
3983 add_number
+= S_GET_VALUE (add_symbolP
);
3984 add_number
-= md_pcrel_from (fixP
);
3985 #if defined (TC_I386) || defined (TE_LYNX)
3986 /* On the 386 we must adjust by the segment vaddr as
3987 well. Ian Taylor. */
3988 add_number
-= segP
->scnhdr
.s_vaddr
;
3990 pcrel
= 0; /* Lie. Don't want further pcrel processing. */
3991 if (!TC_FORCE_RELOCATION (fixP
))
3993 fixP
->fx_addsy
= NULL
;
3999 switch (add_symbol_segment
)
4001 case absolute_section
:
4003 reloc_callj (fixP
); /* See comment about reloc_callj() above*/
4004 #endif /* TC_I960 */
4005 add_number
+= S_GET_VALUE (add_symbolP
);
4008 if (!TC_FORCE_RELOCATION (fixP
))
4010 fixP
->fx_addsy
= NULL
;
4017 #if defined(TC_A29K) || (defined(TE_PE) && defined(TC_I386)) || defined(TC_M88K)
4018 /* This really should be handled in the linker, but
4019 backward compatibility forbids. */
4020 add_number
+= S_GET_VALUE (add_symbolP
);
4022 add_number
+= S_GET_VALUE (add_symbolP
) +
4023 segment_info
[S_GET_SEGMENT (add_symbolP
)].scnhdr
.s_paddr
;
4029 if ((int) fixP
->fx_bit_fixP
== 13)
4031 /* This is a COBR instruction. They have only a
4032 * 13-bit displacement and are only to be used
4033 * for local branches: flag as error, don't generate
4036 as_bad_where (fixP
->fx_file
, fixP
->fx_line
,
4037 "can't use COBR format with external label");
4038 fixP
->fx_addsy
= NULL
;
4042 #endif /* TC_I960 */
4043 #if (defined (TC_I386) || defined (TE_LYNX) || defined (TE_AUX)) && !defined(TE_PE)
4044 /* 386 COFF uses a peculiar format in which the
4045 value of a common symbol is stored in the .text
4046 segment (I've checked this on SVR3.2 and SCO
4047 3.2.2) Ian Taylor <ian@cygnus.com>. */
4048 if (S_IS_COMMON (add_symbolP
))
4049 add_number
+= S_GET_VALUE (add_symbolP
);
4054 } /* switch on symbol seg */
4055 } /* if not in local seg */
4056 } /* if there was a + symbol */
4060 #if !defined(TC_M88K) && !(defined(TE_PE) && defined(TC_I386)) && !defined(TC_A29K)
4061 /* This adjustment is not correct on the m88k, for which the
4062 linker does all the computation. */
4063 add_number
-= md_pcrel_from (fixP
);
4065 if (add_symbolP
== 0)
4067 fixP
->fx_addsy
= &abs_symbol
;
4068 } /* if there's an add_symbol */
4069 #if defined (TC_I386) || defined (TE_LYNX) || defined (TC_I960) || defined (TC_M68K)
4070 /* On the 386 we must adjust by the segment vaddr as well.
4073 I changed the i960 to work this way as well. This is
4074 compatible with the current GNU linker behaviour. I do
4075 not know what other i960 COFF assemblers do. This is not
4076 a common case: normally, only assembler code will contain
4077 a PC relative reloc, and only branches which do not
4078 originate in the .text section will have a non-zero
4081 I changed the m68k to work this way as well. This will
4082 break existing PC relative relocs from sections which do
4083 not start at address 0, but it will make ld -r work.
4084 Ian Taylor, 4 Oct 96. */
4086 add_number
-= segP
->scnhdr
.s_vaddr
;
4090 if (!fixP
->fx_bit_fixP
&& ! fixP
->fx_no_overflow
)
4093 /* The m88k uses the offset field of the reloc to get around
4096 && ((add_number
& ~0xFF)
4097 || (fixP
->fx_signed
&& (add_number
& 0x80)))
4098 && ((add_number
& ~0xFF) != (-1 & ~0xFF)
4099 || (fixP
->fx_signed
&& (add_number
& 0x80) == 0)))
4101 && ((add_number
& ~0xFFFF)
4102 || (fixP
->fx_signed
&& (add_number
& 0x8000)))
4103 && ((add_number
& ~0xFFFF) != (-1 & ~0xFFFF)
4104 || (fixP
->fx_signed
&& (add_number
& 0x8000) == 0))))
4106 as_bad_where (fixP
->fx_file
, fixP
->fx_line
,
4107 "Value of %ld too large for field of %d bytes at 0x%lx",
4108 (long) add_number
, size
,
4109 (unsigned long) (fragP
->fr_address
+ where
));
4112 #ifdef WARN_SIGNED_OVERFLOW_WORD
4113 /* Warn if a .word value is too large when treated as a
4114 signed number. We already know it is not too negative.
4115 This is to catch over-large switches generated by gcc on
4117 if (!flag_signed_overflow_ok
4119 && add_number
> 0x7fff)
4120 as_bad_where (fixP
->fx_file
, fixP
->fx_line
,
4121 "Signed .word overflow; switch may be too large; %ld at 0x%lx",
4123 (unsigned long) (fragP
->fr_address
+ where
));
4125 } /* not a bit fix */
4126 /* Once this fix has been applied, we don't have to output
4127 anything nothing more need be done. */
4128 #ifdef MD_APPLY_FIX3
4129 md_apply_fix3 (fixP
, &add_number
, this_segment_type
);
4131 md_apply_fix (fixP
, add_number
);
4133 } /* For each fixS in this segment. */
4134 } /* fixup_segment() */
4138 /* The first entry in a .stab section is special. */
4141 obj_coff_init_stab_section (seg
)
4147 unsigned int stroff
;
4149 /* Make space for this first symbol. */
4153 as_where (&file
, (unsigned int *) NULL
);
4154 stabstr_name
= (char *) alloca (strlen (segment_info
[seg
].name
) + 4);
4155 strcpy (stabstr_name
, segment_info
[seg
].name
);
4156 strcat (stabstr_name
, "str");
4157 stroff
= get_stab_string_offset (file
, stabstr_name
);
4159 md_number_to_chars (p
, stroff
, 4);
4162 /* Fill in the counts in the first entry in a .stab section. */
4165 adjust_stab_section(abfd
, seg
)
4169 segT stabstrseg
= SEG_UNKNOWN
;
4170 const char *secname
, *name2
;
4173 int i
, strsz
= 0, nsyms
;
4174 fragS
*frag
= segment_info
[seg
].frchainP
->frch_root
;
4176 /* Look for the associated string table section. */
4178 secname
= segment_info
[seg
].name
;
4179 name
= (char *) alloca (strlen (secname
) + 4);
4180 strcpy (name
, secname
);
4181 strcat (name
, "str");
4183 for (i
= SEG_E0
; i
< SEG_UNKNOWN
; i
++)
4185 name2
= segment_info
[i
].name
;
4186 if (name2
!= NULL
&& strncmp(name2
, name
, 8) == 0)
4193 /* If we found the section, get its size. */
4194 if (stabstrseg
!= SEG_UNKNOWN
)
4195 strsz
= size_section (abfd
, stabstrseg
);
4197 nsyms
= size_section (abfd
, seg
) / 12 - 1;
4199 /* Look for the first frag of sufficient size for the initial stab
4200 symbol, and collect a pointer to it. */
4201 while (frag
&& frag
->fr_fix
< 12)
4202 frag
= frag
->fr_next
;
4204 p
= frag
->fr_literal
;
4207 /* Write in the number of stab symbols and the size of the string
4209 bfd_h_put_16 (abfd
, (bfd_vma
) nsyms
, (bfd_byte
*) p
+ 6);
4210 bfd_h_put_32 (abfd
, (bfd_vma
) strsz
, (bfd_byte
*) p
+ 8);
4213 #endif /* not BFD_ASSEMBLER */
4215 const pseudo_typeS obj_pseudo_table
[] =
4217 {"def", obj_coff_def
, 0},
4218 {"dim", obj_coff_dim
, 0},
4219 {"endef", obj_coff_endef
, 0},
4220 {"line", obj_coff_line
, 0},
4221 {"ln", obj_coff_ln
, 0},
4222 {"appline", obj_coff_ln
, 1},
4223 {"scl", obj_coff_scl
, 0},
4224 {"size", obj_coff_size
, 0},
4225 {"tag", obj_coff_tag
, 0},
4226 {"type", obj_coff_type
, 0},
4227 {"val", obj_coff_val
, 0},
4228 {"section", obj_coff_section
, 0},
4229 {"sect", obj_coff_section
, 0},
4230 /* FIXME: We ignore the MRI short attribute. */
4231 {"section.s", obj_coff_section
, 0},
4232 {"sect.s", obj_coff_section
, 0},
4233 #ifndef BFD_ASSEMBLER
4234 {"use", obj_coff_section
, 0},
4235 {"text", obj_coff_text
, 0},
4236 {"data", obj_coff_data
, 0},
4237 {"bss", obj_coff_bss
, 0},
4238 {"lcomm", obj_coff_lcomm
, 0},
4239 {"ident", obj_coff_ident
, 0},
4241 {"optim", s_ignore
, 0}, /* For sun386i cc (?) */
4242 {"ident", s_ignore
, 0}, /* we don't yet handle this. */
4244 {"ABORT", s_abort
, 0},
4246 /* The m88k uses sdef instead of def. */
4247 {"sdef", obj_coff_def
, 0},
4249 {NULL
} /* end sentinel */
4250 }; /* obj_pseudo_table */