- asection *section;
- bfd *abfd = statement->the_bfd;
-
- /* Look at all the sections attached to the bfd associated with
- the current statement. */
- for (section = abfd->sections;
- section != (asection *)NULL;
- section = section ->next)
- {
- int new_sym_cnt = 0;
- int i,j;
- asymbol *syms;
-
- /* Do the dirty work; an array of symbols for each new stub
- will be returned. */
- syms = hppa_look_for_stubs_in_section (stub_file->the_bfd,
- abfd,
- output_bfd,
- section,
- statement->asymbols,
- &new_sym_cnt,
- &link_info);
-
- if (new_sym_cnt > 0 && syms)
- {
- struct symbol_cache_entry **old_asymbols;
-
- old_asymbols = stub_file->asymbols;
-
- /* Allocate space for the updated symbols */
- stub_file->asymbols
- = xmalloc ((stub_file->symbol_count + new_sym_cnt)
- * sizeof(asymbol *));
- if (stub_file->asymbols == NULL)
- abort ();
-
- /* Copy the old symbols.
-
- FIXME. Shouldn't we free the space used by the old
- symbols here? Might there be dangling references
- made within hppa_look_for_stubs_in_section? */
- for (j = 0; j < stub_file->symbol_count; j++)
- stub_file->asymbols[j] = old_asymbols[j];
-
- /* Copy in the new symbols. */
- for (j = 0, i = stub_file->symbol_count;
- j < new_sym_cnt;
- j++, i++)
- stub_file->asymbols[i] = &syms[j];
-
- /* Finally, adjust the symbol count. */
- stub_file->symbol_count += new_sym_cnt;
- }
- }
- }
-
- /* Add a statement to get the linker stubs included in the output. */
- lang_add_wild (".hppa_linker_stubs",NULL);
-
- /* If stubs were added, then remove all the (now invalid) padding
- statements. */
- hppaelf_search_for_padding_statements (stat_ptr->head,
- &stat_ptr->head);