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 void obj_elf_stab
PARAMS ((int what
));
26 static void obj_elf_xstab
PARAMS ((int what
));
27 static void obj_elf_line
PARAMS ((void));
28 void obj_elf_desc
PARAMS ((void));
29 void obj_elf_version
PARAMS ((void));
30 static void obj_elf_size
PARAMS ((void));
31 static void obj_elf_type
PARAMS ((void));
32 static void obj_elf_ident
PARAMS ((void));
33 static void obj_elf_weak
PARAMS ((void));
34 static void obj_elf_local
PARAMS ((void));
35 static void obj_elf_common
PARAMS ((void));
37 const pseudo_typeS obj_pseudo_table
[] =
39 {"comm", obj_elf_common
, 0},
40 {"ident", obj_elf_ident
, 0},
41 {"local", obj_elf_local
, 0},
42 {"previous", obj_elf_previous
, 0},
43 {"section", obj_elf_section
, 0},
44 {"size", obj_elf_size
, 0},
45 {"type", obj_elf_type
, 0},
46 {"version", obj_elf_version
, 0},
47 {"weak", obj_elf_weak
, 0},
49 /* These are used for stabs-in-elf configurations. */
50 {"desc", obj_elf_desc
, 0},
51 {"line", obj_elf_line
, 0},
52 {"stabd", obj_elf_stab
, 'd'},
53 {"stabn", obj_elf_stab
, 'n'},
54 {"stabs", obj_elf_stab
, 's'},
55 /* This is used on Solaris 2.x on SPARC, but not supported yet. */
56 {"xstabs", obj_elf_xstab
, 's'},
58 /* These are used for dwarf. */
63 {NULL
} /* end sentinel */
67 #include "aout/aout64.h"
75 sym
= symbol_new (s
, absolute_section
, (valueT
) 0, (struct frag
*) 0);
76 sym
->sy_frag
= &zero_address_frag
;
77 sym
->bsym
->flags
|= BSF_FILE
;
79 if (symbol_rootP
!= sym
)
81 symbol_remove (sym
, &symbol_rootP
, &symbol_lastP
);
82 symbol_insert (sym
, symbol_rootP
, &symbol_rootP
, &symbol_lastP
);
84 verify_symbol_chain (symbol_rootP
, symbol_lastP
);
98 name
= input_line_pointer
;
99 c
= get_symbol_end ();
100 /* just after name is now '\0' */
101 p
= input_line_pointer
;
104 if (*input_line_pointer
!= ',')
106 as_bad ("Expected comma after symbol-name");
107 ignore_rest_of_line ();
110 input_line_pointer
++; /* skip ',' */
111 if ((temp
= get_absolute_expression ()) < 0)
113 as_bad (".COMMon length (%d.) <0! Ignored.", temp
);
114 ignore_rest_of_line ();
119 symbolP
= symbol_find_or_make (name
);
121 if (S_IS_DEFINED (symbolP
))
123 as_bad ("Ignoring attempt to re-define symbol");
124 ignore_rest_of_line ();
127 if (S_GET_VALUE (symbolP
) != 0)
129 if (S_GET_VALUE (symbolP
) != size
)
131 as_warn ("Length of .comm \"%s\" is already %ld. Not changed to %d.",
132 S_GET_NAME (symbolP
), (long) S_GET_VALUE (symbolP
), size
);
135 know (symbolP
->sy_frag
== &zero_address_frag
);
136 if (*input_line_pointer
!= ',')
138 as_bad ("Expected comma after common length");
139 ignore_rest_of_line ();
142 input_line_pointer
++;
144 if (*input_line_pointer
!= '"')
146 temp
= get_absolute_expression ();
150 as_warn ("Common alignment negative; 0 assumed");
161 old_subsec
= now_subseg
;
163 record_alignment (bss_section
, align
);
164 subseg_set (bss_section
, 0);
166 frag_align (align
, 0);
167 if (S_GET_SEGMENT (symbolP
) == bss_section
)
168 symbolP
->sy_frag
->fr_symbol
= 0;
169 symbolP
->sy_frag
= frag_now
;
170 p
= frag_var (rs_org
, 1, 1, (relax_substateT
) 0, symbolP
, size
,
173 S_SET_SEGMENT (symbolP
, bss_section
);
174 S_CLEAR_EXTERNAL (symbolP
);
175 subseg_set (old_sec
, old_subsec
);
180 S_SET_VALUE (symbolP
, size
);
181 S_SET_EXTERNAL (symbolP
);
182 /* should be common, but this is how gas does it for now */
183 S_SET_SEGMENT (symbolP
, &bfd_und_section
);
188 input_line_pointer
++;
189 /* @@ Some use the dot, some don't. Can we get some consistency?? */
190 if (*input_line_pointer
== '.')
191 input_line_pointer
++;
192 /* @@ Some say data, some say bss. */
193 if (strncmp (input_line_pointer
, "bss\"", 4)
194 && strncmp (input_line_pointer
, "data\"", 5))
196 while (*--input_line_pointer
!= '"')
198 input_line_pointer
--;
199 goto bad_common_segment
;
201 while (*input_line_pointer
++ != '"')
203 goto allocate_common
;
205 demand_empty_rest_of_line ();
210 p
= input_line_pointer
;
211 while (*p
&& *p
!= '\n')
215 as_bad ("bad .common segment %s", input_line_pointer
+ 1);
217 input_line_pointer
= p
;
218 ignore_rest_of_line ();
232 name
= input_line_pointer
;
233 c
= get_symbol_end ();
234 symbolP
= symbol_find_or_make (name
);
235 *input_line_pointer
= c
;
237 S_CLEAR_EXTERNAL (symbolP
);
241 input_line_pointer
++;
243 if (*input_line_pointer
== '\n')
248 demand_empty_rest_of_line ();
260 name
= input_line_pointer
;
261 c
= get_symbol_end ();
262 symbolP
= symbol_find_or_make (name
);
263 *input_line_pointer
= c
;
265 S_SET_WEAK (symbolP
);
269 input_line_pointer
++;
271 if (*input_line_pointer
== '\n')
276 demand_empty_rest_of_line ();
279 static segT previous_section
;
280 static int previous_subsection
;
283 obj_elf_section (xxx
)
289 /* Initialize this with inclusive-or of all flags that can be cleared
290 by attributes, but not set by them. Also include flags that won't
291 get set properly in the assembler, but which the user/compiler
292 shouldn't be expected to set. */
293 flagword flags
= SEC_READONLY
| SEC_ALLOC
| SEC_RELOC
;
294 /* Initialize this with the default flags to be used if none are
296 flagword default_flags
= 0;
299 /* Get name of section. */
300 if (*input_line_pointer
== '"')
301 string
= demand_copy_C_string (&xxx
);
304 char *p
= input_line_pointer
;
306 while (0 == strchr ("\n\t,; ", *p
))
310 string
= xmalloc (p
- input_line_pointer
+ 1);
311 strcpy (string
, input_line_pointer
);
313 input_line_pointer
= p
;
315 if (!strcmp (string
, ".rodata"))
316 default_flags
= SEC_ALLOC
| SEC_READONLY
| SEC_RELOC
;
317 else if (!strcmp (string
, ".init")
318 || !strcmp (string
, ".fini"))
319 default_flags
= SEC_ALLOC
| SEC_READONLY
| SEC_RELOC
| SEC_CODE
;
322 if (*input_line_pointer
!= ',')
323 flags
= default_flags
;
324 while (*input_line_pointer
== ',')
330 input_line_pointer
++;
332 /* Under i386-svr4, gcc emits a string here. I don't know what this
333 string is supposed to signify or how to handle it. Ignore it for
334 now, unless it becomes a problem. */
335 if (*input_line_pointer
== '"')
337 demand_copy_C_string (&xxx
);
342 if (*input_line_pointer
!= '#' && *input_line_pointer
!= '@')
344 as_bad ("unrecognized syntax in .section command");
345 ignore_rest_of_line ();
348 input_line_pointer
++;
350 #define CHECK(X,BIT,NEG) \
351 if (!strncmp(X,input_line_pointer,len = sizeof(X) - 1)) { \
352 bit = BIT; inv = NEG; goto match; }
354 CHECK ("write", SEC_READONLY
, 1);
355 CHECK ("alloc", SEC_ALLOC
, 0);
356 CHECK ("execinstr", SEC_CODE
, 1);
357 CHECK ("progbits", SEC_LOAD
, 1);
360 p
= input_line_pointer
;
361 while (!is_end_of_line
[*p
] && *p
!= 0 && *p
!= ',')
365 as_bad ("unrecognized section attribute `%s' ignored",
375 input_line_pointer
+= len
;
377 demand_empty_rest_of_line ();
379 /* If the C string wasn't valid, `string' could be null. */
383 sec
= bfd_get_section_by_name (stdoutput
, string
);
386 sec
= subseg_new (string
, 0);
387 bfd_set_section_flags (stdoutput
, sec
, flags
);
388 sec
->output_section
= sec
;
390 previous_section
= now_seg
;
391 previous_subsection
= now_subseg
;
398 if (previous_section
== 0)
400 as_bad (".previous without corresponding .section; ignored");
403 subseg_set (previous_section
, previous_subsection
);
404 previous_section
= 0;
408 obj_elf_write_symbol_p (sym
)
411 /* If this is a local symbol, are there any relocations for which
414 /* To find this out, we examine all relocations in all bfd sections
415 that have relocations. If there is one that references this
416 symbol, we need to keep this symbol. In this case, we return a
417 true status. In all other cases, we return a false status. */
419 if (S_IS_LOCAL (sym
))
421 asymbol
*bsym
= sym
->bsym
;
422 bfd
*abfd
= bsym
->the_bfd
;
425 for (bsec
= abfd
->sections
; bsec
; bsec
= bsec
->next
)
427 struct reloc_cache_entry
**rlocs
= bsec
->orelocation
;
428 int rcnt
= bsec
->reloc_count
;
434 for (i
= 0; i
< rcnt
; i
++)
435 if (rlocs
[i
]->sym_ptr_ptr
436 && rlocs
[i
]->sym_ptr_ptr
[0] == bsym
)
441 /* No relocations for this section. Check the seg_info
442 structure to see if there are any fixups for this
444 segment_info_type
*seginfo
= seg_info (bsec
);
447 for (fixp
= seginfo
->fix_root
; fixp
; fixp
= fixp
->fx_next
)
448 if ((fixp
->fx_addsy
&& fixp
->fx_addsy
->bsym
== bsym
)
449 || (fixp
->fx_subsy
&& fixp
->fx_subsy
->bsym
== bsym
))
458 obj_elf_write_symbol (sym
)
461 return /* obj_elf_write_symbol_p (sym) || */ !S_IS_LOCAL (sym
);
465 obj_elf_frob_symbol (sym
, punt
)
469 #if 0 /* ?? The return value is ignored. Only the value of *punt is
471 return obj_elf_write_symbol_p (sym
);
478 /* Assume delimiter is part of expression. BSD4.2 as fails with
479 delightful bug, so we are not being incompatible here. */
480 new_logical_line ((char *) NULL
, (int) (get_absolute_expression ()));
481 demand_empty_rest_of_line ();
487 * Handle .stabX directives, which used to be open-coded.
488 * So much creeping featurism overloaded the semantics that we decided
489 * to put all .stabX thinking in one place. Here.
491 * We try to make any .stabX directive legal. Other people's AS will often
492 * do assembly-time consistency checks: eg assigning meaning to n_type bits
493 * and "protecting" you from setting them to certain values. (They also zero
494 * certain bits before emitting symbols. Tut tut.)
496 * If an expression is not absolute we either gripe or use the relocation
497 * information. Other people's assemblers silently forget information they
498 * don't need and invent information they need that you didn't supply.
500 * .stabX directives always make a symbol table entry. It may be junk if
501 * the rest of your .stabX directive is malformed.
505 * elf_stab_symbol_string()
507 * Build a string dictionary entry for a .stabX symbol.
508 * The symbol is added to the .stabstr section.
513 elf_stab_symbol_string (string
, secname
)
514 char *string
, *secname
;
520 unsigned int old_gdb_string_index
;
524 /* @@FIXME -- there should be no static data here!
525 This also has the effect of making all stab string tables large enough
526 to contain all the contents written to any of them. This only matters
527 with the Solaris native compiler for the moment, but it should be fixed
529 static unsigned int gdb_string_index
= 0;
531 old_gdb_string_index
= 0;
532 length
= strlen (string
);
533 clengthP
= (char *) &length
;
535 { /* Ordinary case. */
537 save_subseg
= now_subseg
;
539 /* Create the stab sections, if they are not already created. */
541 char *newsecname
= xmalloc (strlen (secname
) + 4);
542 strcpy (newsecname
, secname
);
543 strcat (newsecname
, "str");
544 seg
= bfd_get_section_by_name (stdoutput
, newsecname
);
547 seg
= bfd_make_section_old_way (stdoutput
, newsecname
);
548 bfd_set_section_flags (stdoutput
, seg
,
549 SEC_LOAD
| SEC_READONLY
| SEC_ALLOC
);
551 /* free (newsecname);*/
553 subseg_new ((char *) seg
->name
, save_subseg
);
554 old_gdb_string_index
= gdb_string_index
;
556 while ((c
= *string
++))
560 FRAG_APPEND_1_CHAR (c
);
563 FRAG_APPEND_1_CHAR ((char) 0);
569 FRAG_APPEND_1_CHAR ((char) 0);
573 subseg_new ((char *) save_seg
->name
, save_subseg
);
576 return old_gdb_string_index
;
580 DEFUN (elf_stab_symbol
, (symbolP
, stab_type
),
587 /* the string index portion of the stab */
588 md_number_to_chars (toP
, (valueT
) symbolP
->sy_name_offset
, 4);
589 md_number_to_chars (toP
+ 4, (valueT
) S_GET_TYPE (symbolP
), 1);
590 md_number_to_chars (toP
+ 5, (valueT
) S_GET_OTHER (symbolP
), 1);
591 md_number_to_chars (toP
+ 6, (valueT
) S_GET_DESC (symbolP
), 2);
592 /* The n_value field doesn't get written here, it gets done below. It
593 may be an expression needing relocating. */
597 obj_elf_stab_generic (what
, secname
)
603 symbolS
*symbolP
= 0;
610 asection
*saved_seg
= now_seg
;
612 subsegT subseg
= now_subseg
;
615 /* This function doesn't work yet.
617 Actually, this function is okay, but some finalizations are
618 needed before writing the object file; that's not done yet, and
619 the Solaris linker chokes without it.
621 In any case, this should effectively disable it for now. */
623 demand_copy_C_string (&length
);
628 seg
= bfd_get_section_by_name (stdoutput
, secname
);
631 seg
= subseg_new (secname
, 0);
632 bfd_set_section_flags (stdoutput
, seg
,
633 SEC_LOAD
| SEC_READONLY
| SEC_ALLOC
| SEC_RELOC
);
634 subseg_set (saved_seg
, subseg
);
639 * Enter with input_line_pointer pointing past .stabX and any following
644 string
= demand_copy_C_string (&length
);
646 if (*input_line_pointer
== ',')
647 input_line_pointer
++;
650 as_bad ("I need a comma after symbol's name");
658 * Input_line_pointer->after ','. String->symbol name.
662 symbolP
= symbol_new (string
, &bfd_und_section
, (valueT
) 0, (struct frag
*) 0);
664 /* enter the string in the .stab string table (section .stabstr) */
665 symbolP
->sy_name_offset
= elf_stab_symbol_string (string
, secname
);
670 S_SET_NAME (symbolP
, NULL
); /* .stabd feature. */
671 S_SET_VALUE (symbolP
,
672 (valueT
) ((char*) obstack_next_free (&frags
) - frag_now
->fr_literal
));
673 S_SET_SEGMENT (symbolP
, now_seg
);
674 symbolP
->sy_frag
= frag_now
;
678 symbolP
->sy_frag
= &zero_address_frag
;
682 symbolP
->sy_frag
= &zero_address_frag
;
690 if (get_absolute_expression_and_terminator (&longint
) == ',')
692 saved_type
= longint
;
693 S_SET_TYPE (symbolP
, saved_type
);
697 as_bad ("I want a comma after the n_type expression");
699 input_line_pointer
--; /* Backup over a non-',' char. */
705 if (get_absolute_expression_and_terminator (&longint
) == ',')
706 S_SET_OTHER (symbolP
, longint
);
709 as_bad ("I want a comma after the n_other expression");
711 input_line_pointer
--; /* Backup over a non-',' char. */
717 S_SET_DESC (symbolP
, get_absolute_expression ());
718 if (what
== 's' || what
== 'n')
720 if (*input_line_pointer
!= ',')
722 as_bad ("I want a comma after the n_desc expression");
727 input_line_pointer
++;
734 ignore_rest_of_line ();
738 subseg_new ((char *) seg
->name
, subseg
);
741 /* allocate and discard -- filled in later */
742 (void) frag_more (12);
744 /* Emit the stab symbol. */
745 elf_stab_symbol (symbolP
, what
);
747 if (what
== 's' || what
== 'n')
750 input_line_pointer
--;
754 char *p
= frag_more (4);
755 md_number_to_chars (p
, 0, 4);
758 subseg_new ((char *) saved_seg
->name
, subseg
);
760 if ((what
== 's' || what
== 'n')
761 && symbolP
->sy_value
.X_op
== O_constant
)
763 /* symbol is not needed in the regular symbol table */
764 symbol_remove (symbolP
, &symbol_rootP
, &symbol_lastP
);
767 if (what
== 's' && S_GET_TYPE (symbolP
) == N_SO
)
769 fragS
*fragp
= seg_info (seg
)->frchainP
->frch_root
;
771 && fragp
->fr_address
+ fragp
->fr_fix
< 12)
772 fragp
= fragp
->fr_next
;
774 assert (fragp
->fr_type
== rs_fill
);
775 assert (fragp
->fr_address
== 0 && fragp
->fr_fix
>= 12);
776 md_number_to_chars (fragp
->fr_literal
, (valueT
) symbolP
->sy_name_offset
,
781 switch (S_GET_TYPE (symbolP
))
784 listing_source_line (S_GET_DESC (symbolP
));
788 listing_source_file (string
);
792 demand_empty_rest_of_line ();
799 obj_elf_stab_generic (what
, ".stab");
809 secname
= demand_copy_C_string (&length
);
811 if (*input_line_pointer
== ',')
812 input_line_pointer
++;
815 as_bad ("comma missing in .xstabs");
816 ignore_rest_of_line ();
819 obj_elf_stab_generic (what
, secname
);
831 /* Frob invented at RMS' request. Set the n_desc of a symbol. */
832 name
= input_line_pointer
;
833 c
= get_symbol_end ();
834 p
= input_line_pointer
;
837 if (*input_line_pointer
!= ',')
840 as_bad ("Expected comma after name \"%s\"", name
);
842 ignore_rest_of_line ();
846 input_line_pointer
++;
847 temp
= get_absolute_expression ();
849 symbolP
= symbol_find_or_make (name
);
851 S_SET_DESC (symbolP
, temp
);
853 demand_empty_rest_of_line ();
854 } /* obj_elf_desc() */
857 obj_read_begin_hook ()
862 obj_symbol_new_hook (symbolP
)
865 #if 0 /* BFD already takes care of this */
866 elf32_symbol_type
*esym
= (elf32_symbol_type
*) symbolP
;
868 /* There is an Elf_Internal_Sym and an Elf_External_Sym. For now,
869 just zero them out. */
871 bzero ((char *) &esym
->internal_elf_sym
, sizeof (esym
->internal_elf_sym
));
872 bzero ((char *) &esym
->native_elf_sym
, sizeof (esym
->native_elf_sym
));
873 bzero ((char *) &esym
->tc_data
, sizeof (esym
->tc_data
));
884 asection
*seg
= now_seg
;
885 subsegT subseg
= now_subseg
;
886 Elf_Internal_Note i_note
;
887 Elf_External_Note e_note
;
888 asection
*note_secp
= (asection
*) NULL
;
892 if (*input_line_pointer
== '\"')
894 ++input_line_pointer
; /* -> 1st char of string. */
895 name
= input_line_pointer
;
897 while (is_a_char (c
= next_char_of_string ()))
899 c
= *input_line_pointer
;
900 *input_line_pointer
= '\0';
901 *(input_line_pointer
- 1) = '\0';
902 *input_line_pointer
= c
;
904 /* create the .note section if this is the first version string */
906 note_secp
= bfd_get_section_by_name (stdoutput
, ".note");
907 if (note_secp
== (asection
*) NULL
)
909 note_secp
= bfd_make_section_old_way (stdoutput
, ".note");
910 bfd_set_section_flags (stdoutput
,
912 SEC_LOAD
| SEC_HAS_CONTENTS
| SEC_READONLY
);
915 /* process the version string */
917 subseg_new ((char *) note_secp
->name
, 0);
920 i_note
.namesz
= ((len
+ 1) + 3) & ~3; /* round this to word boundary */
921 i_note
.descsz
= 0; /* no description */
922 i_note
.type
= NT_VERSION
;
923 p
= frag_more (sizeof (e_note
.namesz
));
924 md_number_to_chars (p
, (valueT
) i_note
.namesz
, 4);
925 p
= frag_more (sizeof (e_note
.descsz
));
926 md_number_to_chars (p
, (valueT
) i_note
.descsz
, 4);
927 p
= frag_more (sizeof (e_note
.type
));
928 md_number_to_chars (p
, (valueT
) i_note
.type
, 4);
930 for (i
= 0; i
< len
; i
++)
934 FRAG_APPEND_1_CHAR (ch
);
939 subseg_new ((char *) seg
->name
, subseg
);
943 as_bad ("Expected quoted string");
945 demand_empty_rest_of_line ();
951 char *name
= input_line_pointer
;
952 char c
= get_symbol_end ();
957 p
= input_line_pointer
;
960 if (*input_line_pointer
!= ',')
963 as_bad ("expected comma after name `%s' in .size directive", name
);
965 ignore_rest_of_line ();
968 input_line_pointer
++;
970 if (exp
.X_op
== O_absent
)
972 as_bad ("missing expression in .size directive");
973 exp
.X_op
= O_constant
;
974 exp
.X_add_number
= 0;
977 sym
= symbol_find_or_make (name
);
979 if (exp
.X_op
== O_constant
)
980 S_SET_SIZE (sym
, exp
.X_add_number
);
987 as_tsktsk (".size expressions not yet supported, ignored");
992 demand_empty_rest_of_line ();
998 char *name
= input_line_pointer
;
999 char c
= get_symbol_end ();
1004 p
= input_line_pointer
;
1007 if (*input_line_pointer
!= ',')
1009 as_bad ("expected comma after name in .type directive");
1011 ignore_rest_of_line ();
1014 input_line_pointer
++;
1016 if (*input_line_pointer
!= '#' && *input_line_pointer
!= '@')
1018 as_bad ("expected `#' or `@' after comma in .type directive");
1021 input_line_pointer
++;
1022 if (!strncmp ("function", input_line_pointer
, sizeof ("function") - 1))
1024 type
= BSF_FUNCTION
;
1025 input_line_pointer
+= sizeof ("function") - 1;
1027 else if (!strncmp ("object", input_line_pointer
, sizeof ("object") - 1))
1029 input_line_pointer
+= sizeof ("object") - 1;
1033 as_bad ("unrecognized symbol type, ignored");
1036 demand_empty_rest_of_line ();
1038 sym
= symbol_find_or_make (name
);
1039 sym
->bsym
->flags
|= type
;
1045 static segT comment_section
;
1046 segT old_section
= now_seg
;
1047 int old_subsection
= now_subseg
;
1049 if (!comment_section
)
1052 comment_section
= subseg_new (".comment", 0);
1053 bfd_set_section_flags (stdoutput
, comment_section
, SEC_HAS_CONTENTS
);
1058 subseg_set (comment_section
, 0);
1060 subseg_set (old_section
, old_subsection
);
1064 adjust_stab_sections (abfd
, sec
, xxx
)
1074 if (strncmp (".stab", sec
->name
, 5))
1076 if (!strcmp ("str", sec
->name
+ strlen (sec
->name
) - 3))
1079 name
= (char *) alloca (strlen (sec
->name
) + 4);
1080 strcpy (name
, sec
->name
);
1081 strcat (name
, "str");
1082 strsec
= bfd_get_section_by_name (abfd
, name
);
1084 strsz
= bfd_section_size (abfd
, strsec
);
1087 nsyms
= bfd_section_size (abfd
, sec
) / 12 - 1;
1089 fragp
= seg_info (sec
)->frchainP
->frch_root
;
1091 && fragp
->fr_address
+ fragp
->fr_fix
< 12)
1092 fragp
= fragp
->fr_next
;
1093 assert (fragp
!= 0);
1094 assert (fragp
->fr_type
== rs_fill
);
1095 assert (fragp
->fr_address
== 0 && fragp
->fr_fix
>= 12);
1097 bfd_h_put_16 (abfd
, nsyms
, fragp
->fr_literal
+ 6);
1098 bfd_h_put_32 (abfd
, strsz
, fragp
->fr_literal
+ 8);
1104 bfd_map_over_sections (stdoutput
, adjust_stab_sections
, (PTR
) 0);
1106 #ifdef elf_tc_symbol
1110 for (i
= 0; i
< stdoutput
->symcount
; i
++)
1111 elf_tc_symbol (stdoutput
, (PTR
) (stdoutput
->outsymbols
[i
]),
1116 #ifdef elf_tc_final_processing
1117 elf_tc_final_processing ();
1120 /* Finally, we must make any target-specific sections. */
1122 #ifdef elf_tc_make_sections
1123 elf_tc_make_sections (stdoutput
);