This is the mail archive of the binutils@sourceware.org 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] Arm ELF header version


The attached patch makes binutils accept and generate Arm objects with EABI 
version 5 header flags. In practice there's no difference betweenthe two. v4 
was used when the ARM EABI was in development, then bumped to v5 when it was 
formally released.

I have not changed the default because there are still some bits (mainly GCC 
generation of build attributes) we don't fully implement.

Tested with cross to arm-none-eabi.
Ok?

Paul

2006-03-09  Paul Brook  <paul@codesourcery.com>

bfd/
	* elf32-arm.c (INTERWORK_FLAG): Handle EABIv5.
	(elf32_arm_print_private_bfd_data): Ditto.
binutils/
	* readelf.c (decode_ARM_machine_flags):  Handle EABIv5.
gas/
	* config/tc-arm.c (md_begin): Handle EABIv5.
	(arm_eabis): Add EF_ARM_EABI_VER5.
	* doc/c-arm.texi: Document -meabi=5.
include/elf/
	* arm.h (EF_ARM_EABI_VER5): Define.
Index: bfd/elf32-arm.c
===================================================================
RCS file: /var/cvsroot/src-cvs/src/bfd/elf32-arm.c,v
retrieving revision 1.67
diff -u -p -r1.67 elf32-arm.c
--- bfd/elf32-arm.c	9 Mar 2006 17:06:58 -0000	1.67
+++ bfd/elf32-arm.c	9 Mar 2006 23:45:02 -0000
@@ -1452,9 +1452,10 @@ elf32_arm_nabi_grok_psinfo (bfd *abfd, E
 typedef unsigned long int insn32;
 typedef unsigned short int insn16;
 
-/* In lieu of proper flags, assume all EABIv4 objects are interworkable.  */
+/* In lieu of proper flags, assume all EABIv4 or later objects are
+   interworkable.  */
 #define INTERWORK_FLAG(abfd)  \
-  (EF_ARM_EABI_VERSION (elf_elfheader (abfd)->e_flags) == EF_ARM_EABI_VER4 \
+  (EF_ARM_EABI_VERSION (elf_elfheader (abfd)->e_flags) >= EF_ARM_EABI_VER4 \
   || (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK))
 
 /* The linker script knows the section names for placement.
@@ -5153,6 +5154,21 @@ elf32_arm_merge_eabi_attributes (bfd *ib
   return TRUE;
 }
 
+
+/* Return TRUE if the two EABI versions are incompatible.  */
+
+static bfd_boolean
+elf32_arm_versions_compatible (unsigned iver, unsigned over)
+{
+  /* v4 and v5 are the same spec before and after it was released,
+     so allow mixing them.  */
+  if ((iver == EF_ARM_EABI_VER4 && over == EF_ARM_EABI_VER5)
+      || (iver == EF_ARM_EABI_VER5 && over == EF_ARM_EABI_VER4))
+    return TRUE;
+
+  return (iver == over);
+}
+
 /* Merge backend specific data from an object file to the output
    object file when linking.  */
 
@@ -5251,7 +5267,8 @@ elf32_arm_merge_private_bfd_data (bfd * 
     }
 
   /* Complain about various flag mismatches.  */
-  if (EF_ARM_EABI_VERSION (in_flags) != EF_ARM_EABI_VERSION (out_flags))
+  if (!elf32_arm_versions_compatible (EF_ARM_EABI_VERSION (in_flags),
+				      EF_ARM_EABI_VERSION (out_flags)))
     {
       _bfd_error_handler
 	(_("ERROR: Source object %B has EABI version %d, but target %B has EABI version %d"),
@@ -5462,7 +5479,11 @@ elf32_arm_print_private_bfd_data (bfd *a
 
     case EF_ARM_EABI_VER4:
       fprintf (file, _(" [Version4 EABI]"));
+      goto eabi;
 
+    case EF_ARM_EABI_VER5:
+      fprintf (file, _(" [Version5 EABI]"));
+    eabi:
       if (flags & EF_ARM_BE8)
 	fprintf (file, _(" [BE8]"));
 
Index: binutils/readelf.c
===================================================================
RCS file: /var/cvsroot/src-cvs/src/binutils/readelf.c,v
retrieving revision 1.339
diff -u -p -r1.339 readelf.c
--- binutils/readelf.c	6 Mar 2006 13:42:04 -0000	1.339
+++ binutils/readelf.c	9 Mar 2006 17:09:18 -0000
@@ -1793,6 +1793,11 @@ decode_ARM_machine_flags (unsigned e_fla
 
     case EF_ARM_EABI_VER4:
       strcat (buf, ", Version4 EABI");
+      goto eabi;
+
+    case EF_ARM_EABI_VER5:
+      strcat (buf, ", Version5 EABI");
+    eabi:
       while (e_flags)
 	{
 	  unsigned flag;
Index: gas/config/tc-arm.c
===================================================================
RCS file: /var/cvsroot/src-cvs/src/gas/config/tc-arm.c,v
retrieving revision 1.245
diff -u -p -r1.245 tc-arm.c
--- gas/config/tc-arm.c	7 Mar 2006 08:39:21 -0000	1.245
+++ gas/config/tc-arm.c	9 Mar 2006 17:10:12 -0000
@@ -12851,6 +12851,7 @@ md_begin (void)
 	break;
 
       case EF_ARM_EABI_VER4:
+      case EF_ARM_EABI_VER5:
 	/* No additional flags to set.	*/
 	break;
 
@@ -13367,11 +13368,12 @@ static const struct arm_option_value_tab
 };
 
 #ifdef OBJ_ELF
-/* We only know how to output GNU and ver 4 (AAELF) formats.  */
+/* We only know how to output GNU and ver 4/5 (AAELF) formats.  */
 static const struct arm_option_value_table arm_eabis[] =
 {
   {"gnu",	EF_ARM_EABI_UNKNOWN},
   {"4",		EF_ARM_EABI_VER4},
+  {"5",		EF_ARM_EABI_VER5},
   {NULL,	0}
 };
 #endif
Index: gas/doc/c-arm.texi
===================================================================
RCS file: /var/cvsroot/src-cvs/src/gas/doc/c-arm.texi,v
retrieving revision 1.36
diff -u -p -r1.36 c-arm.texi
--- gas/doc/c-arm.texi	24 Feb 2006 15:36:35 -0000	1.36
+++ gas/doc/c-arm.texi	9 Mar 2006 17:18:12 -0000
@@ -255,9 +255,10 @@ and
 This option specifies which EABI version the produced object files should
 conform to.
 The following values are recognised:
-@code{gnu}
+@code{gnu},
+@code{4}
 and
-@code{4}.
+@code{5}.
 
 @cindex @code{-EB} command line option, ARM
 @item -EB
Index: include/elf/arm.h
===================================================================
RCS file: /var/cvsroot/src-cvs/src/include/elf/arm.h,v
retrieving revision 1.28
diff -u -p -r1.28 arm.h
--- include/elf/arm.h	12 Dec 2005 17:03:40 -0000	1.28
+++ include/elf/arm.h	9 Mar 2006 17:10:39 -0000
@@ -56,6 +56,7 @@
 #define EF_ARM_EABI_VER2     0x02000000
 #define EF_ARM_EABI_VER3     0x03000000
 #define EF_ARM_EABI_VER4     0x04000000
+#define EF_ARM_EABI_VER5     0x05000000
 
 /* Local aliases for some flags to match names used by COFF port.  */
 #define F_INTERWORK	   EF_ARM_INTERWORK

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