diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2006-10-30 23:25:51 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2006-10-30 23:25:51 +0000 |
commit | c0f0068602c40067eee019e0d3d152c5c1868f18 (patch) | |
tree | 0cec9c4ca009afd8bb1f48d81c8d3750fba41457 /bfd/elf.c | |
parent | 5147198ffdd2c4035831da361cd65faa7b054803 (diff) | |
download | gdb-c0f0068602c40067eee019e0d3d152c5c1868f18.zip gdb-c0f0068602c40067eee019e0d3d152c5c1868f18.tar.gz gdb-c0f0068602c40067eee019e0d3d152c5c1868f18.tar.bz2 |
bfd/
2006-10-30 H.J. Lu <hongjiu.lu@intel.com>
PR ld/3111
* elf-bfd.h (elf_obj_tdata): Add symbuf.
(_bfd_elf_section_already_linked): Add struct bfd_link_info *.
(_bfd_elf_check_kept_section): Likewise.
(bfd_elf_match_symbols_in_sections): Likewise.
* elf.c (assign_section_numbers): Updated to add
struct bfd_link_info *.
(bfd_elf_match_symbols_in_sections): Updated. Cache symbol
buffer if info->reduce_memory_overheads is false.
* elflink.c (match_group_member): Updated to add
struct bfd_link_info *.
(_bfd_elf_check_kept_section): Likewise.
(elf_link_input_bfd): Likewise.
(_bfd_elf_section_already_linked): Likewise.
(bfd_elf_final_link): Free symbol buffer if
info->reduce_memory_overheads is false.
* libbfd-in.h (_bfd_nolink_section_already_linked): Add
struct bfd_link_info *.
(_bfd_generic_section_already_linked): Likewise.
* libbfd.h: Regenerated.
* linker.c (bfd_section_already_linked): Add
struct bfd_link_info *.
(_bfd_generic_section_already_linked): Likewise.
* targets.c (bfd_target): Add struct bfd_link_info * to
_section_already_linked.
* bfd-in2.h: Regenerated.
include/
2006-10-30 H.J. Lu <hongjiu.lu@intel.com>
PR ld/3111
* bfdlink.h (bfd_link_info): Add reduce_memory_overheads.
ld/
2006-10-30 H.J. Lu <hongjiu.lu@intel.com>
PR ld/3111
* ld.h (args_type): Remove reduce_memory_overheads.
* ldlang.c (lang_map): Updated.
(section_already_linked): Likewise.
(print_input_section): Likewise.
* ldmain.c (main): Likewise.
* lexsup.c (parse_args): Likewise.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 58 |
1 files changed, 39 insertions, 19 deletions
@@ -3173,7 +3173,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info) s, s->owner); /* Point to the kept section if it has the same size as the discarded one. */ - kept = _bfd_elf_check_kept_section (s); + kept = _bfd_elf_check_kept_section (s, link_info); if (kept == NULL) { bfd_set_error (bfd_error_bad_value); @@ -8674,7 +8674,8 @@ elf_sym_name_compare (const void *arg1, const void *arg2) symbols. */ bfd_boolean -bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2) +bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2, + struct bfd_link_info *info) { bfd *bfd1, *bfd2; const struct elf_backend_data *bed1, *bed2; @@ -8730,21 +8731,37 @@ bfd_elf_match_symbols_in_sections (asection *sec1, asection *sec2) if (symcount1 == 0 || symcount2 == 0) return FALSE; - isymbuf1 = bfd_elf_get_elf_syms (bfd1, hdr1, symcount1, 0, - NULL, NULL, NULL); - isymbuf2 = bfd_elf_get_elf_syms (bfd2, hdr2, symcount2, 0, - NULL, NULL, NULL); - result = FALSE; - if (isymbuf1 == NULL || isymbuf2 == NULL) - goto done; + isymbuf1 = elf_tdata (bfd1)->symbuf; + isymbuf2 = elf_tdata (bfd2)->symbuf; - /* Sort symbols by binding and section. Global definitions are at - the beginning. */ - qsort (isymbuf1, symcount1, sizeof (Elf_Internal_Sym), - elf_sort_elf_symbol); - qsort (isymbuf2, symcount2, sizeof (Elf_Internal_Sym), - elf_sort_elf_symbol); + if (isymbuf1 == NULL) + { + isymbuf1 = bfd_elf_get_elf_syms (bfd1, hdr1, symcount1, 0, + NULL, NULL, NULL); + if (isymbuf1 == NULL) + goto done; + /* Sort symbols by binding and section. Global definitions are at + the beginning. */ + qsort (isymbuf1, symcount1, sizeof (Elf_Internal_Sym), + elf_sort_elf_symbol); + if (!info->reduce_memory_overheads) + elf_tdata (bfd1)->symbuf = isymbuf1; + } + + if (isymbuf2 == NULL) + { + isymbuf2 = bfd_elf_get_elf_syms (bfd2, hdr2, symcount2, 0, + NULL, NULL, NULL); + if (isymbuf2 == NULL) + goto done; + /* Sort symbols by binding and section. Global definitions are at + the beginning. */ + qsort (isymbuf2, symcount2, sizeof (Elf_Internal_Sym), + elf_sort_elf_symbol); + if (!info->reduce_memory_overheads) + elf_tdata (bfd2)->symbuf = isymbuf2; + } /* Count definitions in the section. */ count1 = 0; @@ -8828,10 +8845,13 @@ done: free (symtable1); if (symtable2) free (symtable2); - if (isymbuf1) - free (isymbuf1); - if (isymbuf2) - free (isymbuf2); + if (info->reduce_memory_overheads) + { + if (isymbuf1) + free (isymbuf1); + if (isymbuf2) + free (isymbuf2); + } return result; } |