This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
ARM EABI v3
- From: Paul Brook <paul at codesourcery dot com>
- To: binutils at sources dot redhat dot com
- Cc: Richard Earnshaw <rearnsha at arm dot com>
- Date: Tue, 23 Mar 2004 16:33:24 +0000
- Subject: ARM EABI v3
- Organization: CodeSourcery
The patch below adds basic binutils support for AAELF (EABI v3).
Ok?
Paul
2004-23-02 Paul Brook <paul@codesourcery.com>
* bfd/elf32-arm.h (arm_print_private_bfd_data): Add EABI v3.
* binutils/readelf.c (decode_ARM_machine_flags): Add EABI v3.
* gas/config/tc-arm.c (meabi_flags): New variable.
(arm_parse_eabi): New function.
(md_begin): Set flags for EABI v3.
(arm_eabis): Add.
(arm_long_opts): Add meabi.
* include/elf/arm.h (EF_ERM_BE8, EF_ARM_LE8, EF_ARM_EABI_VER3): Add.
? gas/doc/as.info
? ld/ldint.html
Index: bfd/elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.122
diff -c -p -r1.122 elf32-arm.h
*** bfd/elf32-arm.h 22 Mar 2004 02:28:15 -0000 1.122
--- bfd/elf32-arm.h 23 Mar 2004 15:53:27 -0000
*************** elf32_arm_print_private_bfd_data (abfd,
*** 2679,2684 ****
--- 2679,2696 ----
| EF_ARM_MAPSYMSFIRST);
break;
+ case EF_ARM_EABI_VER3:
+ fprintf (file, _(" [Version3 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;
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.232
diff -c -p -r1.232 readelf.c
*** binutils/readelf.c 22 Mar 2004 03:55:50 -0000 1.232
--- binutils/readelf.c 23 Mar 2004 15:53:31 -0000
*************** decode_ARM_machine_flags (unsigned e_fla
*** 1740,1745 ****
--- 1740,1772 ----
}
break;
+ case EF_ARM_EABI_VER3:
+ strcat (buf, ", Version3 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)
Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.163
diff -c -p -r1.163 tc-arm.c
*** gas/config/tc-arm.c 18 Feb 2004 16:28:17 -0000 1.163
--- gas/config/tc-arm.c 23 Mar 2004 15:53:44 -0000
*************** static int march_cpu_opt = -1;
*** 191,196 ****
--- 191,197 ----
static int march_fpu_opt = -1;
static int mfpu_opt = -1;
static int mfloat_abi_opt = -1;
+ static int meabi_flags = EF_ARM_EABI_UNKNOWN;
/* This array holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful. */
*************** static int arm_parse_cpu PARAMS ((char *
*** 2551,2556 ****
--- 2552,2558 ----
static int arm_parse_arch PARAMS ((char *));
static int arm_parse_fpu PARAMS ((char *));
static int arm_parse_float_abi PARAMS ((char *));
+ static int arm_parse_eabi PARAMS ((char *));
#if 0 /* Suppressed - for now. */
#if defined OBJ_COFF || defined OBJ_ELF
static void arm_add_note PARAMS ((const char *, const char *, unsigned
int));
*************** md_begin ()
*** 11687,11723 ****
#if defined OBJ_COFF || defined OBJ_ELF
{
! 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)
! {
! 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;
#endif
bfd_set_private_flags (stdoutput, flags);
--- 11689,11737 ----
#if defined OBJ_COFF || defined OBJ_ELF
{
! unsigned int flags = meabi_flags;
! switch (meabi_flags)
{
! case EF_ARM_EABI_UNKNOWN:
! /* 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;
#endif
+ break;
+
+ case EF_ARM_EABI_VER3:
+ /* No additional flags to set. */
+ break;
+
+ default:
+ abort ();
+ }
bfd_set_private_flags (stdoutput, flags);
*************** static struct arm_float_abi_option_table
*** 13450,13455 ****
--- 13464,13483 ----
{NULL, 0}
};
+ struct arm_eabi_option_table
+ {
+ char *name;
+ unsigned int value;
+ };
+
+ /* We only know hot to output GNU and ver 3 (AAELF) formats. */
+ static struct arm_eabi_option_table arm_eabis[] =
+ {
+ {"gnu", EF_ARM_EABI_UNKNOWN},
+ {"3", EF_ARM_EABI_VER3},
+ {NULL, 0}
+ };
+
struct arm_long_option_table
{
char *option; /* Substring to match. */
*************** arm_parse_float_abi (str)
*** 13613,13618 ****
--- 13641,13662 ----
return 0;
}
+ static int
+ arm_parse_eabi (str)
+ char * str;
+ {
+ struct arm_eabi_option_table *opt;
+
+ for (opt = arm_eabis; opt->name != NULL; opt++)
+ if (strcmp (opt->name, str) == 0)
+ {
+ meabi_flags = opt->value;
+ return 1;
+ }
+ as_bad (_("unknown EABI `%s'\n"), str);
+ return 0;
+ }
+
struct arm_long_option_table arm_long_opts[] =
{
{"mcpu=", N_("<cpu name>\t assemble for CPU <cpu name>"),
*************** struct arm_long_option_table arm_long_op
*** 13623,13628 ****
--- 13667,13674 ----
arm_parse_fpu, NULL},
{"mfloat-abi=", N_("<abi>\t assemble for floating point ABI <abi>"),
arm_parse_float_abi, NULL},
+ {"meabi=", N_("<ver>\t assemble for eabi version <ver>"),
+ arm_parse_eabi, NULL},
{NULL, NULL, 0, NULL}
};
Index: include/elf/arm.h
===================================================================
RCS file: /cvs/src/src/include/elf/arm.h,v
retrieving revision 1.12
diff -c -p -r1.12 arm.h
*** include/elf/arm.h 1 Apr 2003 13:08:06 -0000 1.12
--- include/elf/arm.h 23 Mar 2004 15:53:46 -0000
***************
*** 42,51 ****
--- 42,56 ----
#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
/* Local aliases for some flags to match names used by COFF port. */
#define F_INTERWORK EF_ARM_INTERWORK