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]

Re: [PATCH] Indicate dependency on personality routines for ARM EHABI


Hi,

This version of the patch uses BFD_RELOC_NONE instead of BFD_RELOC_ARM_NONE, and changes the existing use of BFD_RELOC_NONE in gas/config/tc-arm.c to use BFD_RELOC_UNUSED instead to prevent conflict.

Tested on arm-none-eabi and i686-pc-linux-gnu.

OK?

ChangeLog:

    * gas/config/tc-arm.c (do_t_ldmstm): Change BFD_RELOC_NONE to
    BFD_RELOC_UNUSED.
    (do_t_push_pop): Likewise.
    (md_assemble): Likewise.
    (md_apply_fix3): Handle BFD_RELOC_NONE, make BFD_RELOC_UNUSED same
    as previous meaning of BFD_RELOC_NONE.
    (create_unwind_entry): Output dependency on the required personality
    routines.
    * gas/testsuite/gas/arm/unwind.d: Alter expected output to include
    dependency on __aeabi_unwind_cpp_pr[01].

--
Julian Brown
CodeSourcery, LLC
? bfd/doc/bfd.info
? bfd/doc/bfd.info-1
? gas/doc/as.info
? gas/doc/as.info-1
Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.190
diff -c -p -r1.190 tc-arm.c
*** gas/config/tc-arm.c	31 Jan 2005 23:18:25 -0000	1.190
--- gas/config/tc-arm.c	9 Feb 2005 18:47:56 -0000
*************** do_t_ldmstm (char * str)
*** 9369,9378 ****
        return;
      }
  
!   if (inst.reloc.type != BFD_RELOC_NONE)
      {
        /* This really doesn't seem worth it.  */
!       inst.reloc.type = BFD_RELOC_NONE;
        inst.error = _("expression too complex");
        return;
      }
--- 9369,9378 ----
        return;
      }
  
!   if (inst.reloc.type != BFD_RELOC_UNUSED)
      {
        /* This really doesn't seem worth it.  */
!       inst.reloc.type = BFD_RELOC_UNUSED;
        inst.error = _("expression too complex");
        return;
      }
*************** do_t_push_pop (char * str)
*** 9461,9470 ****
        return;
      }
  
!   if (inst.reloc.type != BFD_RELOC_NONE)
      {
        /* This really doesn't seem worth it.  */
!       inst.reloc.type = BFD_RELOC_NONE;
        inst.error = _("expression too complex");
        return;
      }
--- 9461,9470 ----
        return;
      }
  
!   if (inst.reloc.type != BFD_RELOC_UNUSED)
      {
        /* This really doesn't seem worth it.  */
!       inst.reloc.type = BFD_RELOC_UNUSED;
        inst.error = _("expression too complex");
        return;
      }
*************** md_apply_fix3 (fixS *   fixP,
*** 11361,11367 ****
    char *         buf = fixP->fx_where + fixP->fx_frag->fr_literal;
    arm_fix_data * arm_data = (arm_fix_data *) fixP->tc_fix_data;
  
!   assert (fixP->fx_r_type < BFD_RELOC_UNUSED);
  
    /* Note whether this will delete the relocation.  */
    if (fixP->fx_addsy == 0 && !fixP->fx_pcrel)
--- 11361,11367 ----
    char *         buf = fixP->fx_where + fixP->fx_frag->fr_literal;
    arm_fix_data * arm_data = (arm_fix_data *) fixP->tc_fix_data;
  
!   assert (fixP->fx_r_type <= BFD_RELOC_UNUSED);
  
    /* Note whether this will delete the relocation.  */
    if (fixP->fx_addsy == 0 && !fixP->fx_pcrel)
*************** md_apply_fix3 (fixS *   fixP,
*** 11383,11388 ****
--- 11383,11393 ----
  
    switch (fixP->fx_r_type)
      {
+     case BFD_RELOC_NONE:
+       /* This will need to go in the object file.  */
+       fixP->fx_done = 0;
+       break;
+   
      case BFD_RELOC_ARM_IMMEDIATE:
        /* We claim that this fixup has been processed here,
  	 even if in fact we generate an error because we do
*************** md_apply_fix3 (fixS *   fixP,
*** 12050,12056 ****
        fixP->fx_done = 0;
        return;
  
!     case BFD_RELOC_NONE:
      default:
        as_bad_where (fixP->fx_file, fixP->fx_line,
  		    _("bad relocation fixup type (%d)"), fixP->fx_r_type);
--- 12055,12061 ----
        fixP->fx_done = 0;
        return;
  
!     case BFD_RELOC_UNUSED:
      default:
        as_bad_where (fixP->fx_file, fixP->fx_line,
  		    _("bad relocation fixup type (%d)"), fixP->fx_r_type);
*************** tc_gen_reloc (asection * section ATTRIBU
*** 12106,12111 ****
--- 12111,12117 ----
  	  break;
  	}
  
+     case BFD_RELOC_NONE:
      case BFD_RELOC_ARM_PCREL_BRANCH:
      case BFD_RELOC_ARM_PCREL_BLX:
      case BFD_RELOC_RVA:
*************** tc_gen_reloc (asection * section ATTRIBU
*** 12170,12175 ****
--- 12176,12182 ----
  
  	switch (fixp->fx_r_type)
  	  {
+ 	  case BFD_RELOC_NONE:		   type = "NONE";         break;
  	  case BFD_RELOC_ARM_OFFSET_IMM8:  type = "OFFSET_IMM8";  break;
  	  case BFD_RELOC_ARM_SHIFT_IMM:    type = "SHIFT_IMM";    break;
  	  case BFD_RELOC_ARM_SMI:          type = "SMI";          break;
*************** output_inst (const char * str)
*** 12293,12299 ****
    else
      md_number_to_chars (to, inst.instruction, inst.size);
  
!   if (inst.reloc.type != BFD_RELOC_NONE)
      fix_new_arm (frag_now, to - frag_now->fr_literal,
  		 inst.size, & inst.reloc.exp, inst.reloc.pc_rel,
  		 inst.reloc.type);
--- 12300,12306 ----
    else
      md_number_to_chars (to, inst.instruction, inst.size);
  
!   if (inst.reloc.type != BFD_RELOC_UNUSED)
      fix_new_arm (frag_now, to - frag_now->fr_literal,
  		 inst.size, & inst.reloc.exp, inst.reloc.pc_rel,
  		 inst.reloc.type);
*************** md_assemble (char * str)
*** 12319,12325 ****
      }
  
    memset (&inst, '\0', sizeof (inst));
!   inst.reloc.type = BFD_RELOC_NONE;
  
    skip_whitespace (str);
  
--- 12326,12332 ----
      }
  
    memset (&inst, '\0', sizeof (inst));
!   inst.reloc.type = BFD_RELOC_UNUSED;
  
    skip_whitespace (str);
  
*************** create_unwind_entry (int have_data)
*** 13893,13898 ****
--- 13900,13913 ----
        /* Custom personality routine.  */
        fix_new (frag_now, where, 4, unwind.personality_routine, 0, 1,
  	       BFD_RELOC_ARM_PREL31);
+ 
+       /* Indicate dependency to linker.  */
+         {
+           char *name = "__aeabi_unwind_cpp_pr0";
+ 	  symbolS *pr = symbol_find_or_make (name);
+ 	  fix_new (frag_now, where, 4, pr, 0, 1, BFD_RELOC_NONE);
+ 	}
+ 
        where += 4;
        ptr += 4;
  
*************** create_unwind_entry (int have_data)
*** 13902,13919 ****
        break;
  
      /* ABI defined personality routines.  */
-     /* TODO: Emit R_ARM_NONE to the personality routine.  */
      case 0:
        /* Three opcodes bytes are packed into the first word.  */
        data = 0x80;
        n = 3;
!       break;
  
      case 1:
      case 2:
        /* The size and first two opcode bytes go in the first word.  */
        data = ((0x80 + unwind.personality_index) << 8) | size;
        n = 2;
        break;
  
      default:
--- 13917,13944 ----
        break;
  
      /* ABI defined personality routines.  */
      case 0:
        /* Three opcodes bytes are packed into the first word.  */
        data = 0x80;
        n = 3;
!       goto emit_reloc;
  
      case 1:
      case 2:
        /* The size and first two opcode bytes go in the first word.  */
        data = ((0x80 + unwind.personality_index) << 8) | size;
        n = 2;
+       goto emit_reloc;
+ 
+     emit_reloc:
+       {
+ 	/* Indicate dependency to linker.  */
+ 	char *name[] = { "__aeabi_unwind_cpp_pr0",
+ 	                 "__aeabi_unwind_cpp_pr1",
+ 			 "__aeabi_unwind_cpp_pr2" };
+ 	symbolS *pr = symbol_find_or_make (name[unwind.personality_index]);
+ 	fix_new (frag_now, where, 4, pr, 0, 1, BFD_RELOC_NONE);
+       }
        break;
  
      default:
Index: gas/testsuite/gas/arm/unwind.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/arm/unwind.d,v
retrieving revision 1.3
diff -c -p -r1.3 unwind.d
*** gas/testsuite/gas/arm/unwind.d	9 Dec 2004 20:25:24 -0000	1.3
--- gas/testsuite/gas/arm/unwind.d	9 Feb 2005 18:48:11 -0000
***************
*** 5,11 ****
--- 5,14 ----
  
  RELOCATION RECORDS FOR \[.ARM.extab\]:
  OFFSET   TYPE              VALUE 
+ 00000000 R_ARM_NONE        __aeabi_unwind_cpp_pr1
  0000000c R_ARM_PREL31      .text
+ 0000000c R_ARM_NONE        __aeabi_unwind_cpp_pr0
+ 0000001c R_ARM_NONE        __aeabi_unwind_cpp_pr1
  
  
  RELOCATION RECORDS FOR \[.ARM.exidx\]:

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