This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[csl-arm] EABI object attributes
- From: Paul Brook <paul at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 2 Apr 2006 00:22:48 +0100
- Subject: [csl-arm] EABI object attributes
The attached patch adds makes the Arm backend output assembly directives for
more EABI object attributes. Some of these are necessary because the default
value is actively incorrect (so a linker could/should refuse to link the
objects), others are just nice to have.
Some of the attributes (eg. size of enums any wchar_t) can be reported as "not
used" itstead of the actual value. However there doesn't seem to be a way to
get this usage infomation, so we output the value whether they are used or
not.
Tested with cross to arm-none-eabi.
Applied to branches/csl/arm-4_1.
Paul
2006-04-02 Paul Brook <paul@codesourcery.com>
* gcc/config/arm/arm.c (arm_file_start): Output additional object
attribute directives.
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c (revision 112606)
+++ gcc/config/arm/arm.c (working copy)
@@ -14973,6 +14973,8 @@ arm_asm_output_labelref (FILE *stream, c
static void
arm_file_start (void)
{
+ int val;
+
if (TARGET_UNIFIED_ASM)
asm_fprintf (asm_out_file, "\t.syntax unified\n");
@@ -15011,6 +15013,8 @@ arm_file_start (void)
fpu_name = "maverick";
break;
case FPUTYPE_VFP:
+ if (TARGET_HARD_FLOAT)
+ asm_fprintf (asm_out_file, "\t.eabi_attribute 27, 3\n");
if (TARGET_HARD_FLOAT_ABI)
asm_fprintf (asm_out_file, "\t.eabi_attribute 28, 1\n");
fpu_name = "vfp";
@@ -15020,6 +15024,50 @@ arm_file_start (void)
}
}
asm_fprintf (asm_out_file, "\t.fpu %s\n", fpu_name);
+
+ /* Some of these attributes only apply when the corresponding features
+ are used. However we don't have any easy way of figuring this out.
+ Conservatively record the setting that would have been used. */
+
+ /* Tag_ABI_PCS_wchar_t. */
+ asm_fprintf (asm_out_file, "\t.eabi_attribute 18, %d\n",
+ (int)WCHAR_TYPE_SIZE / BITS_PER_UNIT);
+
+ /* Tag_ABI_FP_rounding. */
+ if (flag_rounding_math)
+ asm_fprintf (asm_out_file, "\t.eabi_attribute 19, 1\n");
+ if (!flag_unsafe_math_optimizations)
+ {
+ /* Tag_ABI_FP_denomal. */
+ asm_fprintf (asm_out_file, "\t.eabi_attribute 20, 1\n");
+ /* Tag_ABI_FP_exceptions. */
+ asm_fprintf (asm_out_file, "\t.eabi_attribute 21, 1\n");
+ }
+ /* Tag_ABI_FP_user_exceptions. */
+ if (flag_signaling_nans)
+ asm_fprintf (asm_out_file, "\t.eabi_attribute 22, 1\n");
+ /* Tag_ABI_FP_number_model. */
+ asm_fprintf (asm_out_file, "\t.eabi_attribute 23, %d\n",
+ flag_finite_math_only ? 1 : 3);
+
+ /* Tag_ABI_align8_needed. */
+ asm_fprintf (asm_out_file, "\t.eabi_attribute 24, 1\n");
+ /* Tag_ABI_align8_preserved. */
+ asm_fprintf (asm_out_file, "\t.eabi_attribute 25, 1\n");
+ /* Tag_ABI_enum_size. */
+ asm_fprintf (asm_out_file, "\t.eabi_attribute 26, %d\n",
+ flag_short_enums ? 1 : 2);
+
+ /* Tag_ABI_optimization_goals. */
+ if (optimize_size)
+ val = 4;
+ else if (optimize >= 2)
+ val = 2;
+ else if (optimize)
+ val = 1;
+ else
+ val = 6;
+ asm_fprintf (asm_out_file, "\t.eabi_attribute 30, %d\n", val);
}
default_file_start();
}