This is the mail archive of the binutils@sourceware.cygnus.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]

objdump --debug and COFF weak functions


Hi folks,
I discovered that 'objdump --debug' can't handle functions with the weak attribute. It 
gives this error message:
c:/djgpp/bin/objdump.exe: 2841: .bf without preceding function

builtin.o:     file format coff-go32

Below is a patch that fixes it for me. In case you're wondering, I used the 
COFF_WITH_PE guards like in bfd/coffcode.h since C_NT_WEAK clashes with another C_* 
symbol.

Index: src/binutils/rdcoff.c
===================================================================
RCS file: /cvs/src/src/binutils/rdcoff.c,v
retrieving revision 1.3
diff -c -p -r1.3 rdcoff.c
*** rdcoff.c	2000/04/07 04:34:50	1.3
--- rdcoff.c	2000/06/24 22:40:45
*************** static debug_type parse_coff_enum_type
*** 99,104 ****
--- 99,106 ----
  static boolean parse_coff_symbol
    PARAMS ((bfd *, struct coff_types *, asymbol *, long,
  	   struct internal_syment *, PTR, debug_type, boolean));
+ static boolean external_coff_symbol_p
+   PARAMS ((int sym_class));
  


  /* Return the slot for a type.  */
  
*************** parse_coff_symbol (abfd, types, sym, cof
*** 589,594 ****
--- 591,600 ----
        break;
  
      case C_EXT:
+     case C_WEAKEXT:
+ #ifdef COFF_WITH_PE
+     case C_NT_WEAK:
+ #endif
        if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
  				   DEBUG_GLOBAL, bfd_asymbol_value (sym)))
  	return false;
*************** parse_coff_symbol (abfd, types, sym, cof
*** 656,661 ****
--- 662,684 ----
    return true;				   
  }
  
+ /* Determine if a symbol has external visibility.  */
+ 
+ static boolean
+ external_coff_symbol_p (int sym_class)
+ {
+   switch (sym_class)
+     {
+       case C_EXT:
+       case C_WEAKEXT:
+ #ifdef COFF_WITH_PE
+       case C_NT_WEAK:
+ #endif
+         return true;
+     }
+   return false;         
+ }
+ 
  /* This is the main routine.  It looks through all the symbols and
     handles them.  */
  
*************** parse_coff (abfd, syms, symcount, dhandl
*** 749,756 ****
--- 772,781 ----
  	case C_EXTDEF:
  	case C_ULABEL:
  	case C_USTATIC:
+ #ifndef COFF_WITH_PE
  	case C_LINE:
  	case C_ALIAS:
+ #endif
  	case C_HIDDEN:
  	  /* Just ignore these classes.  */
  	  break;
*************** parse_coff (abfd, syms, symcount, dhandl
*** 767,772 ****
--- 792,801 ----
  	  if (syment.n_type == T_NULL)
  	    break;
  	  /* Fall through.  */
+ #ifdef COFF_WITH_PE
+ 	case C_NT_WEAK:
+ #endif
+ 	case C_WEAKEXT:
  	case C_EXT:
  	  if (ISFCN (syment.n_type))
  	    {
*************** parse_coff (abfd, syms, symcount, dhandl
*** 805,811 ****
  		return false;
  
  	      if (! debug_record_function (dhandle, fnname, type,
! 					   fnclass == C_EXT,
  					   bfd_asymbol_value (sym)))
  		return false;
  
--- 834,840 ----
  		return false;
  
  	      if (! debug_record_function (dhandle, fnname, type,
! 					   external_coff_symbol_p (fnclass),
  					   bfd_asymbol_value (sym)))
  		return false;
  



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