MIPS object attributes
Joseph S. Myers
joseph@codesourcery.com
Sat Jun 30 17:52:00 GMT 2007
Following the object attribute tagging discussion
<http://gcc.gnu.org/ml/gcc/2007-06/msg00654.html> and my implementation of
this in binutils, now checked in, here is a first patch to use
.gnu_attribute in GCC.
This patch marks the MIPS floating-point ABI; the assigned values for MIPS
.gnu_attribute can be found in include/elf/mips.h in the src repository;
for the convention of which numbers take strings and which integers, and
which are target-dependent or target-independent, see
bfd/elf-attrs.c:gnu_obj_attrs_arg_type.
Once this is in I'll submit a separate patch to do much the same thing for
Power, and other attributes (possibly including target-independent ones)
may be allocated and output by GCC as and when it's found useful to output
additional information. For now the configure checks are target-dependent
since the supported attributes are; I expect they'll move to
target-independent when we have some target-independent attributes to
record on all ELF targets.
A GDB patch to use this information from MIPS and Power objects should
follow in due course.
Tested with no regressions with cross to mips-linux-gnu. OK to commit?
2007-06-30 Joseph Myers <joseph@codesourcery.com>
* configure.ac: Check for .gnu_attribute on MIPS.
* configure, config.in: Regenerate.
* config/mips/mips.c (mips_file_start): If supported, output
attribute for floating-point ABI.
Index: configure.ac
===================================================================
--- configure.ac (revision 126119)
+++ configure.ac (working copy)
@@ -2943,6 +2943,12 @@
gcc_cv_as_mips_no_shared, [2,16,0], [-mno-shared], [nop],,
[AC_DEFINE(HAVE_AS_NO_SHARED, 1,
[Define if the assembler understands -mno-shared.])])
+
+ gcc_GAS_CHECK_FEATURE([.gnu_attribute support],
+ gcc_cv_as_mips_gnu_attribute, [2,18,0],,
+ [.gnu_attribute 4,1],,
+ [AC_DEFINE(HAVE_AS_GNU_ATTRIBUTE, 1,
+ [Define if your assembler supports .gnu_attribute.])])
;;
esac
Index: config/mips/mips.c
===================================================================
--- config/mips/mips.c (revision 126119)
+++ config/mips/mips.c (working copy)
@@ -6010,6 +6010,11 @@
if (!TARGET_IRIX)
{
+#ifdef HAVE_AS_GNU_ATTRIBUTE
+ fprintf (asm_out_file, "\t.gnu_attribute 4, %d\n",
+ TARGET_HARD_FLOAT ? (TARGET_DOUBLE_FLOAT ? 1 : 2) : 3);
+#endif
+
/* Generate a special section to describe the ABI switches used to
produce the resultant binary. This used to be done by the assembler
setting bits in the ELF header's flags field, but we have run out of
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc-patches
mailing list