This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: gcc/gdb/as/ld issue


I've found the cause of the issue in bfd/stabs.c in that it throws away too
many BINCL sections. It turns out that the psuedo hash used to detect
duplicates is detecting bogus duplicates. This patch demonstrated the
problem by also saving the length of the symbols along with the hash and
printing out a message when it would have dropped a "duplicate" previously.
Unfortunately, I don't think this is the full fix as the length of the
symbols may be identical as well even though the symbols may be different.
Anyway, gdb is now happy in our environment with this fix (for now). Please
can someone come up with a proper fix?


Index: bfd/stabs.c
===================================================================
RCS file: /cvs/src/src/bfd/stabs.c,v
retrieving revision 1.15
diff -c -w -r1.15 stabs.c
*** bfd/stabs.c	25 Nov 2003 11:59:57 -0000	1.15
--- bfd/stabs.c	20 Mar 2004 05:04:14 -0000
***************
*** 62,67 ****
--- 62,68 ----
  {
    struct stab_link_includes_totals *next;
    bfd_vma total;
+   bfd_vma len;
  };
  
  /* An entry in the header file hash table.  */
***************
*** 90,95 ****
--- 91,97 ----
    bfd_size_type offset;
    /* The value to use for the symbol.  */
    bfd_vma val;
+   bfd_vma len;
    /* The type of this symbol (N_BINCL or N_EXCL).  */
    int type;
  };
***************
*** 341,346 ****
--- 343,349 ----
        if (type == (int) N_BINCL)
  	{
  	  bfd_vma val;
+ 	  bfd_vma len;
  	  int nest;
  	  bfd_byte *incl_sym;
  	  struct stab_link_includes_entry *incl_entry;
***************
*** 348,353 ****
--- 351,357 ----
  	  struct stab_excl_list *ne;
  
  	  val = 0;
+ 	  len = 0;
  	  nest = 0;
  	  for (incl_sym = sym + STABSIZE;
  	       incl_sym < symend;
***************
*** 378,383 ****
--- 382,388 ----
  		  for (; *str != '\0'; str++)
  		    {
  		      val += *str;
+                 ++len;
  		      if (*str == '(')
  			{
  			  /* Skip the file number.  */
***************
*** 399,405 ****
--- 404,415 ----
  
  	  for (t = incl_entry->totals; t != NULL; t = t->next)
  	    if (t->total == val)
+               {
+                 if (t->len == len)
                    break;
+                 else
+                   fprintf(stderr, "would have thrown away INCL\n");
+               }
  
  	  /* Record this symbol, so that we can set the value
  	     correctly.  */
***************
*** 409,414 ****
--- 419,425 ----
  	    goto error_return;
  	  ne->offset = sym - stabbuf;
  	  ne->val = val;
+       ne->len = len;
  	  ne->type = (int) N_BINCL;
  	  ne->next = secinfo->excls;
  	  secinfo->excls = ne;
***************
*** 422,427 ****
--- 433,439 ----
  	      if (t == NULL)
  		goto error_return;
  	      t->total = val;
+           t->len = len;
  	      t->next = incl_entry->totals;
  	      incl_entry->totals = t;
  	    }
***************
*** 456,461 ****
--- 468,475 ----
  		    }
  		  else if (incl_type == (int) N_BINCL)
  		    ++nest;
+             else if (incl_type == (int) N_EXCL)
+               continue;   /* keep existing exclusion marks */
  		  else if (nest == 0)
  		    {
  		      *incl_pstridx = (bfd_size_type) -1;



-- 
Andy, BlueArc Engineering 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]