Kill OLD_ARM_ABI

Zack Weinberg zack@codesourcery.com
Wed May 18 06:43:00 GMT 2005


Now that the 32000 line Thumb-2 assembler patch is out of the way, I
can start in on some smaller tasks in the ARM binutils that I didn't
want to tangle up with that patch.  To start with, let's get rid of
all uses of OLD_ARM_ABI, which is defined nowhere (verified with 
find -type f).  Tested with arm-elf cross compiler:

                === binutils tests ===
                === binutils Summary ===
# of expected passes            26
# of untested testcases         7
                === gas tests ===
                === gas Summary ===
# of expected passes            121
                === ld tests ===
                === ld Summary ===
# of expected passes            81
# of expected failures          1
# of untested testcases         17

Sadly, almost all occurences are in #ifndef, not #ifdef, so we don't
get to delete much code here.

zw

        * bfd/elf32-arm.c: Make all #ifndef OLD_ARM_ABI blocks
        unconditional.
        * include/elf/arm.h: Make all #ifndef OLD_ARM_ABI blocks
        unconditional, delete all #ifdef OLD_ARM_ABI blocks.

===================================================================
Index: bfd/elf32-arm.c
--- bfd/elf32-arm.c	18 May 2005 05:40:05 -0000	1.40
+++ bfd/elf32-arm.c	18 May 2005 06:21:06 -0000
@@ -2355,10 +2355,8 @@ bfd_elf32_arm_process_before_allocation 
 	  /* These are the only relocation types we care about.  */
 	  if (   r_type != R_ARM_PC24
 	      && r_type != R_ARM_PLT32
-#ifndef OLD_ARM_ABI
 	      && r_type != R_ARM_CALL
 	      && r_type != R_ARM_JUMP24
-#endif
 	      && r_type != R_ARM_THM_CALL)
 	    continue;
 
@@ -2402,10 +2400,8 @@ bfd_elf32_arm_process_before_allocation 
 	    {
 	    case R_ARM_PC24:
 	    case R_ARM_PLT32:
-#ifndef OLD_ARM_ABI
 	    case R_ARM_CALL:
 	    case R_ARM_JUMP24:
-#endif
 	      /* This one is a call from arm code.  We need to look up
 	         the target of the call.  If it is a thumb target, we
 	         insert glue.  */
@@ -2452,7 +2448,6 @@ error_return:
 #endif
 
 
-#ifndef OLD_ARM_ABI
 /* Set target relocation values needed during linking.  */
 
 void
@@ -2481,7 +2476,6 @@ bfd_elf32_arm_set_target_relocs (struct 
   globals->fix_v4bx = fix_v4bx;
   globals->use_blx |= use_blx;
 }
-#endif
 
 /* The thumb form of a long branch is a bit finicky, because the offset
    encoding is split over two fields, each in it's own instruction. They
@@ -2752,8 +2746,6 @@ elf32_arm_to_thumb_stub (struct bfd_link
   return TRUE;
 }
 
-
-#ifndef OLD_ARM_ABI
 /* Some relocations map to different relocations depending on the
    target.  Return the real relocation.  */
 static int
@@ -2775,8 +2767,6 @@ arm_real_reloc_type (struct elf32_arm_li
       return r_type;
     }
 }
-#endif /* OLD_ARM_ABI */
-
 
 /* Return the base VMA address which should be subtracted from real addresses
    when resolving @dtpoff relocation.
@@ -2840,13 +2830,11 @@ elf32_arm_final_link_relocate (reloc_how
 
   globals = elf32_arm_hash_table (info);
 
-#ifndef OLD_ARM_ABI
   /* Some relocation type map to different relocations depending on the
      target.  We pick the right one here.  */
   r_type = arm_real_reloc_type (globals, r_type);
   if (r_type != howto->type)
     howto = elf32_arm_howto_from_type (r_type);
-#endif /* OLD_ARM_ABI */
 
   /* If the start address has been set, then set the EF_ARM_HASENTRY
      flag.  Setting this more than once is redundant, but the cost is
@@ -2898,12 +2886,10 @@ elf32_arm_final_link_relocate (reloc_how
     case R_ARM_PC24:
     case R_ARM_ABS32:
     case R_ARM_REL32:
-#ifndef OLD_ARM_ABI
     case R_ARM_CALL:
     case R_ARM_JUMP24:
     case R_ARM_XPC25:
     case R_ARM_PREL31:
-#endif
     case R_ARM_PLT32:
       /* r_symndx will be zero only for relocs against symbols
 	 from removed linkonce sections, or sections discarded by
@@ -2945,11 +2931,9 @@ elf32_arm_final_link_relocate (reloc_how
 	      || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
 	      || h->root.type != bfd_link_hash_undefweak)
 	  && r_type != R_ARM_PC24
-#ifndef OLD_ARM_ABI
 	  && r_type != R_ARM_CALL
 	  && r_type != R_ARM_JUMP24
 	  && r_type != R_ARM_PREL31
-#endif
 	  && r_type != R_ARM_PLT32)
 	{
 	  Elf_Internal_Rela outrel;
@@ -3047,14 +3031,11 @@ elf32_arm_final_link_relocate (reloc_how
 	}
       else switch (r_type)
 	{
-#ifndef OLD_ARM_ABI
 	case R_ARM_XPC25:	  /* Arm BLX instruction.  */
 	case R_ARM_CALL:
 	case R_ARM_JUMP24:
-#endif
 	case R_ARM_PC24:	  /* Arm B/BL instruction */
 	case R_ARM_PLT32:
-#ifndef OLD_ARM_ABI
 	  if (r_type == R_ARM_XPC25)
 	    {
 	      /* Check for Arm calling Arm function.  */
@@ -3067,7 +3048,6 @@ elf32_arm_final_link_relocate (reloc_how
 		   h ? h->root.root.string : "(local)");
 	    }
 	  else
-#endif
 	    {
 	      /* Check for Arm calling Thumb function.  */
 	      if (sym_flags == STT_ARM_TFUNC)
@@ -3123,14 +3103,12 @@ elf32_arm_final_link_relocate (reloc_how
 		return bfd_reloc_overflow;
 	    }
 
-#ifndef OLD_ARM_ABI
 	  /* If necessary set the H bit in the BLX instruction.  */
 	  if (r_type == R_ARM_XPC25 && ((value & 2) == 2))
 	    value = (signed_addend & howto->dst_mask)
 	      | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask))
 	      | (1 << 24);
 	  else
-#endif
 	    value = (signed_addend & howto->dst_mask)
 	      | (bfd_get_32 (input_bfd, hit_data) & (~ howto->dst_mask));
 	  break;
@@ -3147,7 +3125,6 @@ elf32_arm_final_link_relocate (reloc_how
 	  value += addend;
 	  break;
 
-#ifndef OLD_ARM_ABI
 	case R_ARM_PREL31:
 	  value -= (input_section->output_section->vma
 		    + input_section->output_offset + rel->r_offset);
@@ -3163,7 +3140,6 @@ elf32_arm_final_link_relocate (reloc_how
 	  if (sym_flags == STT_ARM_TFUNC)
 	    value |= 1;
 	  break;
-#endif
 	}
 
       bfd_put_32 (input_bfd, value, hit_data);
@@ -3218,9 +3194,7 @@ elf32_arm_final_link_relocate (reloc_how
       bfd_put_16 (input_bfd, value, hit_data);
       return bfd_reloc_ok;
 
-#ifndef OLD_ARM_ABI
     case R_ARM_THM_XPC22:
-#endif
     case R_ARM_THM_CALL:
       /* Thumb BL (branch long instruction).  */
       {
@@ -3244,7 +3218,7 @@ elf32_arm_final_link_relocate (reloc_how
 	    addend = (upper << 12) | (lower << 1);
 	    signed_addend = addend;
 	  }
-#ifndef OLD_ARM_ABI
+
 	if (r_type == R_ARM_THM_XPC22)
 	  {
 	    /* Check for Thumb to Thumb call.  */
@@ -3257,7 +3231,6 @@ elf32_arm_final_link_relocate (reloc_how
 		 h ? h->root.root.string : "(local)");
 	  }
 	else
-#endif
 	  {
 	    /* If it is not a call to Thumb, assume call to Arm.
 	       If it is a call relative to a section name, then it is not a
@@ -3317,7 +3290,6 @@ elf32_arm_final_link_relocate (reloc_how
 	if (signed_check > reloc_signed_max || signed_check < reloc_signed_min)
 	  overflow = TRUE;
 
-#ifndef OLD_ARM_ABI
 	if ((r_type == R_ARM_THM_XPC22
 	     && ((lower_insn & 0x1800) == 0x0800))
 	    || thumb_plt_call)
@@ -3326,7 +3298,7 @@ elf32_arm_final_link_relocate (reloc_how
 	     which specifies that bit 1 of the target address will come from bit
 	     1 of the base address.  */
 	  relocation = (relocation + 2) & ~ 3;
-#endif
+
 	/* Put RELOCATION back into the insn.  */
 	upper_insn = (upper_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 12) & 0x7ff);
 	lower_insn = (lower_insn & ~(bfd_vma) 0x7ff) | ((relocation >> 1) & 0x7ff);
@@ -3538,7 +3510,6 @@ elf32_arm_final_link_relocate (reloc_how
 	return bfd_reloc_ok;
       }
 
-#ifndef OLD_ARM_ABI
     case R_ARM_ALU_PCREL7_0:
     case R_ARM_ALU_PCREL15_8:
     case R_ARM_ALU_PCREL23_15:
@@ -3564,7 +3535,6 @@ elf32_arm_final_link_relocate (reloc_how
 	bfd_put_32 (input_bfd, value, hit_data);
       }
       return bfd_reloc_ok;
-#endif
 
     case R_ARM_GNU_VTINHERIT:
     case R_ARM_GNU_VTENTRY:
@@ -3608,9 +3578,7 @@ elf32_arm_final_link_relocate (reloc_how
 				       (bfd_vma) 0);
 
     case R_ARM_GOT32:
-#ifndef OLD_ARM_ABI
     case R_ARM_GOT_PREL:
-#endif
       /* Relocation is to the entry for this symbol in the
          global offset table.  */
       if (sgot == NULL)
@@ -4007,10 +3975,8 @@ arm_add_to_rel (bfd *              abfd,
 
 	case R_ARM_PC24:
 	case R_ARM_PLT32:
-#ifndef OLD_ARM_ABI
 	case R_ARM_CALL:
 	case R_ARM_JUMP24:
-#endif
 	  addend <<= howto->size;
 	  addend += increment;
 
@@ -4820,15 +4786,11 @@ elf32_arm_gc_sweep_hook (bfd *          
 	}
 
       r_type = ELF32_R_TYPE (rel->r_info);
-#ifndef OLD_ARM_ABI
       r_type = arm_real_reloc_type (globals, r_type);
-#endif
       switch (r_type)
 	{
 	case R_ARM_GOT32:
-#ifndef OLD_ARM_ABI
 	case R_ARM_GOT_PREL:
-#endif
 	case R_ARM_TLS_GD32:
 	case R_ARM_TLS_IE32:
 	  if (h != NULL)
@@ -4851,11 +4813,9 @@ elf32_arm_gc_sweep_hook (bfd *          
 	case R_ARM_REL32:
 	case R_ARM_PC24:
 	case R_ARM_PLT32:
-#ifndef OLD_ARM_ABI
 	case R_ARM_CALL:
 	case R_ARM_JUMP24:
 	case R_ARM_PREL31:
-#endif
 	case R_ARM_THM_CALL:
 	  /* Should the interworking branches be here also?  */
 
@@ -4952,9 +4912,7 @@ elf32_arm_check_relocs (bfd *abfd, struc
 
       r_symndx = ELF32_R_SYM (rel->r_info);
       r_type = ELF32_R_TYPE (rel->r_info);
-#ifndef OLD_ARM_ABI
       r_type = arm_real_reloc_type (htab, r_type);
-#endif
 
       if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr))
 	{
@@ -4973,9 +4931,7 @@ elf32_arm_check_relocs (bfd *abfd, struc
       switch (r_type)
         {
 	  case R_ARM_GOT32:
-#ifndef OLD_ARM_ABI
 	  case R_ARM_GOT_PREL:
-#endif
 	  case R_ARM_TLS_GD32:
 	  case R_ARM_TLS_IE32:
 	    /* This symbol requires a global offset table entry.  */
@@ -5055,11 +5011,9 @@ elf32_arm_check_relocs (bfd *abfd, struc
 	  case R_ARM_REL32:
 	  case R_ARM_PC24:
 	  case R_ARM_PLT32:
-#ifndef OLD_ARM_ABI
 	  case R_ARM_CALL:
 	  case R_ARM_JUMP24:
 	  case R_ARM_PREL31:
-#endif
 	  case R_ARM_THM_CALL:
 	    /* Should the interworking branches be listed here?  */
 	    if (h != NULL)
@@ -5078,11 +5032,9 @@ elf32_arm_check_relocs (bfd *abfd, struc
 		   sure yet, because something later might force the
 		   symbol local.  */
 		if (r_type == R_ARM_PC24
-#ifndef OLD_ARM_ABI
 		    || r_type == R_ARM_CALL
 		    || r_type == R_ARM_JUMP24
 		    || r_type == R_ARM_PREL31
-#endif
 		    || r_type == R_ARM_PLT32
 		    || r_type == R_ARM_THM_CALL)
 		  h->needs_plt = 1;
===================================================================
Index: include/elf/arm.h
--- include/elf/arm.h	18 May 2005 05:40:10 -0000	1.24
+++ include/elf/arm.h	18 May 2005 06:21:07 -0000
@@ -89,7 +89,6 @@ START_RELOC_NUMBERS (elf_arm_reloc_type)
   RELOC_NUMBER (R_ARM_PC24,            	  1)   /* deprecated */
   RELOC_NUMBER (R_ARM_ABS32,           	  2)
   RELOC_NUMBER (R_ARM_REL32,           	  3)
-#ifndef OLD_ARM_ABI
   RELOC_NUMBER (R_ARM_LDR_PC_G0,       	  4)
   RELOC_NUMBER (R_ARM_ABS16,           	  5)
   RELOC_NUMBER (R_ARM_ABS12,           	  6)
@@ -101,19 +100,6 @@ START_RELOC_NUMBERS (elf_arm_reloc_type)
   RELOC_NUMBER (R_ARM_BREL_ADJ,	       	 12)
   RELOC_NUMBER (R_ARM_SWI24,           	 13)   /* obsolete */
   RELOC_NUMBER (R_ARM_THM_SWI8,        	 14)   /* obsolete */
-#else
-  RELOC_NUMBER (R_ARM_ABS8,            	  4)
-  RELOC_NUMBER (R_ARM_ABS16,           	  5)
-  RELOC_NUMBER (R_ARM_ABS12,           	  6)
-  RELOC_NUMBER (R_ARM_THM_ABS5,        	  7)
-  RELOC_NUMBER (R_ARM_THM_CALL,        	  8)
-  RELOC_NUMBER (R_ARM_SBREL32,         	  9)
-  RELOC_NUMBER (R_ARM_BREL_ADJ,        	 10)
-  RELOC_NUMBER (R_ARM_THM_JUMP11,      	 11)
-  RELOC_NUMBER (R_ARM_THM_JUMP8,       	 12)
-  RELOC_NUMBER (R_ARM_GNU_VTINHERIT,   	 13)
-  RELOC_NUMBER (R_ARM_GNU_VTENTRY,     	 14)
-#endif
   RELOC_NUMBER (R_ARM_XPC25,           	 15)   /* obsolete */
   RELOC_NUMBER (R_ARM_THM_XPC22,       	 16)   /* obsolete */
   RELOC_NUMBER (R_ARM_TLS_DTPMOD32,    	 17)
@@ -196,12 +182,10 @@ START_RELOC_NUMBERS (elf_arm_reloc_type)
   RELOC_NUMBER (R_ARM_GOT_BREL12,      	 97)
   RELOC_NUMBER (R_ARM_GOTOFF12,	       	 98)
   RELOC_NUMBER (R_ARM_GOTRELAX,	       	 99)
-#ifndef OLD_ARM_ABI
   RELOC_NUMBER (R_ARM_GNU_VTENTRY,    	100)   /* deprecated - old C++ abi */
   RELOC_NUMBER (R_ARM_GNU_VTINHERIT,  	101)   /* deprecated - old C++ abi */
   RELOC_NUMBER (R_ARM_THM_JUMP11,     	102)
   RELOC_NUMBER (R_ARM_THM_JUMP8,      	103)
-#endif
   RELOC_NUMBER (R_ARM_TLS_GD32,	      	104)
   RELOC_NUMBER (R_ARM_TLS_LDM32,      	105)
   RELOC_NUMBER (R_ARM_TLS_LDO32,      	106)
@@ -234,9 +218,7 @@ START_RELOC_NUMBERS (elf_arm_reloc_type)
   FAKE_RELOC (R_ARM_GOT32,              R_ARM_GOT_BREL)   /* 32 bit GOT entry.  */
   FAKE_RELOC (R_ARM_ROSEGREL32,         R_ARM_SBREL31)    /* ??? */
   FAKE_RELOC (R_ARM_AMP_VCALL9,         R_ARM_BREL_ADJ)   /* Thumb-something.  Not used.  */
-#ifndef OLD_ARM_ABI
   FAKE_RELOC (R_ARM_PC13,               R_ARM_LDR_PC_G0)  /* Unclear whether meaning is different.  */
-#endif
 END_RELOC_NUMBERS (R_ARM_max)
 
 /* The name of the note section used to identify arm variants.  */



More information about the Binutils mailing list