diff options
author | Alan Modra <amodra@gmail.com> | 2016-09-17 00:28:05 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2016-09-19 15:16:50 +0930 |
commit | 2387dd904938566f5d1d6df6670b5dec9dd3f463 (patch) | |
tree | ab07ba274beeffbbc4e29b4f7202a3567328ea74 /binutils | |
parent | bc1e6c81d5b77d78282c47f6fd7f697e564a6eb6 (diff) | |
download | gdb-2387dd904938566f5d1d6df6670b5dec9dd3f463.zip gdb-2387dd904938566f5d1d6df6670b5dec9dd3f463.tar.gz gdb-2387dd904938566f5d1d6df6670b5dec9dd3f463.tar.bz2 |
nm handling of synthetic symbols
Symbol sorting means we can't assume that the last n symbols are
synthetic.
* nm.c (print_symbol): Remove is_synthetic param. Test sym->flags
instead.
(print_size_symbols, print_symbols): Adjust to suit, deleting
now unused synth_count param and fromsynth var.
(display_rel_file): Adjust, localizing synth_count.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 8 | ||||
-rw-r--r-- | binutils/nm.c | 25 |
2 files changed, 16 insertions, 17 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 3cb2a77..1b86161 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,11 @@ +2016-09-19 Alan Modra <amodra@gmail.com> + + * nm.c (print_symbol): Remove is_synthetic param. Test sym->flags + instead. + (print_size_symbols, print_symbols): Adjust to suit, deleting + now unused synth_count param and fromsynth var. + (display_rel_file): Adjust, localizing synth_count. + 2016-09-14 Ed Maste <emaste@freebsd.org> * readelf.c (process_mips_specific): Fix typo in error message. diff --git a/binutils/nm.c b/binutils/nm.c index 766564d..40e5053 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -844,8 +844,7 @@ static void print_symbol (bfd * abfd, asymbol * sym, bfd_vma ssize, - bfd * archive_bfd, - bfd_boolean is_synthetic) + bfd * archive_bfd) { symbol_info syminfo; struct extended_symbol_info info; @@ -859,7 +858,7 @@ print_symbol (bfd * abfd, info.sinfo = &syminfo; info.ssize = ssize; /* Synthetic symbols do not have a full symbol type set of data available. */ - if (is_synthetic) + if ((sym->flags & BSF_SYNTHETIC) != 0) { info.elfinfo = NULL; info.coffinfo = NULL; @@ -993,13 +992,11 @@ print_size_symbols (bfd * abfd, bfd_boolean is_dynamic, struct size_sym * symsizes, long symcount, - long synth_count, bfd * archive_bfd) { asymbol *store; struct size_sym *from; struct size_sym *fromend; - struct size_sym *fromsynth; store = bfd_make_empty_symbol (abfd); if (store == NULL) @@ -1007,7 +1004,6 @@ print_size_symbols (bfd * abfd, from = symsizes; fromend = from + symcount; - fromsynth = symsizes + (symcount - synth_count); for (; from < fromend; from++) { @@ -1017,7 +1013,7 @@ print_size_symbols (bfd * abfd, if (sym == NULL) bfd_fatal (bfd_get_filename (abfd)); - print_symbol (abfd, sym, from->size, archive_bfd, from >= fromsynth); + print_symbol (abfd, sym, from->size, archive_bfd); } } @@ -1026,9 +1022,7 @@ print_size_symbols (bfd * abfd, If ARCHIVE_BFD is non-NULL, it is the archive containing ABFD. - SYMCOUNT is the number of symbols in MINISYMS and SYNTH_COUNT - is the number of these that are synthetic. Synthetic symbols, - if any are present, always come at the end of the MINISYMS. + SYMCOUNT is the number of symbols in MINISYMS. SIZE is the size of a symbol in MINISYMS. */ @@ -1037,14 +1031,12 @@ print_symbols (bfd * abfd, bfd_boolean is_dynamic, void * minisyms, long symcount, - long synth_count, unsigned int size, bfd * archive_bfd) { asymbol *store; bfd_byte *from; bfd_byte *fromend; - bfd_byte *fromsynth; store = bfd_make_empty_symbol (abfd); if (store == NULL) @@ -1052,7 +1044,6 @@ print_symbols (bfd * abfd, from = (bfd_byte *) minisyms; fromend = from + symcount * size; - fromsynth = (bfd_byte *) minisyms + ((symcount - synth_count) * size); for (; from < fromend; from += size) { @@ -1062,7 +1053,7 @@ print_symbols (bfd * abfd, if (sym == NULL) bfd_fatal (bfd_get_filename (abfd)); - print_symbol (abfd, sym, (bfd_vma) 0, archive_bfd, from >= fromsynth); + print_symbol (abfd, sym, (bfd_vma) 0, archive_bfd); } } @@ -1072,7 +1063,6 @@ static void display_rel_file (bfd *abfd, bfd *archive_bfd) { long symcount; - long synth_count = 0; void *minisyms; unsigned int size; struct size_sym *symsizes; @@ -1111,6 +1101,7 @@ display_rel_file (bfd *abfd, bfd *archive_bfd) asymbol **dyn_syms = NULL; long static_count = 0; long dyn_count = 0; + long synth_count; if (dynamic) { @@ -1178,9 +1169,9 @@ display_rel_file (bfd *abfd, bfd *archive_bfd) } if (! sort_by_size) - print_symbols (abfd, dynamic, minisyms, symcount, synth_count, size, archive_bfd); + print_symbols (abfd, dynamic, minisyms, symcount, size, archive_bfd); else - print_size_symbols (abfd, dynamic, symsizes, symcount, synth_count, archive_bfd); + print_size_symbols (abfd, dynamic, symsizes, symcount, archive_bfd); free (minisyms); free (symsizes); |