public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: objdump --debug and COFF weak functions
@ 2000-06-24 15:53 Mark E.
  0 siblings, 0 replies; 6+ messages in thread
From: Mark E. @ 2000-06-24 15:53 UTC (permalink / raw)
  To: binutils

> 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

Grrrr, a ChangeLog would be nice.

binutils/Changelog:
2000-06-24 Mark Elbrecht <snowball3@bigfoot.com>

	* rdcoff (parse_coff_symbol): Treat weak symbols as external.
	  (external_coff_symbol_p): New function.
	  (parse_coff): Use it. Also, guard C_ALIAS and C_LINE from PE.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: objdump --debug and COFF weak functions
@ 2000-06-25  9:40 Nick Clifton
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Clifton @ 2000-06-25  9:40 UTC (permalink / raw)
  To: snowball3; +Cc: binutils

Hi Mark,

: 2000-06-24 Mark Elbrecht <snowball3@bigfoot.com>
: 
: 	* rdcoff (parse_coff_symbol): Treat GNU weak symbols as external.
: 	  (external_coff_symbol_p): New function.
: 	  (parse_coff): Use it.

Accepted and applied.  Thanks.

Cheers
	Nick

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: objdump --debug and COFF weak functions
@ 2000-06-24 16:48 Mark E.
  0 siblings, 0 replies; 6+ messages in thread
From: Mark E. @ 2000-06-24 16:48 UTC (permalink / raw)
  To: binutils

Ok, if using COFF_WITH_PE won't work, let's try this then:

binutils/Changelog:
2000-06-24 Mark Elbrecht <snowball3@bigfoot.com>

	* rdcoff (parse_coff_symbol): Treat GNU weak symbols as external.
	  (external_coff_symbol_p): New function.
	  (parse_coff): Use it.

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 23:39:02
*************** 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));
  
\f

  /* Return the slot for a type.  */
  
*************** parse_coff_symbol (abfd, types, sym, cof
*** 589,594 ****
--- 591,597 ----
        break;
  
      case C_EXT:
+     case C_WEAKEXT:
        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 ****
--- 659,678 ----
    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:
+         return true;
+     }
+   return false;         
+ }
+ 
  /* This is the main routine.  It looks through all the symbols and
     handles them.  */
  
*************** parse_coff (abfd, syms, symcount, dhandl
*** 767,772 ****
--- 784,790 ----
  	  if (syment.n_type == T_NULL)
  	    break;
  	  /* Fall through.  */
+ 	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;
  
--- 823,829 ----
  		return false;
  
  	      if (! debug_record_function (dhandle, fnname, type,
! 					   external_coff_symbol_p (fnclass),
  					   bfd_asymbol_value (sym)))
  		return false;
  

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: objdump --debug and COFF weak functions
  2000-06-24 15:48 ` Ian Lance Taylor
@ 2000-06-24 16:48   ` Mark E.
  0 siblings, 0 replies; 6+ messages in thread
From: Mark E. @ 2000-06-24 16:48 UTC (permalink / raw)
  To: Ian Lance Taylor, binutils

> This is not true of binutils/rdcoff.c.  It is only compiled once, in
> the same way.  A #ifdef test here is meaningless.

Thanks. I'll just delete the conditionals then. I believe the PE targets 
default to stabs, so no big loss.

Does anyone know if C_ALIAS, the class that C_NT_WEAK clashes with, is still 
in use by an active target?

Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: objdump --debug and COFF weak functions
  2000-06-24 15:45 Mark E.
@ 2000-06-24 15:48 ` Ian Lance Taylor
  2000-06-24 16:48   ` Mark E.
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Lance Taylor @ 2000-06-24 15:48 UTC (permalink / raw)
  To: snowball3; +Cc: binutils

   From: "Mark E." <snowball3@bigfoot.com>
   Date: Sat, 24 Jun 2000 18:45:17 -0400

   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.

That doesn't work, though.

bfd/coffcode.h is included by many coff-*.c files with differing
definitions.  It is compiled differently for each different COFF
target.

This is not true of binutils/rdcoff.c.  It is only compiled once, in
the same way.  A #ifdef test here is meaningless.

Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* objdump --debug and COFF weak functions
@ 2000-06-24 15:45 Mark E.
  2000-06-24 15:48 ` Ian Lance Taylor
  0 siblings, 1 reply; 6+ messages in thread
From: Mark E. @ 2000-06-24 15:45 UTC (permalink / raw)
  To: binutils

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));
  
\f

  /* 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;
  


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-06-25  9:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-24 15:53 objdump --debug and COFF weak functions Mark E.
  -- strict thread matches above, loose matches on Subject: below --
2000-06-25  9:40 Nick Clifton
2000-06-24 16:48 Mark E.
2000-06-24 15:45 Mark E.
2000-06-24 15:48 ` Ian Lance Taylor
2000-06-24 16:48   ` Mark E.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).