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]

Re: The ia64 linker problems.


> Should I try to create an internal reloc with no corresponding external
> reloc?

I got a little distracted by other stuff, but this turned out to be easier
than I expected once I understood how the code worked.  The code was already
OK (my comments otherwise were incorrect), so all I had to do was change 3
places to use BFD_RELOC_UNUSED instead of 0, and then mark the reloc as done
to avoid a segfault.

2001-02-13  Jim Wilson  <wilson@redhat.com>

	* config/tc-ia64.c (operand_match, case TAG13): Make a BFD_RELOC_UNUSED
	reloc instead of a 0 reloc.
	(md_apply_fix3): Check for BFD_RELOC_UNUSED instead of 0, and mark it
	as done.
	* config/tc-ia64.h (TC_RELOC_RTSYM_LOC_FIXUP): Likewise.

Index: tc-ia64.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ia64.c,v
retrieving revision 1.41
diff -p -r1.41 tc-ia64.c
*** tc-ia64.c	2001/02/10 01:42:04	1.41
--- tc-ia64.c	2001/02/14 01:42:07
*************** operand_match (idesc, index, e)
*** 5165,5171 ****
  
  	case O_symbol:
  	  fix = CURR_SLOT.fixup + CURR_SLOT.num_fixups;
! 	  fix->code = ia64_gen_real_reloc_type (e->X_op_symbol, 0);
  	  fix->opnd = idesc->operands[index];
  	  fix->expr = *e;
  	  fix->is_pcrel = 1;
--- 5165,5174 ----
  
  	case O_symbol:
  	  fix = CURR_SLOT.fixup + CURR_SLOT.num_fixups;
! 	  /* There are no external relocs for TAG13/TAG13b fields, so we
! 	     create a dummy reloc.  This will not live past md_apply_fix3.  */
! 	  fix->code = BFD_RELOC_UNUSED;
! 	  fix->code = ia64_gen_real_reloc_type (e->X_op_symbol, fix->code);
  	  fix->opnd = idesc->operands[index];
  	  fix->expr = *e;
  	  fix->is_pcrel = 1;
*************** md_apply_fix3 (fix, valuep, seg)
*** 9804,9819 ****
      }
    if (fix->fx_addsy)
      {
!       switch (fix->fx_r_type)
  	{
! 	case 0:
  	  as_bad_where (fix->fx_file, fix->fx_line,
  			"%s must have a constant value",
  			elf64_ia64_operands[fix->tc_fix_data.opnd].desc);
! 	  break;
! 
! 	default:
! 	  break;
  	}
  
        /* ??? This is a hack copied from tc-i386.c to make PCREL relocs
--- 9807,9821 ----
      }
    if (fix->fx_addsy)
      {
!       if (fix->fx_r_type == (int) BFD_RELOC_UNUSED)
  	{
! 	  /* This must be a TAG13 or TAG13b operand.  There are no external
! 	     relocs defined for them, so we must give an error.  */
  	  as_bad_where (fix->fx_file, fix->fx_line,
  			"%s must have a constant value",
  			elf64_ia64_operands[fix->tc_fix_data.opnd].desc);
! 	  fix->fx_done = 1;
! 	  return 1;
  	}
  
        /* ??? This is a hack copied from tc-i386.c to make PCREL relocs
Index: tc-ia64.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ia64.h,v
retrieving revision 1.9
diff -p -r1.9 tc-ia64.h
*** tc-ia64.h	2001/02/10 01:42:04	1.9
--- tc-ia64.h	2001/02/14 01:42:07
*************** typedef struct unwind_record
*** 252,260 ****
     True if we are willing to perform this relocation while building
     the .o file.  This is only used for pcrel relocations.  */
  
  #define TC_RELOC_RTSYM_LOC_FIXUP(FIX)				\
    ((FIX)->fx_addsy == NULL					\
!    || (FIX)->fx_r_type == 0					\
     || (! S_IS_EXTERNAL ((FIX)->fx_addsy)			\
         && ! S_IS_WEAK ((FIX)->fx_addsy)				\
         && S_IS_DEFINED ((FIX)->fx_addsy)			\
--- 252,263 ----
     True if we are willing to perform this relocation while building
     the .o file.  This is only used for pcrel relocations.  */
  
+ /* If the reloc type is BFD_RELOC_UNUSED, then this is for a TAG13/TAG13b field
+    which has no external reloc, so we must resolve the value now.  */
+ 
  #define TC_RELOC_RTSYM_LOC_FIXUP(FIX)				\
    ((FIX)->fx_addsy == NULL					\
!    || (FIX)->fx_r_type == BFD_RELOC_UNUSED			\
     || (! S_IS_EXTERNAL ((FIX)->fx_addsy)			\
         && ! S_IS_WEAK ((FIX)->fx_addsy)				\
         && S_IS_DEFINED ((FIX)->fx_addsy)			\


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