This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [patch] ARM gas Floating Point options #2
- From: Paul Brook <paul at codesourcery dot com>
- To: binutils at sources dot redhat dot com
- Cc: "Mark Mitchell" <mark at codesourcery dot com>,Richard Earnshaw <rearnsha at arm dot com>
- Date: Wed, 10 Dec 2003 11:35:01 +0000
- Subject: Re: [patch] ARM gas Floating Point options #2
- References: <200312051308.31550.paul@codesourcery.com>
On Friday 05 December 2003 1:08 pm, Paul Brook wrote:
> The attached patch adds floating point switches to the gas ARM taget in
> line with similar changes to GCC.
>
> Basically it adds -msoft-float and -mhard-float which can work
> independently of -mfpu=. The existing -mfpu=soft* have been kept for
> compatability.
Updated patch based on comments from Richard Earnshaw. Adds -mfloat-abi=
instead of -m(soft|hard)-float
Paul
2003-12-05 Paul Brook <paul@codesourcery.com>
* config/tc-arm.c (FPU_MAVERICK): Define.
(FPU_ARCH_MAVERICK): Define.
(arm_float_abi): Define.
(mfloat_abi_opt): New variable.
(md_begin): Use them.
(arm_opts): Add msoft-float and mhard-float.
(arm_cpus): Use FPU_ARCH_MAVERICK.
(arm_fpus): Add maverick.
(arm_float_abis): Add.
(arm_parse_float_abi): New function.
(arm_long_options): Add mfloat-abi.
* doc/as.texinfo: Document -mfloat-abi=.
* doc/c-arm.text: Ditto. Menution -fpu=maverick.
Index: gas/config/tc-arm.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-arm.c,v
retrieving revision 1.154
diff -u -p -r1.154 tc-arm.c
--- gas/config/tc-arm.c 10 Dec 2003 06:41:08 -0000 1.154
+++ gas/config/tc-arm.c 10 Dec 2003 10:53:50 -0000
@@ -102,6 +102,7 @@
#define FPU_VFP_EXT_V1xD 0x10000000 /* Base VFP instruction set. */
#define FPU_VFP_EXT_V1 0x08000000 /* Double-precision insns. */
#define FPU_VFP_EXT_V2 0x04000000 /* ARM10E VFPr1. */
+#define FPU_MAVERICK 0x02000000 /* Cirrus Maverick. */
#define FPU_NONE 0
#define FPU_ARCH_FPE FPU_FPA_EXT_V1
@@ -112,6 +113,15 @@
#define FPU_ARCH_VFP_V1 (FPU_ARCH_VFP_V1xD | FPU_VFP_EXT_V1)
#define FPU_ARCH_VFP_V2 (FPU_ARCH_VFP_V1 | FPU_VFP_EXT_V2)
+#define FPU_ARCH_MAVERICK FPU_MAVERICK
+
+enum arm_float_abi
+{
+ ARM_FLOAT_ABI_HARD,
+ ARM_FLOAT_ABI_SOFTFP,
+ ARM_FLOAT_ABI_SOFT
+};
+
/* Types of processor to assemble for. */
#define ARM_1 ARM_ARCH_V1
#define ARM_2 ARM_ARCH_V2
@@ -178,6 +188,7 @@ static int mcpu_fpu_opt = -1;
static int march_cpu_opt = -1;
static int march_fpu_opt = -1;
static int mfpu_opt = -1;
+static int mfloat_abi_opt = -1;
/* This array holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful. */
@@ -2536,6 +2547,7 @@ static int arm_parse_extension PARAMS ((
static int arm_parse_cpu PARAMS ((char *));
static int arm_parse_arch PARAMS ((char *));
static int arm_parse_fpu PARAMS ((char *));
+static int arm_parse_float_abi 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));
@@ -11645,24 +11657,35 @@ md_begin ()
#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;
+ || (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 & ARM_CEXT_MAVERICK)
- {
- flags &= ~ F_SOFT_FLOAT;
+ if (cpu_variant & FPU_ARCH_MAVERICK)
flags |= EF_ARM_MAVERICK_FLOAT;
- }
#endif
bfd_set_private_flags (stdoutput, flags);
@@ -13281,7 +13304,7 @@ static struct arm_cpu_option_table arm_c
{"iwmmxt", ARM_ARCH_IWMMXT, FPU_ARCH_VFP_V2},
{"i80200", ARM_ARCH_XSCALE, FPU_ARCH_VFP_V2},
/* Maverick */
- {"ep9312", ARM_ARCH_V4T | ARM_CEXT_MAVERICK, FPU_NONE},
+ {"ep9312", ARM_ARCH_V4T | ARM_CEXT_MAVERICK, FPU_ARCH_MAVERICK},
{NULL, 0, 0}
};
@@ -13362,6 +13385,21 @@ static struct arm_fpu_option_table arm_f
{"arm1020t", FPU_ARCH_VFP_V1},
{"arm1020e", FPU_ARCH_VFP_V2},
{"arm1136jfs", FPU_ARCH_VFP_V2},
+ {"maverick", FPU_ARCH_MAVERICK},
+ {NULL, 0}
+};
+
+struct arm_float_abi_option_table
+{
+ char *name;
+ int value;
+};
+
+static struct arm_float_abi_option_table arm_float_abis[] =
+{
+ {"hard", ARM_FLOAT_ABI_HARD},
+ {"softfp", ARM_FLOAT_ABI_SOFTFP},
+ {"soft", ARM_FLOAT_ABI_SOFT},
{NULL, 0}
};
@@ -13511,6 +13549,23 @@ arm_parse_fpu (str)
return 0;
}
+static int
+arm_parse_float_abi (str)
+ char * str;
+{
+ struct arm_float_abi_option_table *opt;
+
+ for (opt = arm_float_abis; opt->name != NULL; opt++)
+ if (strcmp (opt->name, str) == 0)
+ {
+ mfloat_abi_opt = opt->value;
+ return 1;
+ }
+
+ as_bad (_("unknown floating point abi `%s'\n"), str);
+ return 0;
+}
+
struct arm_long_option_table arm_long_opts[] =
{
{"mcpu=", N_("<cpu name>\t assemble for CPU <cpu name>"),
@@ -13519,6 +13574,8 @@ struct arm_long_option_table arm_long_op
arm_parse_arch, NULL},
{"mfpu=", N_("<fpu name>\t assemble for FPU architecture <fpu name>"),
arm_parse_fpu, NULL},
+ {"mfloat-abi=", N_("<abi>\t assemble for floating point ABI <abi>"),
+ arm_parse_float_abi, NULL},
{NULL, NULL, 0, NULL}
};
Index: gas/doc/as.texinfo
===================================================================
RCS file: /cvs/src/src/gas/doc/as.texinfo,v
retrieving revision 1.93
diff -u -p -r1.93 as.texinfo
--- gas/doc/as.texinfo 15 Oct 2003 14:16:29 -0000 1.93
+++ gas/doc/as.texinfo 10 Dec 2003 10:53:52 -0000
@@ -297,7 +297,8 @@ gcc(1), ld(1), and the Info entries for
@c Don't document the deprecated options
[@b{-mcpu}=@var{processor}[+@var{extension}@dots{}]]
[@b{-march}=@var{architecture}[+@var{extension}@dots{}]]
- [@b{-mfpu}=@var{floating-point-fromat}]
+ [@b{-mfpu}=@var{floating-point-format}]
+ [@b{-mfloat-abi}=@var{abi}]
[@b{-mthumb}]
[@b{-EB}|@b{-EL}]
[@b{-mapcs-32}|@b{-mapcs-26}|@b{-mapcs-float}|
@@ -635,6 +636,8 @@ Specify which ARM processor variant is t
Specify which ARM architecture variant is used by the target.
@item -mfpu=@var{floating-point-format}
Select which Floating Point architecture is the target.
+@item -mfloat-abi=@var{abi}
+Select which floating point ABI is in use.
@item -mthumb
Enable Thumb only instruction decoding.
@item -mapcs-32 | -mapcs-26 | -mapcs-float | -mapcs-reentrant | -moabi
Index: gas/doc/c-arm.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/c-arm.texi,v
retrieving revision 1.22
diff -u -p -r1.22 c-arm.texi
--- gas/doc/c-arm.texi 6 Dec 2003 01:25:29 -0000 1.22
+++ gas/doc/c-arm.texi 10 Dec 2003 10:53:52 -0000
@@ -166,8 +166,9 @@ The following format options are recogni
@code{vfpxd},
@code{arm1020t},
@code{arm1020e},
+@code{arm1136jfs}
and
-@code{arm1136jfs}.
+@code{maverick}.
In addition to determining which instructions are assembled, this option
also affects the way in which the @code{.double} assembler directive behaves
@@ -212,6 +213,16 @@ registers rather than integer registers.
@item -mapcs-reentrant
This indicates that the reentrant variant of the APCS should be used.
This variant supports position independent code.
+
+@cindex @code{-mfloat-abi=} command line option, ARM
+@item -mfloat-abi=@var{abi}
+This option specifies that the output generated by the assembler should be
+marked as using specified floating point ABI.
+The following values are recognized:
+@code{soft},
+@code{softfp}
+and
+@code{hard}.
@cindex @code{-EB} command line option, ARM
@item -EB