Go to the first, previous, next, last section, table of contents.


Writing the symbol table

The _bfd_final_link function must gather all the symbols in the input files and write them out. It must also write out all the symbols in the global hash table. This must be controlled by the strip and discard fields of the bfd_link_info structure.

The local symbols of the input files will not have been entered into the linker hash table. The _bfd_final_link routine must consider each input file and include the symbols in the output file. It may be convenient to do this when looking through the link_order structures, or it may be done by stepping through the input_bfds list.

The _bfd_final_link routine must also traverse the global hash table to gather all the externally visible symbols. It is possible that most of the externally visible symbols may be written out when considering the symbols of each input file, but it is still necessary to traverse the hash table since the linker script may have defined some symbols that are not in any of the input files.

The strip field of the bfd_link_info structure controls which symbols are written out. The possible values are listed in bfdlink.h. If the value is strip_some, then the keep_hash field of the bfd_link_info structure is a hash table of symbols to keep; each symbol should be looked up in this hash table, and only symbols which are present should be included in the output file.

If the strip field of the bfd_link_info structure permits local symbols to be written out, the discard field is used to further controls which local symbols are included in the output file. If the value is discard_l, then all local symbols which begin with a certain prefix are discarded; this is controlled by the bfd_is_local_label_name entry point.

The a.out backend handles symbols by calling aout_link_write_symbols on each input BFD and then traversing the global hash table with the function aout_link_write_other_symbol. It builds a string table while writing out the symbols, which is written to the output file at the end of NAME(aout,final_link).

bfd_link_split_section

Synopsis

boolean bfd_link_split_section(bfd *abfd, asection *sec);

Description
Return nonzero if sec should be split during a reloceatable or final link.

#define bfd_link_split_section(abfd, sec) \
       BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))


Go to the first, previous, next, last section, table of contents.