Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Aug 2010 06:50:33 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r211985 - in projects/arm_eabi/contrib/binutils: bfd binutils gas/config include/elf
Message-ID:  <201008300650.o7U6oXOw086494@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Mon Aug 30 06:50:33 2010
New Revision: 211985
URL: http://svn.freebsd.org/changeset/base/211985

Log:
  Start to back port changed from binutils 2.16 for EABI.
  Mark binaries built with the EABI to be marked correctly.

Modified:
  projects/arm_eabi/contrib/binutils/bfd/elf32-arm.h
  projects/arm_eabi/contrib/binutils/binutils/readelf.c
  projects/arm_eabi/contrib/binutils/gas/config/tc-arm.c
  projects/arm_eabi/contrib/binutils/include/elf/arm.h

Modified: projects/arm_eabi/contrib/binutils/bfd/elf32-arm.h
==============================================================================
--- projects/arm_eabi/contrib/binutils/bfd/elf32-arm.h	Mon Aug 30 00:31:30 2010	(r211984)
+++ projects/arm_eabi/contrib/binutils/bfd/elf32-arm.h	Mon Aug 30 06:50:33 2010	(r211985)
@@ -110,7 +110,10 @@ bfd_boolean bfd_elf32_arm_process_before
 #endif
 
 
-#define INTERWORK_FLAG(abfd)   (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK)
+/* In lieu of proper flags, assume all EABIv4 objects are interworkable.  */
+#define INTERWORK_FLAG(abfd)  \
+  (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.
    The entry_names are used to do simple name mangling on the stubs.
@@ -2666,6 +2669,22 @@ elf32_arm_print_private_bfd_data (abfd, 
 		 | EF_ARM_MAPSYMSFIRST);
       break;
 
+    case EF_ARM_EABI_VER3:
+      fprintf (file, _(" [Version3 EABI]"));
+      break;
+
+    case EF_ARM_EABI_VER4:
+      fprintf (file, _(" [Version4 EABI]"));
+
+      if (flags & EF_ARM_BE8)
+	fprintf (file, _(" [BE8]"));
+
+      if (flags & EF_ARM_LE8)
+	fprintf (file, _(" [LE8]"));
+
+      flags &= ~(EF_ARM_LE8 | EF_ARM_BE8);
+      break;
+
     default:
       fprintf (file, _(" <EABI version unrecognised>"));
       break;

Modified: projects/arm_eabi/contrib/binutils/binutils/readelf.c
==============================================================================
--- projects/arm_eabi/contrib/binutils/binutils/readelf.c	Mon Aug 30 00:31:30 2010	(r211984)
+++ projects/arm_eabi/contrib/binutils/binutils/readelf.c	Mon Aug 30 06:50:33 2010	(r211985)
@@ -1740,6 +1740,37 @@ decode_ARM_machine_flags (unsigned e_fla
 	}
       break;
 
+    case EF_ARM_EABI_VER3:
+      strcat (buf, ", Version3 EABI");
+      break;
+
+    case EF_ARM_EABI_VER4:
+      strcat (buf, ", Version4 EABI");
+      while (e_flags)
+	{
+	  unsigned flag;
+
+	  /* Process flags one bit at a time.  */
+	  flag = e_flags & - e_flags;
+	  e_flags &= ~ flag;
+
+	  switch (flag)
+	    {
+	    case EF_ARM_BE8:
+	      strcat (buf, ", BE8");
+	      break;
+
+	    case EF_ARM_LE8:
+	      strcat (buf, ", LE8");
+	      break;
+
+	    default:
+	      unknown = 1;
+	      break;
+	    }
+	}
+      break;
+
     case EF_ARM_EABI_UNKNOWN:
       strcat (buf, ", GNU EABI");
       while (e_flags)

Modified: projects/arm_eabi/contrib/binutils/gas/config/tc-arm.c
==============================================================================
--- projects/arm_eabi/contrib/binutils/gas/config/tc-arm.c	Mon Aug 30 00:31:30 2010	(r211984)
+++ projects/arm_eabi/contrib/binutils/gas/config/tc-arm.c	Mon Aug 30 06:50:33 2010	(r211985)
@@ -191,6 +191,9 @@ static int march_cpu_opt = -1;
 static int march_fpu_opt = -1;
 static int mfpu_opt = -1;
 static int mfloat_abi_opt = -1;
+#ifdef OBJ_ELF
+static int meabi_flags = EF_ARM_EABI_UNKNOWN;
+#endif
 
 /* This array holds the chars that always start a comment.  If the
    pre-processor is disabled, these aren't very useful.  */
@@ -11680,36 +11683,52 @@ md_begin ()
   {
     unsigned int flags = 0;
 
-    /* Set the flags in the private structure.  */
-    if (uses_apcs_26)      flags |= F_APCS26;
-    if (support_interwork) flags |= F_INTERWORK;
-    if (uses_apcs_float)   flags |= F_APCS_FLOAT;
-    if (pic_code)          flags |= F_PIC;
-    if ((cpu_variant & FPU_ANY) == FPU_NONE
-	 || (cpu_variant & FPU_ANY) == FPU_ARCH_VFP) /* VFP layout only.  */
-      {
-	flags |= F_SOFT_FLOAT;
-      }
-    switch (mfloat_abi_opt)
+#if defined OBJ_ELF
+    flags = meabi_flags;
+
+    switch (meabi_flags)
       {
-      case ARM_FLOAT_ABI_SOFT:
-      case ARM_FLOAT_ABI_SOFTFP:
-	flags |= F_SOFT_FLOAT;
+      case EF_ARM_EABI_UNKNOWN:
+#endif
+	/* Set the flags in the private structure.  */
+	if (uses_apcs_26)      flags |= F_APCS26;
+	if (support_interwork) flags |= F_INTERWORK;
+	if (uses_apcs_float)   flags |= F_APCS_FLOAT;
+	if (pic_code)          flags |= F_PIC;
+	if ((cpu_variant & FPU_ANY) == FPU_NONE
+	     || (cpu_variant & FPU_ANY) == FPU_ARCH_VFP) /* VFP layout only.  */
+	  flags |= F_SOFT_FLOAT;
+
+	switch (mfloat_abi_opt)
+	  {
+	  case ARM_FLOAT_ABI_SOFT:
+	  case ARM_FLOAT_ABI_SOFTFP:
+	    flags |= F_SOFT_FLOAT;
+	    break;
+
+	  case ARM_FLOAT_ABI_HARD:
+	    if (flags & F_SOFT_FLOAT)
+	      as_bad (_("hard-float conflicts with specified fpu"));
+	    break;
+	  }
+
+	/* Using VFP conventions (even if soft-float).  */
+	if (cpu_variant & FPU_VFP_EXT_NONE)
+	  flags |= F_VFP_FLOAT;
+
+#if defined OBJ_ELF
+	if (cpu_variant & FPU_ARCH_MAVERICK)
+	    flags |= EF_ARM_MAVERICK_FLOAT;
 	break;
 
-      case ARM_FLOAT_ABI_HARD:
-	if (flags & F_SOFT_FLOAT)
-	  as_bad (_("hard-float conflicts with specified fpu"));
+      case EF_ARM_EABI_VER4:
+	/* No additional flags to set.  */
 	break;
-      }
-    /* Using VFP conventions (even if soft-float).  */
-    if (cpu_variant & FPU_VFP_EXT_NONE) flags |= F_VFP_FLOAT;
 
-#if defined OBJ_ELF
-    if (cpu_variant & FPU_ARCH_MAVERICK)
-	flags |= EF_ARM_MAVERICK_FLOAT;
+      default:
+	abort ();
+      }
 #endif
-
     bfd_set_private_flags (stdoutput, flags);
 
     /* We have run out flags in the COFF header to encode the
@@ -13441,6 +13460,22 @@ static struct arm_float_abi_option_table
   {NULL, 0}
 };
 
+struct arm_eabi_option_table
+{
+  char *name;
+  unsigned int value;
+};
+
+#ifdef OBJ_ELF
+/* We only know how to output GNU and ver 4 (AAELF) formats.  */
+static struct arm_eabi_option_table arm_eabis[] =
+{
+  {"gnu",	EF_ARM_EABI_UNKNOWN},
+  {"4",		EF_ARM_EABI_VER4},
+  {NULL, 0}
+};
+#endif
+
 struct arm_long_option_table
 {
   char *option;		/* Substring to match.  */
@@ -13604,6 +13639,23 @@ arm_parse_float_abi (str)
   return 0;
 }
 
+#ifdef OBJ_ELF
+static int
+arm_parse_eabi (char * str)
+{
+  struct arm_eabi_option_table *opt;
+
+  for (opt = arm_eabis; opt->name != NULL; opt++)
+    if (streq (opt->name, str))
+      {
+	meabi_flags = opt->value;
+	return 1;
+      }
+  as_bad (_("unknown EABI `%s'\n"), str);
+  return 0;
+}
+#endif
+
 struct arm_long_option_table arm_long_opts[] =
 {
   {"mcpu=", N_("<cpu name>\t  assemble for CPU <cpu name>"),
@@ -13614,6 +13666,10 @@ struct arm_long_option_table arm_long_op
    arm_parse_fpu, NULL},
   {"mfloat-abi=", N_("<abi>\t  assemble for floating point ABI <abi>"),
    arm_parse_float_abi, NULL},
+#ifdef OBJ_ELF
+  {"meabi=", N_("<ver>\t  assemble for eabi version <ver>"),
+   arm_parse_eabi, NULL},
+#endif
   {NULL, NULL, 0, NULL}
 };
 

Modified: projects/arm_eabi/contrib/binutils/include/elf/arm.h
==============================================================================
--- projects/arm_eabi/contrib/binutils/include/elf/arm.h	Mon Aug 30 00:31:30 2010	(r211984)
+++ projects/arm_eabi/contrib/binutils/include/elf/arm.h	Mon Aug 30 06:50:33 2010	(r211985)
@@ -42,10 +42,16 @@
 #define EF_ARM_MAPSYMSFIRST 0x10	/* NB conflicts with EF_APCS_FLOAT */
 #define EF_ARM_EABIMASK      0xFF000000
 
+/* Constants defined in AAELF.  */
+#define EF_ARM_BE8	    0x00800000
+#define EF_ARM_LE8	    0x00400000
+
 #define EF_ARM_EABI_VERSION(flags) ((flags) & EF_ARM_EABIMASK)
 #define EF_ARM_EABI_UNKNOWN  0x00000000
 #define EF_ARM_EABI_VER1     0x01000000
 #define EF_ARM_EABI_VER2     0x02000000
+#define EF_ARM_EABI_VER3     0x03000000
+#define EF_ARM_EABI_VER4     0x04000000
 
 /* Local aliases for some flags to match names used by COFF port.  */
 #define F_INTERWORK	   EF_ARM_INTERWORK



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008300650.o7U6oXOw086494>