From 41198d0cfa94b0197dc8bdfb9542ad55ce980850 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 12 Sep 2006 22:10:31 +0000 Subject: [PATCH] bfd/ 2006-09-12 H.J. Lu PR ld/3197 * elflink.c (elf_link_output_extsym): Compute bucket only if needed. ld/testsuite/ 2006-09-12 H.J. Lu PR ld/3197 * ld-elf/hash.d: New test. --- bfd/ChangeLog | 6 ++++++ bfd/elflink.c | 10 +++++----- ld/testsuite/ChangeLog | 5 +++++ ld/testsuite/ld-elf/hash.d | 8 ++++++++ 4 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 ld/testsuite/ld-elf/hash.d diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0d4a95e9e41..1e22c447ce9 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2006-09-12 H.J. Lu + + PR ld/3197 + * elflink.c (elf_link_output_extsym): Compute bucket only if + needed. + 2006-09-10 H.J. Lu PR binutils/3186 diff --git a/bfd/elflink.c b/bfd/elflink.c index d3f9b62ca60..a1bc864a00d 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -7061,8 +7061,6 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) if (h->dynindx != -1 && elf_hash_table (finfo->info)->dynamic_sections_created) { - size_t bucketcount; - size_t bucket; bfd_byte *esym; sym.st_name = h->dynstr_index; @@ -7074,14 +7072,16 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) } bed->s->swap_symbol_out (finfo->output_bfd, &sym, esym, 0); - bucketcount = elf_hash_table (finfo->info)->bucketcount; - bucket = h->u.elf_hash_value % bucketcount; - if (finfo->hash_sec != NULL) { size_t hash_entry_size; bfd_byte *bucketpos; bfd_vma chain; + size_t bucketcount; + size_t bucket; + + bucketcount = elf_hash_table (finfo->info)->bucketcount; + bucket = h->u.elf_hash_value % bucketcount; hash_entry_size = elf_section_data (finfo->hash_sec)->this_hdr.sh_entsize; diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 9e908911341..d482c48fab1 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2006-09-12 H.J. Lu + + PR ld/3197 + * ld-elf/hash.d: New test. + 2006-09-04 Vladimir Prus * ld-arm/use-thumb-lib.sym: Use regexps instead of diff --git a/ld/testsuite/ld-elf/hash.d b/ld/testsuite/ld-elf/hash.d new file mode 100644 index 00000000000..20c77905eaa --- /dev/null +++ b/ld/testsuite/ld-elf/hash.d @@ -0,0 +1,8 @@ +#source: start.s +#readelf: -d +#ld: -shared --hash-style=gnu +#target: *-*-linux* + +#... +[ ]*0x[0-9a-z]+[ ]+\(GNU_HASH\)[ ]+0x[0-9a-z]+ +#... -- 2.30.2