diff options
author | Nick Clifton <nickc@redhat.com> | 2004-03-31 09:27:40 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2004-03-31 09:27:40 +0000 |
commit | a56b48eb0fa6568864c2e3adc4dd70ab23b84611 (patch) | |
tree | e6afc68b04cbb6da92d26eb82ad483f36a9d789b /bfd | |
parent | 3d45646427f594eb985155728df5e8dc6f55637a (diff) | |
download | gdb-a56b48eb0fa6568864c2e3adc4dd70ab23b84611.zip gdb-a56b48eb0fa6568864c2e3adc4dd70ab23b84611.tar.gz gdb-a56b48eb0fa6568864c2e3adc4dd70ab23b84611.tar.bz2 |
(struct stab_link_includes_totals): Rename field 'total' to 'sum_chars'
and add field 'num_chars'.
(_bfd_link_section_stabs): When computing the sum of the characters in a
B_INCL..B_EINCL range also keep a count of the number of characters. Use
this information to help distinguish between include sections when have
the same sum but which nevertheless are still unique.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 10 | ||||
-rw-r--r-- | bfd/stabs.c | 24 |
2 files changed, 26 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c2a90ad..1fac59a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2004-03-31 Andy Chittenden <achittenden@bluearc.com> + + * stabs.c (struct stab_link_includes_totals): Rename field 'total' + to 'sum_chars' and add field 'num_chars'. + (_bfd_link_section_stabs): When computing the sum of the + characters in a B_INCL..B_EINCL range also keep a count of the + number of characters. Use this information to help distinguish + between include sections when have the same sum but which + nevertheless are still unique. + 2004-03-31 Mattias Engdegård <mattias@virtutech.se> * stabs.c (_bfd_link_section_stabs): Do not skip N_EXCL stabs. diff --git a/bfd/stabs.c b/bfd/stabs.c index 5aa3b03..23cb24a 100644 --- a/bfd/stabs.c +++ b/bfd/stabs.c @@ -56,12 +56,17 @@ struct stab_link_includes_table }; /* A linked list of totals that we have found for a particular header - file. */ + file. A total is the sum of all the STABS characters for a particular + file and the number of these charactes. It is used to identify + duplicate files which can be excluded. XXX: A better method would be to + compute an MD5 checksum, but that is coding left for another day. + The bfd_vma type is used because it is a very large unsigned type. */ struct stab_link_includes_totals { struct stab_link_includes_totals *next; - bfd_vma total; + bfd_vma sum_chars; /* Accumulated sum of STABS characters. */ + bfd_vma num_chars; /* Number of STABS characters. */ }; /* An entry in the header file hash table. */ @@ -340,14 +345,15 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of first number after an open parenthesis). */ if (type == (int) N_BINCL) { - bfd_vma val; + bfd_vma sum_chars; + bfd_vma num_chars; int nest; bfd_byte *incl_sym; struct stab_link_includes_entry *incl_entry; struct stab_link_includes_totals *t; struct stab_excl_list *ne; - val = 0; + sum_chars = num_chars = 0; nest = 0; for (incl_sym = sym + STABSIZE; incl_sym < symend; @@ -377,7 +383,8 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of + bfd_get_32 (abfd, incl_sym + STRDXOFF)); for (; *str != '\0'; str++) { - val += *str; + sum_chars += *str; + num_chars ++; if (*str == '(') { /* Skip the file number. */ @@ -398,7 +405,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of goto error_return; for (t = incl_entry->totals; t != NULL; t = t->next) - if (t->total == val) + if (t->sum_chars == sum_chars && t->num_chars == num_chars) break; /* Record this symbol, so that we can set the value @@ -408,7 +415,7 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of if (ne == NULL) goto error_return; ne->offset = sym - stabbuf; - ne->val = val; + ne->val = sum_chars; ne->type = (int) N_BINCL; ne->next = secinfo->excls; secinfo->excls = ne; @@ -421,7 +428,8 @@ _bfd_link_section_stabs (abfd, psinfo, stabsec, stabstrsec, psecinfo, pstring_of bfd_hash_allocate (&sinfo->includes.root, sizeof *t)); if (t == NULL) goto error_return; - t->total = val; + t->sum_chars = sum_chars; + t->num_chars = num_chars; t->next = incl_entry->totals; incl_entry->totals = t; } |