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]

[PATCH] BFD handling of line number stabs outside of functions


GAS emits line number stabs with absolute addresses when it doesn't know the 
start of the current function.  Currently BFD always reads these stabs as 
having addresses relative to the start of the current function.  This patch 
fixes the problem.  This is essentially the same change as my previous patch 
for the stabs code in binutils 
(http://sources.redhat.com/ml/binutils/2003-02/msg00190.html).

2003-02-13  Bob Wilson  <bob.wilson@acm.org>

	* syms.c (_bfd_stab_section_find_nearest_line): For line number stabs
	outside of functions, treat values as absolute addresses.

Index: syms.c
===================================================================
RCS file: /cvs/src/src/bfd/syms.c,v
retrieving revision 1.27
diff -c -3 -r1.27 syms.c
*** syms.c	30 Nov 2002 08:39:40 -0000	1.27
--- syms.c	12 Feb 2003 22:21:18 -0000
***************
*** 1305,1313 ****
  	case N_SLINE:
  	case N_DSLINE:
  	case N_BSLINE:
! 	  /* A line number.  The value is relative to the start of the
!              current function.  */
! 	  val = indexentry->val + bfd_get_32 (abfd, stab + VALOFF);
  	  /* If this line starts before our desired offset, or if it's
  	     the first line we've been able to find, use it.  The
  	     !saw_line check works around a bug in GCC 2.95.3, which emits
--- 1305,1315 ----
  	case N_SLINE:
  	case N_DSLINE:
  	case N_BSLINE:
! 	  /* A line number.  If the function was specified, then the value
! 	     is relative to the start of the function.  Otherwise, the
! 	     value is an absolute address.  */
! 	  val = ((indexentry->function_name ? indexentry->val : 0)
! 		 + bfd_get_32 (abfd, stab + VALOFF));
  	  /* If this line starts before our desired offset, or if it's
  	     the first line we've been able to find, use it.  The
  	     !saw_line check works around a bug in GCC 2.95.3, which emits

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