1 /* ELF object file format
2 Copyright (C) 1992, 1993 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2,
9 or (at your option) any later version.
11 GAS is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
14 the GNU General Public License for more details.
16 You should have received a copy of the GNU General Public
17 License along with GAS; see the file COPYING. If not, write
18 to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
22 #include "aout/stab_gnu.h"
25 static int obj_elf_write_symbol_p
PARAMS ((symbolS
*sym
));
27 static void obj_elf_stab
PARAMS ((int what
));
28 static void obj_elf_xstab
PARAMS ((int what
));
29 static void obj_elf_line
PARAMS ((int));
30 void obj_elf_desc
PARAMS ((int));
31 void obj_elf_version
PARAMS ((int));
32 static void obj_elf_size
PARAMS ((int));
33 static void obj_elf_type
PARAMS ((int));
34 static void obj_elf_ident
PARAMS ((int));
35 static void obj_elf_weak
PARAMS ((int));
36 static void obj_elf_local
PARAMS ((int));
37 static void obj_elf_common
PARAMS ((int));
39 const pseudo_typeS obj_pseudo_table
[] =
41 {"comm", obj_elf_common
, 0},
42 {"ident", obj_elf_ident
, 0},
43 {"local", obj_elf_local
, 0},
44 {"previous", obj_elf_previous
, 0},
45 {"section", obj_elf_section
, 0},
46 {"size", obj_elf_size
, 0},
47 {"type", obj_elf_type
, 0},
48 {"version", obj_elf_version
, 0},
49 {"weak", obj_elf_weak
, 0},
51 /* These are used for stabs-in-elf configurations. */
52 {"desc", obj_elf_desc
, 0},
53 {"line", obj_elf_line
, 0},
54 {"stabd", obj_elf_stab
, 'd'},
55 {"stabn", obj_elf_stab
, 'n'},
56 {"stabs", obj_elf_stab
, 's'},
57 /* This is used on Solaris 2.x on SPARC, but not supported yet. */
58 {"xstabs", obj_elf_xstab
, 's'},
60 /* These are used for dwarf. */
65 {NULL
} /* end sentinel */
69 #include "aout/aout64.h"
77 sym
= symbol_new (s
, absolute_section
, (valueT
) 0, (struct frag
*) 0);
78 sym
->sy_frag
= &zero_address_frag
;
79 sym
->bsym
->flags
|= BSF_FILE
;
81 if (symbol_rootP
!= sym
)
83 symbol_remove (sym
, &symbol_rootP
, &symbol_lastP
);
84 symbol_insert (sym
, symbol_rootP
, &symbol_rootP
, &symbol_lastP
);
86 verify_symbol_chain (symbol_rootP
, symbol_lastP
);
92 obj_elf_common (ignore
)
101 name
= input_line_pointer
;
102 c
= get_symbol_end ();
103 /* just after name is now '\0' */
104 p
= input_line_pointer
;
107 if (*input_line_pointer
!= ',')
109 as_bad ("Expected comma after symbol-name");
110 ignore_rest_of_line ();
113 input_line_pointer
++; /* skip ',' */
114 if ((temp
= get_absolute_expression ()) < 0)
116 as_bad (".COMMon length (%d.) <0! Ignored.", temp
);
117 ignore_rest_of_line ();
122 symbolP
= symbol_find_or_make (name
);
124 if (S_IS_DEFINED (symbolP
))
126 as_bad ("Ignoring attempt to re-define symbol");
127 ignore_rest_of_line ();
130 if (S_GET_VALUE (symbolP
) != 0)
132 if (S_GET_VALUE (symbolP
) != size
)
134 as_warn ("Length of .comm \"%s\" is already %ld. Not changed to %d.",
135 S_GET_NAME (symbolP
), (long) S_GET_VALUE (symbolP
), size
);
138 know (symbolP
->sy_frag
== &zero_address_frag
);
139 if (*input_line_pointer
!= ',')
141 as_bad ("Expected comma after common length");
142 ignore_rest_of_line ();
145 input_line_pointer
++;
147 if (*input_line_pointer
!= '"')
149 temp
= get_absolute_expression ();
153 as_warn ("Common alignment negative; 0 assumed");
164 old_subsec
= now_subseg
;
166 record_alignment (bss_section
, align
);
167 subseg_set (bss_section
, 0);
169 frag_align (align
, 0);
170 if (S_GET_SEGMENT (symbolP
) == bss_section
)
171 symbolP
->sy_frag
->fr_symbol
= 0;
172 symbolP
->sy_frag
= frag_now
;
173 pfrag
= frag_var (rs_org
, 1, 1, (relax_substateT
) 0, symbolP
, size
,
176 S_SET_SEGMENT (symbolP
, bss_section
);
177 S_CLEAR_EXTERNAL (symbolP
);
178 subseg_set (old_sec
, old_subsec
);
183 S_SET_VALUE (symbolP
, (valueT
) size
);
184 S_SET_EXTERNAL (symbolP
);
185 /* should be common, but this is how gas does it for now */
186 S_SET_SEGMENT (symbolP
, &bfd_und_section
);
191 input_line_pointer
++;
192 /* @@ Some use the dot, some don't. Can we get some consistency?? */
193 if (*input_line_pointer
== '.')
194 input_line_pointer
++;
195 /* @@ Some say data, some say bss. */
196 if (strncmp (input_line_pointer
, "bss\"", 4)
197 && strncmp (input_line_pointer
, "data\"", 5))
199 while (*--input_line_pointer
!= '"')
201 input_line_pointer
--;
202 goto bad_common_segment
;
204 while (*input_line_pointer
++ != '"')
206 goto allocate_common
;
208 demand_empty_rest_of_line ();
213 p
= input_line_pointer
;
214 while (*p
&& *p
!= '\n')
218 as_bad ("bad .common segment %s", input_line_pointer
+ 1);
220 input_line_pointer
= p
;
221 ignore_rest_of_line ();
227 obj_elf_local (ignore
)
236 name
= input_line_pointer
;
237 c
= get_symbol_end ();
238 symbolP
= symbol_find_or_make (name
);
239 *input_line_pointer
= c
;
241 S_CLEAR_EXTERNAL (symbolP
);
245 input_line_pointer
++;
247 if (*input_line_pointer
== '\n')
252 demand_empty_rest_of_line ();
256 obj_elf_weak (ignore
)
265 name
= input_line_pointer
;
266 c
= get_symbol_end ();
267 symbolP
= symbol_find_or_make (name
);
268 *input_line_pointer
= c
;
270 S_SET_WEAK (symbolP
);
274 input_line_pointer
++;
276 if (*input_line_pointer
== '\n')
281 demand_empty_rest_of_line ();
284 static segT previous_section
;
285 static int previous_subsection
;
288 obj_elf_section (xxx
)
294 /* Initialize this with inclusive-or of all flags that can be cleared
295 by attributes, but not set by them. Also include flags that won't
296 get set properly in the assembler, but which the user/compiler
297 shouldn't be expected to set. */
298 flagword flags
= SEC_READONLY
| SEC_ALLOC
| SEC_RELOC
;
299 /* Initialize this with the default flags to be used if none are
301 flagword default_flags
= 0;
304 /* Get name of section. */
305 if (*input_line_pointer
== '"')
306 string
= demand_copy_C_string (&xxx
);
309 char *p
= input_line_pointer
;
311 while (0 == strchr ("\n\t,; ", *p
))
315 string
= xmalloc ((unsigned long) (p
- input_line_pointer
+ 1));
316 strcpy (string
, input_line_pointer
);
318 input_line_pointer
= p
;
320 if (!strcmp (string
, ".rodata"))
321 default_flags
= SEC_ALLOC
| SEC_READONLY
| SEC_RELOC
| SEC_LOAD
;
322 else if (!strcmp (string
, ".init")
323 || !strcmp (string
, ".fini"))
324 default_flags
= SEC_ALLOC
| SEC_READONLY
| SEC_RELOC
| SEC_CODE
| SEC_LOAD
;
327 if (*input_line_pointer
!= ',')
328 flags
= default_flags
;
329 while (*input_line_pointer
== ',')
336 input_line_pointer
++;
338 /* Under i386-svr4, gcc emits a string here. I don't know what this
339 string is supposed to signify or how to handle it. Ignore it for
340 now, unless it becomes a problem. */
341 if (*input_line_pointer
== '"')
343 demand_copy_C_string (&xxx
);
348 if (*input_line_pointer
!= '#' && *input_line_pointer
!= '@')
350 as_bad ("unrecognized syntax in .section command");
351 ignore_rest_of_line ();
354 input_line_pointer
++;
356 #define CHECK(X,BIT,NEG) \
357 if (!strncmp(X,input_line_pointer,len = sizeof(X) - 1)) { \
358 bit = BIT; inv = NEG; goto match; }
360 CHECK ("write", SEC_READONLY
, 1);
361 CHECK ("alloc", SEC_ALLOC
, 0);
362 CHECK ("execinstr", SEC_CODE
, 1);
363 CHECK ("progbits", SEC_LOAD
, 1);
366 p
= input_line_pointer
;
367 while (!is_end_of_line
[(unsigned char) *p
] && *p
!= 0 && *p
!= ',')
371 as_bad ("unrecognized section attribute `%s' ignored",
381 input_line_pointer
+= len
;
383 demand_empty_rest_of_line ();
385 /* If the C string wasn't valid, `string' could be null. */
389 sec
= bfd_get_section_by_name (stdoutput
, string
);
392 sec
= subseg_new (string
, 0);
393 bfd_set_section_flags (stdoutput
, sec
, flags
);
394 sec
->output_section
= sec
;
396 previous_section
= now_seg
;
397 previous_subsection
= now_subseg
;
402 obj_elf_previous (ignore
)
405 if (previous_section
== 0)
407 as_bad (".previous without corresponding .section; ignored");
410 subseg_set (previous_section
, previous_subsection
);
411 previous_section
= 0;
415 obj_elf_write_symbol_p (sym
)
418 /* If this is a local symbol, are there any relocations for which
421 /* To find this out, we examine all relocations in all bfd sections
422 that have relocations. If there is one that references this
423 symbol, we need to keep this symbol. In this case, we return a
424 true status. In all other cases, we return a false status. */
426 if (S_IS_LOCAL (sym
))
428 asymbol
*bsym
= sym
->bsym
;
429 bfd
*abfd
= bsym
->the_bfd
;
432 for (bsec
= abfd
->sections
; bsec
; bsec
= bsec
->next
)
434 struct reloc_cache_entry
**rlocs
= bsec
->orelocation
;
435 int rcnt
= bsec
->reloc_count
;
441 for (i
= 0; i
< rcnt
; i
++)
442 if (rlocs
[i
]->sym_ptr_ptr
443 && rlocs
[i
]->sym_ptr_ptr
[0] == bsym
)
448 /* No relocations for this section. Check the seg_info
449 structure to see if there are any fixups for this
451 segment_info_type
*seginfo
= seg_info (bsec
);
454 for (fixp
= seginfo
->fix_root
; fixp
; fixp
= fixp
->fx_next
)
455 if ((fixp
->fx_addsy
&& fixp
->fx_addsy
->bsym
== bsym
)
456 || (fixp
->fx_subsy
&& fixp
->fx_subsy
->bsym
== bsym
))
465 obj_elf_write_symbol (sym
)
468 return /* obj_elf_write_symbol_p (sym) || */ !S_IS_LOCAL (sym
);
472 obj_elf_frob_symbol (sym
, punt
)
476 #if 0 /* ?? The return value is ignored. Only the value of *punt is
478 return obj_elf_write_symbol_p (sym
);
480 /* FIXME: Just return 0 until is fixed. */
485 obj_elf_line (ignore
)
488 /* Assume delimiter is part of expression. BSD4.2 as fails with
489 delightful bug, so we are not being incompatible here. */
490 new_logical_line ((char *) NULL
, (int) (get_absolute_expression ()));
491 demand_empty_rest_of_line ();
497 * Handle .stabX directives, which used to be open-coded.
498 * So much creeping featurism overloaded the semantics that we decided
499 * to put all .stabX thinking in one place. Here.
501 * We try to make any .stabX directive legal. Other people's AS will often
502 * do assembly-time consistency checks: eg assigning meaning to n_type bits
503 * and "protecting" you from setting them to certain values. (They also zero
504 * certain bits before emitting symbols. Tut tut.)
506 * If an expression is not absolute we either gripe or use the relocation
507 * information. Other people's assemblers silently forget information they
508 * don't need and invent information they need that you didn't supply.
510 * .stabX directives always make a symbol table entry. It may be junk if
511 * the rest of your .stabX directive is malformed.
515 * elf_stab_symbol_string()
517 * Build a string dictionary entry for a .stabX symbol.
518 * The symbol is added to the .stabstr section.
523 elf_stab_symbol_string (string
, secname
)
524 char *string
, *secname
;
530 unsigned int old_gdb_string_index
;
534 /* @@FIXME -- there should be no static data here!
535 This also has the effect of making all stab string tables large enough
536 to contain all the contents written to any of them. This only matters
537 with the Solaris native compiler for the moment, but it should be fixed
539 static unsigned int gdb_string_index
= 0;
541 old_gdb_string_index
= 0;
542 length
= strlen (string
);
543 clengthP
= (char *) &length
;
545 { /* Ordinary case. */
547 save_subseg
= now_subseg
;
549 /* Create the stab sections, if they are not already created. */
551 char *newsecname
= xmalloc ((unsigned long) (strlen (secname
) + 4));
552 strcpy (newsecname
, secname
);
553 strcat (newsecname
, "str");
554 seg
= bfd_get_section_by_name (stdoutput
, newsecname
);
557 seg
= bfd_make_section_old_way (stdoutput
, newsecname
);
558 bfd_set_section_flags (stdoutput
, seg
,
559 SEC_LOAD
| SEC_READONLY
| SEC_ALLOC
);
561 /* free (newsecname);*/
563 subseg_new ((char *) seg
->name
, save_subseg
);
564 old_gdb_string_index
= gdb_string_index
;
566 while ((c
= *string
++))
570 FRAG_APPEND_1_CHAR (c
);
573 FRAG_APPEND_1_CHAR ((char) 0);
579 FRAG_APPEND_1_CHAR ((char) 0);
583 subseg_new ((char *) save_seg
->name
, save_subseg
);
586 return old_gdb_string_index
;
590 DEFUN (elf_stab_symbol
, (symbolP
, stab_type
),
597 /* the string index portion of the stab */
598 md_number_to_chars (toP
, (valueT
) symbolP
->sy_name_offset
, 4);
599 md_number_to_chars (toP
+ 4, (valueT
) S_GET_TYPE (symbolP
), 1);
600 md_number_to_chars (toP
+ 5, (valueT
) S_GET_OTHER (symbolP
), 1);
601 md_number_to_chars (toP
+ 6, (valueT
) S_GET_DESC (symbolP
), 2);
602 /* The n_value field doesn't get written here, it gets done below. It
603 may be an expression needing relocating. */
607 obj_elf_stab_generic (what
, secname
)
613 symbolS
*symbolP
= 0;
620 asection
*saved_seg
= now_seg
;
622 subsegT subseg
= now_subseg
;
625 /* This function doesn't work yet.
627 Actually, this function is okay, but some finalizations are
628 needed before writing the object file; that's not done yet, and
629 the Solaris linker chokes without it.
631 In any case, this should effectively disable it for now. */
633 demand_copy_C_string (&length
);
638 seg
= bfd_get_section_by_name (stdoutput
, secname
);
641 seg
= subseg_new (secname
, 0);
642 bfd_set_section_flags (stdoutput
, seg
,
643 SEC_LOAD
| SEC_READONLY
| SEC_ALLOC
| SEC_RELOC
);
644 subseg_set (saved_seg
, subseg
);
649 * Enter with input_line_pointer pointing past .stabX and any following
654 string
= demand_copy_C_string (&length
);
656 if (*input_line_pointer
== ',')
657 input_line_pointer
++;
660 as_bad ("I need a comma after symbol's name");
668 * Input_line_pointer->after ','. String->symbol name.
672 symbolP
= symbol_new (string
, &bfd_und_section
, (valueT
) 0, (struct frag
*) 0);
674 /* enter the string in the .stab string table (section .stabstr) */
675 symbolP
->sy_name_offset
= elf_stab_symbol_string (string
, secname
);
680 S_SET_NAME (symbolP
, NULL
); /* .stabd feature. */
681 S_SET_VALUE (symbolP
,
682 (valueT
) ((char*) obstack_next_free (&frags
) - frag_now
->fr_literal
));
683 S_SET_SEGMENT (symbolP
, now_seg
);
684 symbolP
->sy_frag
= frag_now
;
688 symbolP
->sy_frag
= &zero_address_frag
;
692 symbolP
->sy_frag
= &zero_address_frag
;
700 if (get_absolute_expression_and_terminator (&longint
) == ',')
702 saved_type
= longint
;
703 S_SET_TYPE (symbolP
, saved_type
);
707 as_bad ("I want a comma after the n_type expression");
709 input_line_pointer
--; /* Backup over a non-',' char. */
715 if (get_absolute_expression_and_terminator (&longint
) == ',')
716 S_SET_OTHER (symbolP
, longint
);
719 as_bad ("I want a comma after the n_other expression");
721 input_line_pointer
--; /* Backup over a non-',' char. */
727 S_SET_DESC (symbolP
, get_absolute_expression ());
728 if (what
== 's' || what
== 'n')
730 if (*input_line_pointer
!= ',')
732 as_bad ("I want a comma after the n_desc expression");
737 input_line_pointer
++;
744 ignore_rest_of_line ();
748 subseg_set (seg
, subseg
);
751 /* allocate and discard -- filled in later */
752 (void) frag_more (12);
754 /* Emit the stab symbol. */
755 elf_stab_symbol (symbolP
, what
);
757 if (what
== 's' || what
== 'n')
760 input_line_pointer
--;
764 char *p
= frag_more (4);
765 md_number_to_chars (p
, 0, 4);
768 subseg_set (saved_seg
, subseg
);
770 if ((what
== 's' || what
== 'n')
771 && symbolP
->sy_value
.X_op
== O_constant
)
773 /* symbol is not needed in the regular symbol table */
774 symbol_remove (symbolP
, &symbol_rootP
, &symbol_lastP
);
777 if (what
== 's' && S_GET_TYPE (symbolP
) == N_SO
)
779 fragS
*fragp
= seg_info (seg
)->frchainP
->frch_root
;
781 && fragp
->fr_address
+ fragp
->fr_fix
< 12)
782 fragp
= fragp
->fr_next
;
784 assert (fragp
->fr_type
== rs_fill
);
785 assert (fragp
->fr_address
== 0 && fragp
->fr_fix
>= 12);
786 md_number_to_chars (fragp
->fr_literal
, (valueT
) symbolP
->sy_name_offset
,
791 switch (S_GET_TYPE (symbolP
))
794 listing_source_line ((unsigned int) S_GET_DESC (symbolP
));
798 listing_source_file (string
);
802 demand_empty_rest_of_line ();
809 obj_elf_stab_generic (what
, ".stab");
819 secname
= demand_copy_C_string (&length
);
821 if (*input_line_pointer
== ',')
822 input_line_pointer
++;
825 as_bad ("comma missing in .xstabs");
826 ignore_rest_of_line ();
829 obj_elf_stab_generic (what
, secname
);
833 obj_elf_desc (ignore
)
842 /* Frob invented at RMS' request. Set the n_desc of a symbol. */
843 name
= input_line_pointer
;
844 c
= get_symbol_end ();
845 p
= input_line_pointer
;
848 if (*input_line_pointer
!= ',')
851 as_bad ("Expected comma after name \"%s\"", name
);
853 ignore_rest_of_line ();
857 input_line_pointer
++;
858 temp
= get_absolute_expression ();
860 symbolP
= symbol_find_or_make (name
);
862 S_SET_DESC (symbolP
, temp
);
864 demand_empty_rest_of_line ();
865 } /* obj_elf_desc() */
868 obj_read_begin_hook ()
873 obj_symbol_new_hook (symbolP
)
876 #if 0 /* BFD already takes care of this */
877 elf32_symbol_type
*esym
= (elf32_symbol_type
*) symbolP
;
879 /* There is an Elf_Internal_Sym and an Elf_External_Sym. For now,
880 just zero them out. */
882 bzero ((char *) &esym
->internal_elf_sym
, sizeof (esym
->internal_elf_sym
));
883 bzero ((char *) &esym
->native_elf_sym
, sizeof (esym
->native_elf_sym
));
884 bzero ((char *) &esym
->tc_data
, sizeof (esym
->tc_data
));
889 obj_elf_version (ignore
)
896 asection
*seg
= now_seg
;
897 subsegT subseg
= now_subseg
;
898 Elf_Internal_Note i_note
;
899 Elf_External_Note e_note
;
900 asection
*note_secp
= (asection
*) NULL
;
904 if (*input_line_pointer
== '\"')
906 ++input_line_pointer
; /* -> 1st char of string. */
907 name
= input_line_pointer
;
909 while (is_a_char (c
= next_char_of_string ()))
911 c
= *input_line_pointer
;
912 *input_line_pointer
= '\0';
913 *(input_line_pointer
- 1) = '\0';
914 *input_line_pointer
= c
;
916 /* create the .note section if this is the first version string */
918 note_secp
= bfd_get_section_by_name (stdoutput
, ".note");
919 if (note_secp
== (asection
*) NULL
)
921 note_secp
= bfd_make_section_old_way (stdoutput
, ".note");
922 bfd_set_section_flags (stdoutput
,
924 SEC_LOAD
| SEC_HAS_CONTENTS
| SEC_READONLY
);
927 /* process the version string */
929 subseg_set (note_secp
, 0);
932 i_note
.namesz
= ((len
+ 1) + 3) & ~3; /* round this to word boundary */
933 i_note
.descsz
= 0; /* no description */
934 i_note
.type
= NT_VERSION
;
935 p
= frag_more (sizeof (e_note
.namesz
));
936 md_number_to_chars (p
, (valueT
) i_note
.namesz
, 4);
937 p
= frag_more (sizeof (e_note
.descsz
));
938 md_number_to_chars (p
, (valueT
) i_note
.descsz
, 4);
939 p
= frag_more (sizeof (e_note
.type
));
940 md_number_to_chars (p
, (valueT
) i_note
.type
, 4);
942 for (i
= 0; i
< len
; i
++)
946 FRAG_APPEND_1_CHAR (ch
);
951 subseg_set (seg
, subseg
);
955 as_bad ("Expected quoted string");
957 demand_empty_rest_of_line ();
961 obj_elf_size (ignore
)
964 char *name
= input_line_pointer
;
965 char c
= get_symbol_end ();
970 p
= input_line_pointer
;
973 if (*input_line_pointer
!= ',')
976 as_bad ("expected comma after name `%s' in .size directive", name
);
978 ignore_rest_of_line ();
981 input_line_pointer
++;
983 if (exp
.X_op
== O_absent
)
985 as_bad ("missing expression in .size directive");
986 exp
.X_op
= O_constant
;
987 exp
.X_add_number
= 0;
990 sym
= symbol_find_or_make (name
);
992 if (exp
.X_op
== O_constant
)
993 S_SET_SIZE (sym
, exp
.X_add_number
);
1000 as_tsktsk (".size expressions not yet supported, ignored");
1005 demand_empty_rest_of_line ();
1009 obj_elf_type (ignore
)
1012 char *name
= input_line_pointer
;
1013 char c
= get_symbol_end ();
1018 p
= input_line_pointer
;
1021 if (*input_line_pointer
!= ',')
1023 as_bad ("expected comma after name in .type directive");
1025 ignore_rest_of_line ();
1028 input_line_pointer
++;
1030 if (*input_line_pointer
!= '#' && *input_line_pointer
!= '@')
1032 as_bad ("expected `#' or `@' after comma in .type directive");
1035 input_line_pointer
++;
1036 if (!strncmp ("function", input_line_pointer
, sizeof ("function") - 1))
1038 type
= BSF_FUNCTION
;
1039 input_line_pointer
+= sizeof ("function") - 1;
1041 else if (!strncmp ("object", input_line_pointer
, sizeof ("object") - 1))
1043 input_line_pointer
+= sizeof ("object") - 1;
1047 as_bad ("unrecognized symbol type, ignored");
1050 demand_empty_rest_of_line ();
1052 sym
= symbol_find_or_make (name
);
1053 sym
->bsym
->flags
|= type
;
1057 obj_elf_ident (ignore
)
1060 static segT comment_section
;
1061 segT old_section
= now_seg
;
1062 int old_subsection
= now_subseg
;
1064 if (!comment_section
)
1067 comment_section
= subseg_new (".comment", 0);
1068 bfd_set_section_flags (stdoutput
, comment_section
, SEC_HAS_CONTENTS
);
1073 subseg_set (comment_section
, 0);
1075 subseg_set (old_section
, old_subsection
);
1079 adjust_stab_sections (abfd
, sec
, xxx
)
1089 if (strncmp (".stab", sec
->name
, 5))
1091 if (!strcmp ("str", sec
->name
+ strlen (sec
->name
) - 3))
1094 name
= (char *) alloca (strlen (sec
->name
) + 4);
1095 strcpy (name
, sec
->name
);
1096 strcat (name
, "str");
1097 strsec
= bfd_get_section_by_name (abfd
, name
);
1099 strsz
= bfd_section_size (abfd
, strsec
);
1102 nsyms
= bfd_section_size (abfd
, sec
) / 12 - 1;
1104 fragp
= seg_info (sec
)->frchainP
->frch_root
;
1106 && fragp
->fr_address
+ fragp
->fr_fix
< 12)
1107 fragp
= fragp
->fr_next
;
1108 assert (fragp
!= 0);
1109 assert (fragp
->fr_type
== rs_fill
);
1110 assert (fragp
->fr_address
== 0 && fragp
->fr_fix
>= 12);
1112 bfd_h_put_16 (abfd
, (bfd_vma
) nsyms
, fragp
->fr_literal
+ 6);
1113 bfd_h_put_32 (abfd
, (bfd_vma
) strsz
, fragp
->fr_literal
+ 8);
1119 bfd_map_over_sections (stdoutput
, adjust_stab_sections
, (PTR
) 0);
1121 #ifdef elf_tc_symbol
1125 for (i
= 0; i
< stdoutput
->symcount
; i
++)
1126 elf_tc_symbol (stdoutput
, (PTR
) (stdoutput
->outsymbols
[i
]),
1131 #ifdef elf_tc_final_processing
1132 elf_tc_final_processing ();
1135 /* Finally, we must make any target-specific sections. */
1137 #ifdef elf_tc_make_sections
1138 elf_tc_make_sections (stdoutput
);