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] Make debug info section relative on IA64


This is a change to make debug sections relative on IA64.  The person
who made this change isn't around anymore but here is her description of
the problem that this patch fixes, if this looks good could someone
check it in for me?

Steve Ellcey
sje at cup dot hp dot com

>     We are having a problem where GAS is putting in incorrect
> relocations for .debug_abbrev, .debug_info, and .debug_line
> when they are referenced as offsets.  This problem only happens
> with assembly files that contain no debug information and
> the file is assembled with GAS with the option --gdwarf2.
> In the object file, there will be debug information but the
> offsets which correspond to .debug_abbrev, .debug_info, and
> .debug_line will have relocations of DIR32MSB on HP-UX (and
> DIR64LSB on Linux).
> 
>     This severly confuses the HP linker when performing relocations
> and the result is an executable with cannot be debugged.   I spoke
> with someone on our Linker team and it looks like .debug_abbrev,
> .debug_info, and .debug_line should be section relative offsets
> (i.e. SECREL32MSB).   We fixed this once for 'C' files by forcing
> GCC to put out correct assembler directives to make these section
> relative offsets.  However, an assembly file with no debug information
> in it will not have these directives.  I made a code change in
> ia64_cons_fix_new()
> in tc-ia64.c which fixes this problem.


2003-02-27  Steve Ellcey  <sje at cup dot hp dot com>

	* config/tc-ia64.c: Make debug sections relative.


*** src.orig/gas/config/tc-ia64.c	Thu Feb 27 12:56:58 2003
--- src/gas/config/tc-ia64.c	Thu Feb 27 12:57:42 2003
*************** ia64_cons_fix_new (f, where, nbytes, exp
*** 10055,10063 ****
      case 2: code = BFD_RELOC_16; break;
      case 4:
        if (target_big_endian)
! 	code = BFD_RELOC_IA64_DIR32MSB;
        else
! 	code = BFD_RELOC_IA64_DIR32LSB;
        break;
  
      case 8:
--- 10055,10081 ----
      case 2: code = BFD_RELOC_16; break;
      case 4:
        if (target_big_endian)
! 	{
! 	  if (exp->X_op == O_symbol &&
! 	      exp->X_add_symbol &&
! 	      (!strcmp(S_GET_NAME(exp->X_add_symbol),".debug_abbrev") ||
! 	       !strcmp(S_GET_NAME(exp->X_add_symbol),".debug_line") ||
! 	       !strcmp(S_GET_NAME(exp->X_add_symbol),".debug_info")))
! 	    code = BFD_RELOC_IA64_SECREL32MSB;
! 	  else	
! 	    code = BFD_RELOC_IA64_DIR32MSB;
! 	}
        else
! 	{
! 	  if (exp->X_op == O_symbol &&
! 	      exp->X_add_symbol &&
! 	      (!strcmp(S_GET_NAME(exp->X_add_symbol),".debug_abbrev") ||
! 	       !strcmp(S_GET_NAME(exp->X_add_symbol),".debug_line") ||
! 	       !strcmp(S_GET_NAME(exp->X_add_symbol),".debug_info")))
! 	    code = BFD_RELOC_IA64_SECREL32LSB;
! 	  else	
! 	    code = BFD_RELOC_IA64_DIR32LSB;
! 	}
        break;
  
      case 8:
*************** ia64_cons_fix_new (f, where, nbytes, exp
*** 10086,10095 ****
  	}
        else
  	{
! 	  if (target_big_endian)
! 	    code = BFD_RELOC_IA64_DIR64MSB;
  	  else
! 	    code = BFD_RELOC_IA64_DIR64LSB;
  	  break;
  	}
  
--- 10104,10131 ----
  	}
        else
  	{
! 	  if (target_big_endian) 
! 	    {
! 	      if (exp->X_op == O_symbol &&
! 		  exp->X_add_symbol &&
! 		  (!strcmp(S_GET_NAME(exp->X_add_symbol),".debug_abbrev") ||
! 		   !strcmp(S_GET_NAME(exp->X_add_symbol),".debug_line") ||
! 		   !strcmp(S_GET_NAME(exp->X_add_symbol),".debug_info")))
! 		code = BFD_RELOC_IA64_SECREL64MSB;
! 	      else
! 		code = BFD_RELOC_IA64_DIR64MSB;
! 	    }
  	  else
! 	    {
! 	      if (exp->X_op == O_symbol &&
! 		  exp->X_add_symbol &&
! 		  (!strcmp(S_GET_NAME(exp->X_add_symbol),".debug_abbrev") ||
! 		   !strcmp(S_GET_NAME(exp->X_add_symbol),".debug_line") ||
! 		   !strcmp(S_GET_NAME(exp->X_add_symbol),".debug_info")))
! 		code = BFD_RELOC_IA64_SECREL64LSB;
! 	      else
! 		code = BFD_RELOC_IA64_DIR64LSB;
! 	    }
  	  break;
  	}
  


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