From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22090 invoked by alias); 27 Sep 2011 14:36:58 -0000 Received: (qmail 22003 invoked by uid 22791); 27 Sep 2011 14:36:57 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_TV,TW_VF X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Sep 2011 14:36:33 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8REaPgn016472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 27 Sep 2011 10:36:25 -0400 Received: from Gift.redhat.com (vpn1-6-227.ams2.redhat.com [10.36.6.227]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p8REaKEp028052; Tue, 27 Sep 2011 10:36:21 -0400 From: Nick Clifton To: richard.earnshaw@arm.com, paul@codesourcery.com, ramana.radhakrishnan@arm.com Cc: gcc-patches@gcc.gnu.org Subject: RFC: ARM: Add comment enumerating emitted .eabi_attribute tags Date: Tue, 27 Sep 2011 15:51:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg01733.txt.bz2 Hi Richard, Hi Paul, Hi Ramana, I am planning to check in the patch below to add comments to the .eabi_attribute directives emitted by the ARM GCC backend. So for example a simple hello world source file might compile to something like this: .cpu arm7tdmi .fpu softvfp .eabi_attribute 20, 1 @ Tag_ABI_FP_denormal .eabi_attribute 21, 1 @ Tag_ABI_FP_exceptions .eabi_attribute 23, 3 @ Tag_ABI_FP_number_model Apart from making the assembler output easier to understand, the patch also makes use of the enumerated tag values in the elf/arm.h header file, thus making sure that the compiler stays in sync with the header. I stuck with using numerical values in the actual .eabi_attribute directive as versions of GAS prior to 2.20 require this. Any comments or objections to this patch ? If not, I will apply it next week. Cheers Nick gcc/ChangeLog 2011-09-27 Nick Clifton * config/arm/arm.c (EMIT_EABI_ATTRIBUTE): New macro. (arm_file_start): Use it to generate .eabi_attribute assembler pseudo-ops. Index: gcc/config/arm/arm.c =================================================================== --- gcc/config/arm/arm.c (revision 179269) +++ gcc/config/arm/arm.c (working copy) @@ -22220,6 +22220,24 @@ asm_fprintf (stream, "%U%s", name); } +/* Get the definitions of the ARM EABI Attribute tag values. */ +#define BFD_ARCH_SIZE +#include "elf/arm.h" + +/* This macro is used to emit an EABI tag and its associated value. + We emit the numerical value of the tag in case the assembler does not + support textual tags. (Eg gas prior to 2.20). We include the tag + name in a comment so that anyone reading the assembler output will + know which tag is being set. */ +#define EMIT_EABI_ATTRIBUTE(name,val) \ + do \ + { \ + asm_fprintf (asm_out_file, "\t.eabi_attribute %d, %d\t%s " #name "\n", \ + name, val, ASM_COMMENT_START); \ + } \ + while (0) + + static void arm_file_start (void) { @@ -22248,12 +22266,13 @@ else { fpu_name = arm_fpu_desc->name; + if (arm_fpu_desc->model == ARM_FP_MODEL_VFP) { if (TARGET_HARD_FLOAT) - asm_fprintf (asm_out_file, "\t.eabi_attribute 27, 3\n"); + EMIT_EABI_ATTRIBUTE (Tag_ABI_HardFP_use, 3); if (TARGET_HARD_FLOAT_ABI) - asm_fprintf (asm_out_file, "\t.eabi_attribute 28, 1\n"); + EMIT_EABI_ATTRIBUTE (Tag_ABI_VFP_args, 1); } } asm_fprintf (asm_out_file, "\t.fpu %s\n", fpu_name); @@ -22262,31 +22281,25 @@ 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_FP_rounding. */ if (flag_rounding_math) - asm_fprintf (asm_out_file, "\t.eabi_attribute 19, 1\n"); + EMIT_EABI_ATTRIBUTE (Tag_ABI_FP_rounding, 1); + 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"); + EMIT_EABI_ATTRIBUTE (Tag_ABI_FP_denormal, 1); + EMIT_EABI_ATTRIBUTE (Tag_ABI_FP_exceptions, 1); } - /* 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); + EMIT_EABI_ATTRIBUTE (Tag_ABI_FP_user_exceptions, 1); - /* 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); + EMIT_EABI_ATTRIBUTE (Tag_ABI_FP_number_model, + flag_finite_math_only ? 1 : 3); + EMIT_EABI_ATTRIBUTE (Tag_ABI_align8_needed, 1); + EMIT_EABI_ATTRIBUTE (Tag_ABI_align8_preserved, 1); + EMIT_EABI_ATTRIBUTE (Tag_ABI_enum_size, flag_short_enums ? 1 : 2); + /* Tag_ABI_optimization_goals. */ if (optimize_size) val = 4; @@ -22296,21 +22309,18 @@ val = 1; else val = 6; - asm_fprintf (asm_out_file, "\t.eabi_attribute 30, %d\n", val); + EMIT_EABI_ATTRIBUTE (Tag_ABI_optimization_goals, val); - /* Tag_CPU_unaligned_access. */ - asm_fprintf (asm_out_file, "\t.eabi_attribute 34, %d\n", - unaligned_access); + EMIT_EABI_ATTRIBUTE (Tag_CPU_unaligned_access, unaligned_access); - /* Tag_ABI_FP_16bit_format. */ if (arm_fp16_format) - asm_fprintf (asm_out_file, "\t.eabi_attribute 38, %d\n", - (int)arm_fp16_format); + EMIT_EABI_ATTRIBUTE (Tag_ABI_FP_16bit_format, (int) arm_fp16_format); if (arm_lang_output_object_attributes_hook) arm_lang_output_object_attributes_hook(); } - default_file_start(); + + default_file_start (); } static void Index: gcc/config/arm/arm-c.c =================================================================== --- gcc/config/arm/arm-c.c (revision 179247) +++ gcc/config/arm/arm-c.c (working copy) @@ -32,8 +32,9 @@ static void arm_output_c_attributes(void) { /* Tag_ABI_PCS_wchar_t. */ - asm_fprintf (asm_out_file, "\t.eabi_attribute 18, %d\n", - (int)(TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT)); + asm_fprintf (asm_out_file, "\t.eabi_attribute 18, %d\t%s Tag_ABI_PCS_wchar_t\n", + (int)(TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT), + ASM_COMMENT_START); }