diff options
author | Ian Lance Taylor <ian@airs.com> | 1994-04-01 23:01:53 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1994-04-01 23:01:53 +0000 |
commit | d6d6b18ab241417382c3141f8d26db24eea566ea (patch) | |
tree | 21736a9e0276e33891c4aaaa0d85ea62756ec9b3 /bfd | |
parent | dfe09c4926f59250567b319e77a1d3340d783894 (diff) | |
download | gdb-d6d6b18ab241417382c3141f8d26db24eea566ea.zip gdb-d6d6b18ab241417382c3141f8d26db24eea566ea.tar.gz gdb-d6d6b18ab241417382c3141f8d26db24eea566ea.tar.bz2 |
* aoutx.h (aout_link_write_symbols): If keep_memory is false, make
sure the symbol name is stored in permanent memory before adding
it to the string table.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 4 | ||||
-rw-r--r-- | bfd/aoutx.h | 20 |
2 files changed, 23 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 8bda4bc..f7b00c2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,9 @@ Fri Apr 1 12:40:58 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + * aoutx.h (aout_link_write_symbols): If keep_memory is false, make + sure the symbol name is stored in permanent memory before adding + it to the string table. + * archive.c (_bfd_write_archive_contents): Once we've found an object, don't bother to look for more when deciding whether to build a map. diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 6a7fba8..70a722b 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -3734,6 +3734,7 @@ aout_link_write_symbols (finfo, input_bfd, symbol_map) { const char *name; int type; + struct aout_link_hash_entry *h; boolean skip; asection *symsec; bfd_vma val = 0; @@ -3743,6 +3744,8 @@ aout_link_write_symbols (finfo, input_bfd, symbol_map) type = bfd_h_get_8 (input_bfd, sym->e_type); name = strings + GET_WORD (input_bfd, sym->e_strx); + h = NULL; + if (pass) { /* Pass this symbol through. It is the target of an @@ -3760,7 +3763,6 @@ aout_link_write_symbols (finfo, input_bfd, symbol_map) } else { - struct aout_link_hash_entry *h; struct aout_link_hash_entry *hresolve; /* We have saved the hash table entry for this symbol, if @@ -3949,6 +3951,22 @@ aout_link_write_symbols (finfo, input_bfd, symbol_map) outsym->e_other); bfd_h_put_16 (output_bfd, bfd_h_get_16 (input_bfd, sym->e_desc), outsym->e_desc); + if (! finfo->info->keep_memory) + { + /* name points into a string table which we are going to + free. If there is a hash table entry, use that string. + Otherwise, copy name into memory. */ + if (h != (struct aout_link_hash_entry *) NULL) + name = (*sym_hash)->root.root.string; + else + { + char *n; + + n = bfd_alloc (output_bfd, strlen (name) + 1); + strcpy (n, name); + name = n; + } + } PUT_WORD (output_bfd, add_to_stringtab (output_bfd, name, &finfo->strtab), outsym->e_strx); |