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/ARM support for VFP object files



The patch below allows the bfd to check that elf objects containing VFP 
code are object-format compatible.  We now have 3 flags that are used to 
determine this:

EF_ARM_APCS_FLOAT	- arguments in FP registers (=1) integer regs (=0)
EF_ARM_VFP_FLOAT	- VFP instructions (=1) FPA instructions (=0)
EF_ARM_SOFT_FLOAT	- use FP instructiosn (=0) libcalls (=1)

In general all of these must match between two object files for the files 
to be compatible; however, the interfaces between files with

	EF_ARM_APCS_FLOAT=0, EF_ARM_VFP_FLOAT=1, EF_ARM_SOFT_FLOAT=either

are compatible, so we allow linking between these two variants

Note that EF_ARM_SOFT_FLOAT=1, EF_ARM_VFP_FLOAT=1 is distinct from 
EF_ARM_VFP_FLOAT=1, in that the format of doubles is different than for 
the FPA.

2002-01-16  Richard Earnshaw  <rearnsha@arm.com>

	* elf32-arm.h (elf32_arm_merge_private_bfd_data): Handle 
	EF_ARM_VFP_FLOAT.
	(elf32_arm_print_private_bfd_data): Likewise.


Index: elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.70
diff -p -r1.70 elf32-arm.h
*** elf32-arm.h	2002/01/16 05:37:10	1.70
--- elf32-arm.h	2002/01/16 12:58:59
*************** Error: %s passes floats in integer regis
*** 2297,2318 ****
  	  flags_compatible = false;
  	}
  
! #ifdef EF_ARM_SOFT_FLOAT
!       if ((in_flags & EF_ARM_SOFT_FLOAT) != (out_flags & EF_ARM_SOFT_FLOAT))
  	{
! 	  if (in_flags & EF_ARM_SOFT_FLOAT)
! 	    _bfd_error_handler (_ ("\
! Error: %s uses software FP, whereas %s uses hardware FP"),
  				bfd_archive_filename (ibfd),
  				bfd_get_filename (obfd));
  	  else
! 	    _bfd_error_handler (_ ("\
! Error: %s uses hardware FP, whereas %s uses software FP"),
  				bfd_archive_filename (ibfd),
  				bfd_get_filename (obfd));
  
  	  flags_compatible = false;
  	}
  #endif
  
        /* Interworking mismatch is only a warning.  */
--- 2297,2343 ----
  	  flags_compatible = false;
  	}
  
!       if ((in_flags & EF_ARM_VFP_FLOAT) != (out_flags & EF_ARM_VFP_FLOAT))
  	{
! 	  if (in_flags & EF_ARM_VFP_FLOAT)
! 	    _bfd_error_handler (_("\
! Error: %s uses VFP instructions, whereas %s FPA instructions"),
  				bfd_archive_filename (ibfd),
  				bfd_get_filename (obfd));
  	  else
! 	    _bfd_error_handler (_("\
! Error: %s uses FPA instructions, whereas %s VFP instructions"),
  				bfd_archive_filename (ibfd),
  				bfd_get_filename (obfd));
  
  	  flags_compatible = false;
  	}
+ 
+ #ifdef EF_ARM_SOFT_FLOAT
+       if ((in_flags & EF_ARM_SOFT_FLOAT) != (out_flags & EF_ARM_SOFT_FLOAT))
+ 	{
+ 	  /* We can allow interworking between code that is VFP format
+ 	     layout, and uses either soft float or integer regs for
+ 	     passing floating point arguments and results.  We already
+ 	     know that the APCS_FLOAT flags match; similarly for VFP
+ 	     flags.  */
+ 	  if ((in_flags & EF_ARM_APCS_FLOAT) != 0
+ 	      || (in_flags & EF_ARM_VFP_FLOAT) == 0)
+ 	    {
+ 	      if (in_flags & EF_ARM_SOFT_FLOAT)
+ 		_bfd_error_handler (_ ("\
+ Error: %s uses software FP, whereas %s uses hardware FP"),
+ 				    bfd_archive_filename (ibfd),
+ 				    bfd_get_filename (obfd));
+ 	      else
+ 		_bfd_error_handler (_ ("\
+ Error: %s uses hardware FP, whereas %s uses software FP"),
+ 				    bfd_archive_filename (ibfd),
+ 				    bfd_get_filename (obfd));
+ 
+ 	      flags_compatible = false;
+ 	    }
+ 	}
  #endif
  
        /* Interworking mismatch is only a warning.  */
*************** elf32_arm_print_private_bfd_data (abfd, 
*** 2374,2379 ****
--- 2399,2409 ----
        else
  	fprintf (file, _(" [APCS-32]"));
  
+       if (flags & EF_ARM_VFP_FLOAT)
+ 	fprintf (file, _(" [VFP float format]"));
+       else
+ 	fprintf (file, _(" [FPA float format]"));
+ 
        if (flags & EF_ARM_APCS_FLOAT)
  	fprintf (file, _(" [floats passed in float registers]"));
  
*************** elf32_arm_print_private_bfd_data (abfd, 
*** 2389,2396 ****
        if (flags & EF_ARM_SOFT_FLOAT)
  	fprintf (file, _(" [software FP]"));
  
!       flags &= ~(EF_ARM_INTERWORK | EF_ARM_APCS_26 | EF_ARM_APCS_FLOAT | EF_ARM_PIC
! 		 | EF_ARM_NEW_ABI | EF_ARM_OLD_ABI | EF_ARM_SOFT_FLOAT);
        break;
  
      case EF_ARM_EABI_VER1:
--- 2419,2427 ----
        if (flags & EF_ARM_SOFT_FLOAT)
  	fprintf (file, _(" [software FP]"));
  
!       flags &= ~(EF_ARM_INTERWORK | EF_ARM_APCS_26 | EF_ARM_APCS_FLOAT
! 		 | EF_ARM_PIC | EF_ARM_NEW_ABI | EF_ARM_OLD_ABI
! 		 | EF_ARM_SOFT_FLOAT | EF_ARM_VFP_FLOAT);
        break;
  
      case EF_ARM_EABI_VER1:

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