This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RFC: Collecting together binary file attributes into a single file.
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils at sourceware dot org, gdb-patches at sourceware dot org, gcc at gcc dot gnu dot org
- Cc: aph at redhat dot com
- Date: Thu, 29 Sep 2011 10:34:45 +0100
- Subject: RFC: Collecting together binary file attributes into a single file.
Hi Guys,
All I wanted to do was to make GCC's ARM assembler output slightly
easier to read...
I would like to propose a patch to create a new header file in the
include/ directory. This file would contain enums describing the
attributes that be can found in SHT_GNU_ATTRIBUTES sections. The
purpose of the file is to provide a single place where these values
are defined, and to share the information between GCC, BINUTILS and
GDB.
The patch also includes an update to readelf to make it use the
enumerated values and an example of a patch to the ARM backend of GCC
to include the attribute names in its assembler output.
So - what do people think ? Any objections to this idea ?
Cheers
Nick
*** /dev/null 2011-09-29 08:15:18.023000106 +0100
--- include/binary-file-attributes.h 2011-09-29 10:21:09.615305343 +0100
***************
*** 0 ****
--- 1,317 ----
+ /* binary-file-attributes.h -- contains descriptions of generic and target
+ specific attributes found in ELF sections with the SHT_GNU_ATTRIBUTES
+ section type.
+
+ Copyright 2011 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+ /* Note: This file is placed in the include/ directory, rather than the
+ include/elf subdirectory so that it can be shared between GCC and the
+ BINUTILS. */
+
+ /* Note: This header does not have a #define to prevent multiple inclusions.
+ In fact if necessary, it can be included more than once. Each section
+ however does have its own #define to prevent redefinition. */
+
+ #ifndef _GNU_ATTRIBUTES_DEFINED_
+ #define _GNU_ATTRIBUTES_DEFINED_
+
+ enum
+ {
+ Tag_GNU_Generic_File_attributes = 1,
+ Tag_GNU_Generic_Section_attributes = 2,
+ Tag_GNU_Generic_Symbol_attributes = 3,
+ Tag_GNU_Generic_compatibility = 32
+ };
+
+ #endif /* _GNU_ATTRIBUTES_DEFINED_ */
+
+
+
+ #ifdef _ARM_EABI_ATTRIBUTES_
+ #ifndef _ARM_EABI_ATTRIBUTES_DEFINED_
+ #define _ARM_EABI_ATTRIBUTES_DEFINED_
+
+ /* EABI object attributes. */
+ enum
+ {
+ /* 0-3 are generic. */
+ Tag_CPU_raw_name = 4,
+ Tag_CPU_name = 5,
+ Tag_CPU_arch = 6,
+ Tag_CPU_arch_profile = 7,
+ Tag_ARM_ISA_use = 8,
+ Tag_THUMB_ISA_use = 9,
+ Tag_FP_arch = 10,
+ Tag_WMMX_arch = 11,
+ Tag_Advanced_SIMD_arch = 12,
+ Tag_PCS_config = 13,
+ Tag_ABI_PCS_R9_use = 14,
+ Tag_ABI_PCS_RW_data = 15,
+ Tag_ABI_PCS_RO_data = 16,
+ Tag_ABI_PCS_GOT_use = 17,
+ Tag_ABI_PCS_wchar_t = 18,
+ Tag_ABI_FP_rounding = 19,
+ Tag_ABI_FP_denormal = 20,
+ Tag_ABI_FP_exceptions = 21,
+ Tag_ABI_FP_user_exceptions = 22,
+ Tag_ABI_FP_number_model = 23,
+ Tag_ABI_align_needed = 24,
+ Tag_ABI_align_preserved = 25,
+ Tag_ABI_enum_size = 26,
+ Tag_ABI_HardFP_use = 27,
+ Tag_ABI_VFP_args = 28,
+ Tag_ABI_WMMX_args = 29,
+ Tag_ABI_optimization_goals = 30,
+ Tag_ABI_FP_optimization_goals = 31,
+ /* 32 is generic (Tag_compatibility). */
+ Tag_undefined33 = 33,
+ Tag_CPU_unaligned_access = 34,
+ Tag_undefined35 = 35,
+ Tag_FP_HP_extension = 36,
+ Tag_undefined37 = 37,
+ Tag_ABI_FP_16bit_format = 38,
+ Tag_undefined39 = 39,
+ Tag_undefined40 = 40,
+ Tag_undefined41 = 41,
+ Tag_MPextension_use = 42,
+ Tag_undefined43 = 43,
+ Tag_DIV_use = 44,
+ /* Note: 45 - 63 are currently undefined/unused. */
+ Tag_nodefaults = 64,
+ Tag_also_compatible_with = 65,
+ Tag_T2EE_use = 66,
+ Tag_conformance = 67,
+ Tag_Virtualization_use = 68,
+ Tag_undefined69 = 69,
+ Tag_MPextension_use_legacy = 70,
+
+ /* The following tags are legacy names for other tags. */
+ Tag_VFP_arch = Tag_FP_arch,
+ Tag_ABI_align8_needed = Tag_ABI_align_needed,
+ Tag_ABI_align8_preserved = Tag_ABI_align_preserved,
+ Tag_VFP_HP_extension = Tag_FP_HP_extension
+ };
+
+ /* Values for the Tag_CPU_arch EABI attribute. */
+ enum
+ {
+ TAG_CPU_ARCH_PRE_V4,
+ TAG_CPU_ARCH_V4,
+ TAG_CPU_ARCH_V4T,
+ TAG_CPU_ARCH_V5T,
+ TAG_CPU_ARCH_V5TE,
+ TAG_CPU_ARCH_V5TEJ,
+ TAG_CPU_ARCH_V6,
+ TAG_CPU_ARCH_V6KZ,
+ TAG_CPU_ARCH_V6T2,
+ TAG_CPU_ARCH_V6K,
+ TAG_CPU_ARCH_V7,
+ TAG_CPU_ARCH_V6_M,
+ TAG_CPU_ARCH_V6S_M,
+ TAG_CPU_ARCH_V7E_M,
+ MAX_TAG_CPU_ARCH = TAG_CPU_ARCH_V7E_M,
+ /* Pseudo-architecture to allow objects to be compatible with the subset of
+ armv4t and armv6-m. This value should never be stored in object files. */
+ TAG_CPU_ARCH_V4T_PLUS_V6_M = (MAX_TAG_CPU_ARCH + 1)
+ };
+
+ /* Values for Tag_CPU_arch_profile. */
+ enum
+ {
+ ARM_Arch_Profile_None = 0,
+ ARM_Arch_Profile_Application = 'A',
+ ARM_Arch_Profile_Realtime = 'R',
+ ARM_Arch_Profile_Microcontroller = 'M',
+ ARM_Arch_Profile_RealApp = 'S'
+ };
+
+ /* Values for Tag_ABI_PCS_R9_use. */
+ enum
+ {
+ AEABI_R9_V6 = 0,
+ AEABI_R9_SB = 1,
+ AEABI_R9_TLS = 2,
+ AEABI_R9_unused = 3
+ };
+
+ /* Values for Tag_ABI_PCS_RW_data. */
+ enum
+ {
+ AEABI_PCS_RW_data_absolute = 0,
+ AEABI_PCS_RW_data_PCrel = 1,
+ AEABI_PCS_RW_data_SBrel = 2,
+ AEABI_PCS_RW_data_unused = 3
+ };
+
+ /* Values for Tag_ABI_enum_size. */
+ enum
+ {
+ AEABI_enum_unused = 0,
+ AEABI_enum_short = 1,
+ AEABI_enum_wide = 2,
+ AEABI_enum_forced_wide = 3
+ };
+
+ #endif /* _ARM_EABI_ATTRIBUTES_DEFINED_ */
+ #endif /* _ARM_EABI_ATTRIBUTES_ */
+
+
+
+ #ifdef _SPARC_GNU_ATTRIBUTES_
+ #ifndef _SPARC_GNU_ATTRIBUTES_DEFINED_
+ #define _SPARC_GNU_ATTRIBUTES_DEFINED_
+
+ /* Object attribute tags. */
+ enum
+ {
+ /* 0-3 are generic. */
+ Tag_GNU_Sparc_HWCAPS = 4,
+ };
+
+ /* These values match the AV_SPARC_* hwcap bits defined under Solaris. */
+ #define ELF_SPARC_HWCAP_MUL32 0x00000001 /* umul/umulcc/smul/smulcc insns. */
+ #define ELF_SPARC_HWCAP_DIV32 0x00000002 /* udiv/udivcc/sdiv/sdivcc insns. */
+ #define ELF_SPARC_HWCAP_FSMULD 0x00000004 /* 'fsmuld' insn. */
+ #define ELF_SPARC_HWCAP_V8PLUS 0x00000008 /* v9 insns available to 32bit. */
+ #define ELF_SPARC_HWCAP_POPC 0x00000010 /* 'popc' insn. */
+ #define ELF_SPARC_HWCAP_VIS 0x00000020 /* VIS insns. */
+ #define ELF_SPARC_HWCAP_VIS2 0x00000040 /* VIS2 insns. */
+ #define ELF_SPARC_HWCAP_ASI_BLK_INIT \
+ 0x00000080 /* Block init ASIs. */
+ #define ELF_SPARC_HWCAP_FMAF 0x00000100 /* Fused multiply-add. */
+ #define ELF_SPARC_HWCAP_VIS3 0x00000400 /* VIS3 insns. */
+ #define ELF_SPARC_HWCAP_HPC 0x00000800 /* HPC insns. */
+ #define ELF_SPARC_HWCAP_RANDOM 0x00001000 /* 'random' insn. */
+ #define ELF_SPARC_HWCAP_TRANS 0x00002000 /* Transaction insns. */
+ #define ELF_SPARC_HWCAP_FJFMAU 0x00004000 /* Unfused multiply-add. */
+ #define ELF_SPARC_HWCAP_IMA 0x00008000 /* Integer multiply-add. */
+ #define ELF_SPARC_HWCAP_ASI_CACHE_SPARING \
+ 0x00010000 /* Cache sparing ASIs. */
+
+ #endif /* _SPARC_GNU_ATTRIBUTES_DEFINED_ */
+ #endif /* _SPARC_GNU_ATTRIBUTES_ */
+
+
+
+ #ifdef _PPC_GNU_ATTRIBUTES_
+ #ifndef _PPC_GNU_ATTRIBUTES_DEFINED_
+ #define _PPC_GNU_ATTRIBUTES_DEFINED_
+
+ /* Object attribute tags. */
+ enum
+ {
+ /* 0-3 are generic. */
+ Tag_GNU_Power_ABI_FP = 4,
+ Tag_GNU_Power_ABI_Vector = 8,
+ /* Describes how structures <= 8 bytes are returned. */
+ Tag_GNU_Power_ABI_Struct_Return = 12
+ };
+
+ /* Values for the Tag_GNU_Power_ABI_FP attribute. */
+ enum
+ {
+ Power_ABI_FP_Unused = 0,
+ Power_ABI_FP_Hard_Float = 1,
+ Power_ABI_FP_Soft_Float = 2,
+ Power_ABI_FP_Single = 3
+ };
+
+ /* Values for the Tag_GNU_Power_ABI_Vector attribute. */
+ enum
+ {
+ Power_ABI_Vector_Unused = 0,
+ Power_ABI_Vector_GP = 1,
+ Power_ABI_Vector_Altivec = 2,
+ Power_ABI_Vector_SPE = 3
+ };
+
+ /* Values for the Tag_GNU_Power_ABI_Struct_Return attribute. */
+ enum
+ {
+ Power_ABI_Struct_Return_Unused = 0,
+ Power_ABI_Struct_Return_R3R4 = 1,
+ Power_ABI_Struct_Return_Memory = 2
+ };
+
+ #endif /* _PPC_GNU_ATTRIBUTES_DEFINED_ */
+ #endif /* _PCC_GNU_ATTRIBUTES_ */
+
+
+
+ #ifdef _MIPS_GNU_ATTRIBUTES_
+ #ifndef _MIPS_GNU_ATTRIBUTES_DEFINED_
+ #define _MIPS_GNU_ATTRIBUTES_DEFINED_
+
+ /* Object attribute tags. */
+ enum
+ {
+ /* 0-3 are generic. */
+ Tag_GNU_MIPS_ABI_FP = 4
+ };
+
+ /* Values for the Tag_GNU_MIPS_ABI_FP attribute. */
+ enum
+ {
+ MIPS_ABI_FP_Unused = 0,
+ MIPS_ABI_FP_Hard_Double = 1,
+ MIPS_ABI_FP_Hard_Single = 2,
+ MIPS_ABI_FP_Soft = 3,
+ MIPS_ABI_FP_MIPS32R2_64 = 4
+ };
+
+ #endif /* _MIPS_GNU_ATTRIBUTES_DEFINED_ */
+ #endif /* _MIPS_GNU_ATTRIBUTES_ */
+
+
+
+ #ifdef _C6X_GNU_ATTRIBUTES_
+ #ifndef _C6X_GNU_ATTRIBUTES_DEFINED_
+ #define _C6X_GNU_ATTRIBUTES_DEFINED_
+
+ /* Build attributes. */
+ enum
+ {
+ Tag_ISA = 4,
+ Tag_ABI_wchar_t = 6,
+ Tag_ABI_stack_align_needed = 8,
+ Tag_ABI_stack_align_preserved = 10,
+ Tag_ABI_DSBT = 12,
+ Tag_ABI_PID = 14,
+ Tag_ABI_PIC = 16,
+ Tag_ABI_array_object_alignment = 18,
+ Tag_ABI_array_object_align_expected = 20,
+ Tag_ABI_compatibility = 32,
+ Tag_ABI_conformance = 67,
+ Tag_C6XABI_last
+ };
+
+ /* Values for Tag_ISA. GNU-specific names; the ABI does not specify
+ names for these values. */
+ enum
+ {
+ C6XABI_Tag_ISA_none = 0,
+ C6XABI_Tag_ISA_C62X = 1,
+ C6XABI_Tag_ISA_C67X = 3,
+ C6XABI_Tag_ISA_C67XP = 4,
+ C6XABI_Tag_ISA_C64X = 6,
+ C6XABI_Tag_ISA_C64XP = 7,
+ C6XABI_Tag_ISA_C674X = 8
+ };
+
+ #endif /* _C6X_GNU_ATTRIBUTES_DEFINED_ */
+ #endif /* _C6X_GNU_ATTRIBUTES_ */
Index: include/elf/arm.h
===================================================================
RCS file: /cvs/src/src/include/elf/arm.h,v
retrieving revision 1.44
diff -u -3 -p -r1.44 arm.h
--- include/elf/arm.h 31 May 2011 14:07:57 -0000 1.44
+++ include/elf/arm.h 29 Sep 2011 09:27:06 -0000
@@ -86,26 +86,6 @@
#define PF_ARM_PI 0x20000000 /* Segment is position-independent. */
#define PF_ARM_ABS 0x40000000 /* Segment must be loaded at its base address. */
-/* Values for the Tag_CPU_arch EABI attribute. */
-#define TAG_CPU_ARCH_PRE_V4 0
-#define TAG_CPU_ARCH_V4 1
-#define TAG_CPU_ARCH_V4T 2
-#define TAG_CPU_ARCH_V5T 3
-#define TAG_CPU_ARCH_V5TE 4
-#define TAG_CPU_ARCH_V5TEJ 5
-#define TAG_CPU_ARCH_V6 6
-#define TAG_CPU_ARCH_V6KZ 7
-#define TAG_CPU_ARCH_V6T2 8
-#define TAG_CPU_ARCH_V6K 9
-#define TAG_CPU_ARCH_V7 10
-#define TAG_CPU_ARCH_V6_M 11
-#define TAG_CPU_ARCH_V6S_M 12
-#define TAG_CPU_ARCH_V7E_M 13
-#define MAX_TAG_CPU_ARCH 13
-/* Pseudo-architecture to allow objects to be compatible with the subset of
- armv4t and armv6-m. This value should never be stored in object files. */
-#define TAG_CPU_ARCH_V4T_PLUS_V6_M (MAX_TAG_CPU_ARCH + 1)
-
/* Relocation types. */
START_RELOC_NUMBERS (elf_arm_reloc_type)
@@ -252,80 +232,22 @@ START_RELOC_NUMBERS (elf_arm_reloc_type)
END_RELOC_NUMBERS (R_ARM_max = 256)
-#ifdef BFD_ARCH_SIZE
-/* EABI object attributes. */
-
-enum
-{
- /* 0-3 are generic. */
- Tag_CPU_raw_name = 4,
- Tag_CPU_name,
- Tag_CPU_arch,
- Tag_CPU_arch_profile,
- Tag_ARM_ISA_use,
- Tag_THUMB_ISA_use,
- Tag_FP_arch,
- Tag_WMMX_arch,
- Tag_Advanced_SIMD_arch,
- Tag_PCS_config,
- Tag_ABI_PCS_R9_use,
- Tag_ABI_PCS_RW_data,
- Tag_ABI_PCS_RO_data,
- Tag_ABI_PCS_GOT_use,
- Tag_ABI_PCS_wchar_t,
- Tag_ABI_FP_rounding,
- Tag_ABI_FP_denormal,
- Tag_ABI_FP_exceptions,
- Tag_ABI_FP_user_exceptions,
- Tag_ABI_FP_number_model,
- Tag_ABI_align_needed,
- Tag_ABI_align_preserved,
- Tag_ABI_enum_size,
- Tag_ABI_HardFP_use,
- Tag_ABI_VFP_args,
- Tag_ABI_WMMX_args,
- Tag_ABI_optimization_goals,
- Tag_ABI_FP_optimization_goals,
- /* 32 is generic (Tag_compatibility). */
- Tag_undefined33 = 33,
- Tag_CPU_unaligned_access,
- Tag_undefined35,
- Tag_FP_HP_extension,
- Tag_undefined37,
- Tag_ABI_FP_16bit_format,
- Tag_undefined39,
- Tag_undefined40,
- Tag_undefined41,
- Tag_MPextension_use,
- Tag_undefined_43,
- Tag_DIV_use,
- Tag_nodefaults = 64,
- Tag_also_compatible_with,
- Tag_T2EE_use,
- Tag_conformance,
- Tag_Virtualization_use,
- Tag_undefined69,
- Tag_MPextension_use_legacy,
-
- /* The following tags are legacy names for other tags. */
- Tag_VFP_arch = Tag_FP_arch,
- Tag_ABI_align8_needed = Tag_ABI_align_needed,
- Tag_ABI_align8_preserved = Tag_ABI_align_preserved,
- Tag_VFP_HP_extension = Tag_FP_HP_extension
-};
-
-#endif
-
/* The name of the note section used to identify arm variants. */
#define ARM_NOTE_SECTION ".note.gnu.arm.ident"
+#ifdef BFD_ARCH_SIZE
+#define _ARM_EABI_ATTRIBUTES_
+#include "binary-file-attributes.h"
+#endif
+
/* Special section names. */
#define ELF_STRING_ARM_unwind ".ARM.exidx"
#define ELF_STRING_ARM_unwind_info ".ARM.extab"
#define ELF_STRING_ARM_unwind_once ".gnu.linkonce.armexidx."
#define ELF_STRING_ARM_unwind_info_once ".gnu.linkonce.armextab."
-enum arm_st_branch_type {
+enum arm_st_branch_type
+{
ST_BRANCH_TO_ARM,
ST_BRANCH_TO_THUMB,
ST_BRANCH_LONG,
Index: include/elf/mips.h
===================================================================
RCS file: /cvs/src/src/include/elf/mips.h,v
retrieving revision 1.45
diff -u -3 -p -r1.45 mips.h
--- include/elf/mips.h 24 Jul 2011 14:20:12 -0000 1.45
+++ include/elf/mips.h 29 Sep 2011 09:27:06 -0000
@@ -1105,15 +1105,7 @@ extern void bfd_mips_elf64_swap_reginfo_
#define OHWA0_R4KEOP_CLEAN 0x00000002
-/* Object attribute tags. */
-enum
-{
- /* 0-3 are generic. */
- Tag_GNU_MIPS_ABI_FP = 4, /* Value 1 for hard-float -mdouble-float, 2
- for hard-float -msingle-float, 3 for
- soft-float, 4 for -mips32r2 -mfp64; 0 for
- not tagged or not using any ABIs affected
- by the differences. */
-};
+#define _MIPS_GNU_ATTRIBUTES_
+#include "binary-file-attributes.h"
#endif /* _ELF_MIPS_H */
Index: include/elf/ppc.h
===================================================================
RCS file: /cvs/src/src/include/elf/ppc.h,v
retrieving revision 1.30
diff -u -3 -p -r1.30 ppc.h
--- include/elf/ppc.h 11 Jul 2011 15:03:08 -0000 1.30
+++ include/elf/ppc.h 29 Sep 2011 09:27:06 -0000
@@ -178,25 +178,7 @@ END_RELOC_NUMBERS (R_PPC_max)
specified in the associated \
symbol table entry. */
-/* Object attribute tags. */
-enum
-{
- /* 0-3 are generic. */
- Tag_GNU_Power_ABI_FP = 4, /* Value 1 for hard-float, 2 for
- soft-float, 3 for single=precision
- hard-float; 0 for not tagged or not
- using any ABIs affected by the
- differences. */
-
- /* Value 1 for general purpose registers only, 2 for AltiVec
- registers, 3 for SPE registers; 0 for not tagged or not using any
- ABIs affected by the differences. */
- Tag_GNU_Power_ABI_Vector = 8,
-
- /* Value 1 for ABIs using r3/r4 for returning structures <= 8 bytes,
- 2 for ABIs using memory; 0 for not tagged or not using any ABIs
- affected by the differences. */
- Tag_GNU_Power_ABI_Struct_Return = 12
-};
+#define _PPC_GNU_ATTRIBUTES_
+#include "binary-file-attributes.h"
#endif /* _ELF_PPC_H */
Index: include/elf/sparc.h
===================================================================
RCS file: /cvs/src/src/include/elf/sparc.h,v
retrieving revision 1.19
diff -u -3 -p -r1.19 sparc.h
--- include/elf/sparc.h 21 Sep 2011 20:49:15 -0000 1.19
+++ include/elf/sparc.h 29 Sep 2011 09:27:06 -0000
@@ -186,31 +186,7 @@ END_RELOC_NUMBERS (R_SPARC_max)
#define DT_SPARC_REGISTER 0x70000001
-/* Object attribute tags. */
-enum
-{
- /* 0-3 are generic. */
- Tag_GNU_Sparc_HWCAPS = 4,
-};
-
-/* These values match the AV_SPARC_* hwcap bits defined under Solaris. */
-#define ELF_SPARC_HWCAP_MUL32 0x00000001 /* umul/umulcc/smul/smulcc insns */
-#define ELF_SPARC_HWCAP_DIV32 0x00000002 /* udiv/udivcc/sdiv/sdivcc insns */
-#define ELF_SPARC_HWCAP_FSMULD 0x00000004 /* 'fsmuld' insn */
-#define ELF_SPARC_HWCAP_V8PLUS 0x00000008 /* v9 insns available to 32bit */
-#define ELF_SPARC_HWCAP_POPC 0x00000010 /* 'popc' insn */
-#define ELF_SPARC_HWCAP_VIS 0x00000020 /* VIS insns */
-#define ELF_SPARC_HWCAP_VIS2 0x00000040 /* VIS2 insns */
-#define ELF_SPARC_HWCAP_ASI_BLK_INIT \
- 0x00000080 /* block init ASIs */
-#define ELF_SPARC_HWCAP_FMAF 0x00000100 /* fused multiply-add */
-#define ELF_SPARC_HWCAP_VIS3 0x00000400 /* VIS3 insns */
-#define ELF_SPARC_HWCAP_HPC 0x00000800 /* HPC insns */
-#define ELF_SPARC_HWCAP_RANDOM 0x00001000 /* 'random' insn */
-#define ELF_SPARC_HWCAP_TRANS 0x00002000 /* transaction insns */
-#define ELF_SPARC_HWCAP_FJFMAU 0x00004000 /* unfused multiply-add */
-#define ELF_SPARC_HWCAP_IMA 0x00008000 /* integer multiply-add */
-#define ELF_SPARC_HWCAP_ASI_CACHE_SPARING \
- 0x00010000 /* cache sparing ASIs */
+#define _SPARC_GNU_ATTRIBUTES_
+#include "binary-file-attributes.h"
#endif /* _ELF_SPARC_H */
Index: include/elf/tic6x.h
===================================================================
RCS file: /cvs/src/src/include/elf/tic6x.h,v
retrieving revision 1.5
diff -u -3 -p -r1.5 tic6x.h
--- include/elf/tic6x.h 9 May 2011 13:17:58 -0000 1.5
+++ include/elf/tic6x.h 29 Sep 2011 09:27:06 -0000
@@ -136,27 +136,8 @@ END_RELOC_NUMBERS (R_TIC6X_max)
/* Segment cannot be further relocated. */
#define PHA_READONLY 0x2
-/* Build attributes. */
-enum
- {
-#define TAG(tag, value) tag = value,
-#include "elf/tic6x-attrs.h"
-#undef TAG
- Tag_C6XABI_last
- };
-
-/* Values for Tag_ISA. GNU-specific names; the ABI does not specify
- names for these values. */
-enum
- {
- C6XABI_Tag_ISA_none = 0,
- C6XABI_Tag_ISA_C62X = 1,
- C6XABI_Tag_ISA_C67X = 3,
- C6XABI_Tag_ISA_C67XP = 4,
- C6XABI_Tag_ISA_C64X = 6,
- C6XABI_Tag_ISA_C64XP = 7,
- C6XABI_Tag_ISA_C674X = 8
- };
+#define _C6X_GNU_ATTRIBUTES_
+#include "binary-file-attributes.h"
/* Special section names. */
#define ELF_STRING_C6000_unwind ".c6xabi.exidx"
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.555
diff -u -3 -p -r1.555 readelf.c
--- binutils/readelf.c 27 Sep 2011 12:05:33 -0000 1.555
+++ binutils/readelf.c 29 Sep 2011 09:27:07 -0000
@@ -10669,6 +10669,27 @@ process_mips_fpe_exception (int mask)
fputs ("0", stdout);
}
+static unsigned char *
+print_generic_tag (bfd_boolean is_string, unsigned char *p)
+{
+ unsigned int len;
+ int val;
+
+ if (is_string)
+ {
+ printf ("\"%s\"\n", p);
+ len = strlen ((char *) p) + 1;
+ }
+ else
+ {
+ val = read_uleb128 (p, & len);
+ printf ("%d (0x%x)\n", val, val);
+ }
+
+ return p + len;
+}
+
+
/* ARM EABI attributes section. */
typedef struct
{
@@ -10741,50 +10762,51 @@ static const char * arm_attr_tag_Virtual
static const char * arm_attr_tag_MPextension_use_legacy[] =
{"Not Allowed", "Allowed"};
-#define LOOKUP(id, name) \
- {id, #name, 0x80 | ARRAY_SIZE(arm_attr_tag_##name), arm_attr_tag_##name}
+#define LOOKUP(name) \
+ {Tag_##name, #name, 0x80 | ARRAY_SIZE(arm_attr_tag_##name), arm_attr_tag_##name}
+
static arm_attr_public_tag arm_attr_public_tags[] =
{
- {4, "CPU_raw_name", 1, NULL},
- {5, "CPU_name", 1, NULL},
- LOOKUP(6, CPU_arch),
- {7, "CPU_arch_profile", 0, NULL},
- LOOKUP(8, ARM_ISA_use),
- LOOKUP(9, THUMB_ISA_use),
- LOOKUP(10, FP_arch),
- LOOKUP(11, WMMX_arch),
- LOOKUP(12, Advanced_SIMD_arch),
- LOOKUP(13, PCS_config),
- LOOKUP(14, ABI_PCS_R9_use),
- LOOKUP(15, ABI_PCS_RW_data),
- LOOKUP(16, ABI_PCS_RO_data),
- LOOKUP(17, ABI_PCS_GOT_use),
- LOOKUP(18, ABI_PCS_wchar_t),
- LOOKUP(19, ABI_FP_rounding),
- LOOKUP(20, ABI_FP_denormal),
- LOOKUP(21, ABI_FP_exceptions),
- LOOKUP(22, ABI_FP_user_exceptions),
- LOOKUP(23, ABI_FP_number_model),
+ {Tag_CPU_raw_name, "CPU_raw_name", 1, NULL},
+ {Tag_CPU_name, "CPU_name", 1, NULL},
+ LOOKUP (CPU_arch),
+ {Tag_CPU_arch_profile, "CPU_arch_profile", 0, NULL},
+ LOOKUP (ARM_ISA_use),
+ LOOKUP (THUMB_ISA_use),
+ LOOKUP (FP_arch),
+ LOOKUP (WMMX_arch),
+ LOOKUP (Advanced_SIMD_arch),
+ LOOKUP (PCS_config),
+ LOOKUP (ABI_PCS_R9_use),
+ LOOKUP (ABI_PCS_RW_data),
+ LOOKUP (ABI_PCS_RO_data),
+ LOOKUP (ABI_PCS_GOT_use),
+ LOOKUP (ABI_PCS_wchar_t),
+ LOOKUP (ABI_FP_rounding),
+ LOOKUP (ABI_FP_denormal),
+ LOOKUP (ABI_FP_exceptions),
+ LOOKUP (ABI_FP_user_exceptions),
+ LOOKUP (ABI_FP_number_model),
{24, "ABI_align_needed", 0, NULL},
{25, "ABI_align_preserved", 0, NULL},
- LOOKUP(26, ABI_enum_size),
- LOOKUP(27, ABI_HardFP_use),
- LOOKUP(28, ABI_VFP_args),
- LOOKUP(29, ABI_WMMX_args),
- LOOKUP(30, ABI_optimization_goals),
- LOOKUP(31, ABI_FP_optimization_goals),
+ LOOKUP (ABI_enum_size),
+ LOOKUP (ABI_HardFP_use),
+ LOOKUP (ABI_VFP_args),
+ LOOKUP (ABI_WMMX_args),
+ LOOKUP (ABI_optimization_goals),
+ LOOKUP (ABI_FP_optimization_goals),
{32, "compatibility", 0, NULL},
- LOOKUP(34, CPU_unaligned_access),
- LOOKUP(36, FP_HP_extension),
- LOOKUP(38, ABI_FP_16bit_format),
- LOOKUP(42, MPextension_use),
- LOOKUP(44, DIV_use),
+ LOOKUP (CPU_unaligned_access),
+ LOOKUP (FP_HP_extension),
+ LOOKUP (ABI_FP_16bit_format),
+ LOOKUP (MPextension_use),
+ LOOKUP (DIV_use),
{64, "nodefaults", 0, NULL},
{65, "also_compatible_with", 0, NULL},
- LOOKUP(66, T2EE_use),
+ LOOKUP (T2EE_use),
{67, "conformance", 1, NULL},
- LOOKUP(68, Virtualization_use),
- LOOKUP(70, MPextension_use_legacy)
+ LOOKUP (Virtualization_use),
+ LOOKUP (MPextension_use_legacy)
};
#undef LOOKUP
@@ -10818,21 +10840,21 @@ display_arm_attribute (unsigned char * p
case 0:
switch (tag)
{
- case 7: /* Tag_CPU_arch_profile. */
+ case Tag_CPU_arch_profile:
val = read_uleb128 (p, &len);
p += len;
switch (val)
{
- case 0: printf (_("None\n")); break;
- case 'A': printf (_("Application\n")); break;
- case 'R': printf (_("Realtime\n")); break;
- case 'M': printf (_("Microcontroller\n")); break;
- case 'S': printf (_("Application or Realtime\n")); break;
+ case ARM_Arch_Profile_None: printf (_("None\n")); break;
+ case ARM_Arch_Profile_Application: printf (_("Application\n")); break;
+ case ARM_Arch_Profile_Realtime: printf (_("Realtime\n")); break;
+ case ARM_Arch_Profile_Microcontroller: printf (_("Microcontroller\n")); break;
+ case ARM_Arch_Profile_RealApp: printf (_("Application or Realtime\n")); break;
default: printf ("??? (%d)\n", val); break;
}
break;
- case 24: /* Tag_align_needed. */
+ case Tag_ABI_align_needed:
val = read_uleb128 (p, &len);
p += len;
switch (val)
@@ -10851,7 +10873,7 @@ display_arm_attribute (unsigned char * p
}
break;
- case 25: /* Tag_align_preserved. */
+ case Tag_ABI_align_preserved:
val = read_uleb128 (p, &len);
p += len;
switch (val)
@@ -10877,15 +10899,15 @@ display_arm_attribute (unsigned char * p
p += strlen ((char *) p) + 1;
break;
- case 64: /* Tag_nodefaults. */
+ case Tag_nodefaults:
p++;
printf (_("True\n"));
break;
- case 65: /* Tag_also_compatible_with. */
+ case Tag_also_compatible_with:
val = read_uleb128 (p, &len);
p += len;
- if (val == 6 /* Tag_CPU_arch. */)
+ if (val == Tag_CPU_arch)
{
val = read_uleb128 (p, &len);
p += len;
@@ -10930,19 +10952,7 @@ display_arm_attribute (unsigned char * p
printf (" Tag_unknown_%d: ", tag);
}
- if (type == 1)
- {
- printf ("\"%s\"\n", p);
- p += strlen ((char *) p) + 1;
- }
- else
- {
- val = read_uleb128 (p, &len);
- p += len;
- printf ("%d (0x%x)\n", val, val);
- }
-
- return p;
+ return print_generic_tag (type == 1, p);
}
static unsigned char *
@@ -10952,14 +10962,13 @@ display_gnu_attribute (unsigned char * p
int tag;
unsigned int len;
int val;
- int type;
tag = read_uleb128 (p, &len);
p += len;
/* Tag_compatibility is the only generic GNU attribute defined at
present. */
- if (tag == 32)
+ if (tag == Tag_GNU_Generic_compatibility)
{
val = read_uleb128 (p, &len);
p += len;
@@ -10971,31 +10980,14 @@ display_gnu_attribute (unsigned char * p
if ((tag & 2) == 0 && display_proc_gnu_attribute)
return display_proc_gnu_attribute (p, tag);
- if (tag & 1)
- type = 1; /* String. */
- else
- type = 2; /* uleb128. */
printf (" Tag_unknown_%d: ", tag);
- if (type == 1)
- {
- printf ("\"%s\"\n", p);
- p += strlen ((char *) p) + 1;
- }
- else
- {
- val = read_uleb128 (p, &len);
- p += len;
- printf ("%d (0x%x)\n", val, val);
- }
-
- return p;
+ return print_generic_tag (tag & 1, p);
}
static unsigned char *
display_power_gnu_attribute (unsigned char * p, int tag)
{
- int type;
unsigned int len;
int val;
@@ -11007,16 +10999,16 @@ display_power_gnu_attribute (unsigned ch
switch (val)
{
- case 0:
+ case Power_ABI_FP_Unused:
printf (_("Hard or soft float\n"));
break;
- case 1:
+ case Power_ABI_FP_Hard_Float:
printf (_("Hard float\n"));
break;
- case 2:
+ case Power_ABI_FP_Soft_Float:
printf (_("Soft float\n"));
break;
- case 3:
+ case Power_ABI_FP_Single:
printf (_("Single-precision hard float\n"));
break;
default:
@@ -11033,16 +11025,16 @@ display_power_gnu_attribute (unsigned ch
printf (" Tag_GNU_Power_ABI_Vector: ");
switch (val)
{
- case 0:
+ case Power_ABI_Vector_Unused:
printf (_("Any\n"));
break;
- case 1:
+ case Power_ABI_Vector_GP:
printf (_("Generic\n"));
break;
- case 2:
+ case Power_ABI_Vector_Altivec:
printf ("AltiVec\n");
break;
- case 3:
+ case Power_ABI_Vector_SPE:
printf ("SPE\n");
break;
default:
@@ -11059,13 +11051,13 @@ display_power_gnu_attribute (unsigned ch
printf (" Tag_GNU_Power_ABI_Struct_Return: ");
switch (val)
{
- case 0:
+ case Power_ABI_Struct_Return_Unused:
printf (_("Any\n"));
break;
- case 1:
+ case Power_ABI_Struct_Return_R3R4:
printf ("r3/r4\n");
break;
- case 2:
+ case Power_ABI_Struct_Return_Memory:
printf (_("Memory\n"));
break;
default:
@@ -11075,25 +11067,9 @@ display_power_gnu_attribute (unsigned ch
return p;
}
- if (tag & 1)
- type = 1; /* String. */
- else
- type = 2; /* uleb128. */
printf (" Tag_unknown_%d: ", tag);
- if (type == 1)
- {
- printf ("\"%s\"\n", p);
- p += strlen ((char *) p) + 1;
- }
- else
- {
- val = read_uleb128 (p, &len);
- p += len;
- printf ("%d (0x%x)\n", val, val);
- }
-
- return p;
+ return print_generic_tag (tag & 1, p);
}
static void
@@ -11102,6 +11078,7 @@ display_sparc_hwcaps (int mask)
if (mask)
{
int first = 1;
+
if (mask & ELF_SPARC_HWCAP_MUL32)
fputs ("mul32", stdout), first = 0;
if (mask & ELF_SPARC_HWCAP_DIV32)
@@ -11136,14 +11113,13 @@ display_sparc_hwcaps (int mask)
printf ("%scspare", first ? "" : "|"), first = 0;
}
else
- fputc('0', stdout);
- fputc('\n', stdout);
+ fputc ('0', stdout);
+ fputc ('\n', stdout);
}
static unsigned char *
display_sparc_gnu_attribute (unsigned char * p, int tag)
{
- int type;
unsigned int len;
int val;
@@ -11157,31 +11133,15 @@ display_sparc_gnu_attribute (unsigned ch
return p;
}
- if (tag & 1)
- type = 1; /* String. */
- else
- type = 2; /* uleb128. */
printf (" Tag_unknown_%d: ", tag);
- if (type == 1)
- {
- printf ("\"%s\"\n", p);
- p += strlen ((char *) p) + 1;
- }
- else
- {
- val = read_uleb128 (p, &len);
- p += len;
- printf ("%d (0x%x)\n", val, val);
- }
+ return print_generic_tag (tag & 1, p);
- return p;
}
static unsigned char *
display_mips_gnu_attribute (unsigned char * p, int tag)
{
- int type;
unsigned int len;
int val;
@@ -11193,19 +11153,19 @@ display_mips_gnu_attribute (unsigned cha
switch (val)
{
- case 0:
+ case MIPS_ABI_FP_Unused:
printf (_("Hard or soft float\n"));
break;
- case 1:
+ case MIPS_ABI_FP_Hard_Double:
printf (_("Hard float (double precision)\n"));
break;
- case 2:
+ case MIPS_ABI_FP_Hard_Single:
printf (_("Hard float (single precision)\n"));
break;
- case 3:
+ case MIPS_ABI_FP_Soft:
printf (_("Soft float\n"));
break;
- case 4:
+ case MIPS_ABI_FP_MIPS32R2_64:
printf (_("Hard float (MIPS32r2 64-bit FPU)\n"));
break;
default:
@@ -11215,25 +11175,9 @@ display_mips_gnu_attribute (unsigned cha
return p;
}
- if (tag & 1)
- type = 1; /* String. */
- else
- type = 2; /* uleb128. */
printf (" Tag_unknown_%d: ", tag);
- if (type == 1)
- {
- printf ("\"%s\"\n", p);
- p += strlen ((char *) p) + 1;
- }
- else
- {
- val = read_uleb128 (p, &len);
- p += len;
- printf ("%d (0x%x)\n", val, val);
- }
-
- return p;
+ return print_generic_tag (tag & 1, p);
}
static unsigned char *
@@ -11455,19 +11399,7 @@ display_tic6x_attribute (unsigned char *
printf (" Tag_unknown_%d: ", tag);
- if (tag & 1)
- {
- printf ("\"%s\"\n", p);
- p += strlen ((char *) p) + 1;
- }
- else
- {
- val = read_uleb128 (p, &len);
- p += len;
- printf ("%d (0x%x)\n", val, val);
- }
-
- return p;
+ return print_generic_tag (tag & 1, p);
}
static int
@@ -11557,13 +11489,13 @@ process_attributes (FILE * file,
switch (tag)
{
- case 1:
+ case Tag_GNU_Generic_File_attributes:
printf (_("File Attributes\n"));
break;
- case 2:
+ case Tag_GNU_Generic_Section_attributes:
printf (_("Section Attributes:"));
goto do_numlist;
- case 3:
+ case Tag_GNU_Generic_Symbol_attributes:
printf (_("Symbol Attributes:"));
do_numlist:
for (;;)
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.275
diff -u -3 -p -r1.275 elf32-arm.c
--- bfd/elf32-arm.c 1 Sep 2011 14:10:39 -0000 1.275
+++ bfd/elf32-arm.c 29 Sep 2011 09:27:08 -0000
@@ -10875,33 +10875,6 @@ elf32_arm_copy_private_bfd_data (bfd *ib
return TRUE;
}
-/* Values for Tag_ABI_PCS_R9_use. */
-enum
-{
- AEABI_R9_V6,
- AEABI_R9_SB,
- AEABI_R9_TLS,
- AEABI_R9_unused
-};
-
-/* Values for Tag_ABI_PCS_RW_data. */
-enum
-{
- AEABI_PCS_RW_data_absolute,
- AEABI_PCS_RW_data_PCrel,
- AEABI_PCS_RW_data_SBrel,
- AEABI_PCS_RW_data_unused
-};
-
-/* Values for Tag_ABI_enum_size. */
-enum
-{
- AEABI_enum_unused,
- AEABI_enum_short,
- AEABI_enum_wide,
- AEABI_enum_forced_wide
-};
-
/* Determine whether an object attribute tag takes an integer, a
string or both. */
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c (revision 179334)
+++ gcc/config/arm/arm.c (working copy)
@@ -22220,6 +22220,26 @@
asm_fprintf (stream, "%U%s", name);
}
+/* Get the definitions of the ARM EABI Attribute tag values. */
+#define _ARM_EABI_ATTRIBUTES_
+#include "binary-file-attributes.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). If requested 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", name, val);\
+ if (flag_verbose_asm || flag_debug_asm) \
+ asm_fprintf (asm_out_file, "\t%s " #name, ASM_COMMENT_START); \
+ asm_fprintf (asm_out_file, "\n"); \
+ } \
+ while (0)
+
+
static void
arm_file_start (void)
{
@@ -22248,12 +22268,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 +22283,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 +22311,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