bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/204] Count section symbols incorrectly


From: nickc at redhat dot com
Subject: [Bug ld/204] Count section symbols incorrectly
Date: 1 Jul 2004 14:52:00 -0000

------- Additional Comments From nickc at redhat dot com  2004-07-01 14:51 
-------
Subject: Re:  Count section symbols incorrectly

Hi Zhangjie,

> This is an initial effort trying to fix it. There are two methods can be used
> to fix it. One is to record the number of output section symbols that will 
> enter
> the .dynsym in a new field in struct elf_link_hash_table as this patch does,
> the other is to count the number when it is needed. I think the former is
> better.

Actually I think that for now it would be better to compute the count 
when it is needed.  This causes the least disruption to the generic code 
and so it the least likely to introduce bugs that affect other ports. 
Hence I am applying this variation of your patch.

Cheers
   Nick

bfd/ChangeLog
2004-07-01  Jie Zhang  <address@hidden>
            Nick Clifton  <address@hidden>

        PR 204
        * elfxx-mips.c (_bfd_mips_elf_final_link): Pass the correct
         number of section symbols to mips_elf_sort_hash_table ().
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.105
diff -c -3 -p -r1.105 elfxx-mips.c
*** bfd/elfxx-mips.c    29 Jun 2004 13:46:34 -0000      1.105
--- bfd/elfxx-mips.c    1 Jul 2004 14:48:43 -0000
*************** _bfd_mips_elf_final_link (bfd *abfd, str
*** 8082,8089 ****
    asection *rtproc_sec;
    Elf32_RegInfo reginfo;
    struct ecoff_debug_info debug;
!   const struct ecoff_debug_swap *swap
!     = get_elf_backend_data (abfd)->elf_backend_ecoff_debug_swap;
    HDRR *symhdr = &debug.symbolic_header;
    void *mdebug_handle = NULL;
    asection *s;
--- 8082,8089 ----
    asection *rtproc_sec;
    Elf32_RegInfo reginfo;
    struct ecoff_debug_info debug;
!   const struct elf_backend_data *bed = get_elf_backend_data (abfd);
!   const struct ecoff_debug_swap *swap = bed->elf_backend_ecoff_debug_swap;
    HDRR *symhdr = &debug.symbolic_header;
    void *mdebug_handle = NULL;
    asection *s;
*************** _bfd_mips_elf_final_link (bfd *abfd, str
*** 8111,8116 ****
--- 8111,8117 ----
        bfd *dynobj;
        asection *got;
        struct mips_got_info *g;
+       bfd_size_type dynsecsymcount;
  
        /* When we resort, we must tell mips_elf_sort_hash_table what
         the lowest index it may use is.  That's the number of section
*************** _bfd_mips_elf_final_link (bfd *abfd, str
*** 8118,8126 ****
         adds these symbols when building a shared object.  Note that
         we count the sections after (possibly) removing the .options
         section above.  */
!       if (! mips_elf_sort_hash_table (info, (info->shared
!                                            ? bfd_count_sections (abfd) + 1
!                                            : 1)))
        return FALSE;
  
        /* Make sure we didn't grow the global .got region.  */
--- 8119,8138 ----
         adds these symbols when building a shared object.  Note that
         we count the sections after (possibly) removing the .options
         section above.  */
! 
!       dynsecsymcount = 0;
!       if (info->shared)
!       {
!         asection * p;
! 
!         for (p = abfd->sections; p ; p = p->next)
!           if ((p->flags & SEC_EXCLUDE) == 0
!               && (p->flags & SEC_ALLOC) != 0
!               && !(*bed->elf_backend_omit_section_dynsym) (abfd, info, p))
!             ++ dynsecsymcount;
!       }
!       
!       if (! mips_elf_sort_hash_table (info, dynsecsymcount + 1))
        return FALSE;
  
        /* Make sure we didn't grow the global .got region.  */


-- 


http://sources.redhat.com/bugzilla/show_bug.cgi?id=204

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]