Using as: Object Attributes

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

# 8. Object Attributes

`as` assembles source files written for a specific architecture into object files for that architecture. But not all object files are alike. Many architectures support incompatible variations. For instance, floating point arguments might be passed in floating point registers if the object file requires hardware floating point support--or floating point arguments might be passed in integer registers if the object file supports processors with no hardware floating point unit. Or, if two objects are built for different generations of the same architecture, the combination may require the newer generation at run-time.

This information is useful during and after linking. At link time, `ld` can warn about incompatible object files. After link time, tools like `gdb` can use it to process the linked file correctly.

Compatibility information is recorded as a series of object attributes. Each attribute has a vendor, tag, and value. The vendor is a string, and indicates who sets the meaning of the tag. The tag is an integer, and indicates what property the attribute describes. The value may be a string or an integer, and indicates how the property affects this object. Missing attributes are the same as attributes with a zero value or empty string value.

Object attributes were developed as part of the ABI for the ARM Architecture. The file format is documented in ELF for the ARM Architecture.

> 8.1 GNU Object Attributes |  |
> 8.2 Defining New Object Attributes |  |

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 8.1 GNU Object Attributes

The `.gnu_attribute` directive records an object attribute with vendor ``gnu'`.

Except for ``Tag_compatibility'`, which has both an integer and a string for its value, GNU attributes have a string value if the tag number is odd and an integer value if the tag number is even. The second bit (`tag & 2` is set for architecture-independent attributes and clear for architecture-dependent ones.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 8.1.1 Common GNU attributes

These attributes are valid on all architectures.

Tag_compatibility (32)
  The compatibility attribute takes an integer flag value and a vendor name. If the flag value is 0, the file is compatible with other toolchains. If it is 1, then the file is only compatible with the named toolchain. If it is greater than 1, the file can only be processed by other toolchains under some private arrangement indicated by the flag value and the vendor name.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 8.1.2 MIPS Attributes

Tag_GNU_MIPS_ABI_FP (4)
  The floating-point ABI used by this object file. The value will be:

  - 0 for files not affected by the floating-point ABI.
  - 1 for files using the hardware floating-point with a standard double-precision FPU.
  - 2 for files using the hardware floating-point ABI with a single-precision FPU.
  - 3 for files using the software floating-point ABI.
  - 4 for files using the hardware floating-point ABI with 64-bit wide double-precision floating-point registers and 32-bit wide general purpose registers.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

### 8.1.3 PowerPC Attributes

Tag_GNU_Power_ABI_FP (4)
  The floating-point ABI used by this object file. The value will be:

  - 0 for files not affected by the floating-point ABI.
  - 1 for files using double-precision hardware floating-point ABI.
  - 2 for files using the software floating-point ABI.
  - 3 for files using single-precision hardware floating-point ABI.

Tag_GNU_Power_ABI_Vector (8)
  The vector ABI used by this object file. The value will be:

  - 0 for files not affected by the vector ABI.
  - 1 for files using general purpose registers to pass vectors.
  - 2 for files using AltiVec registers to pass vectors.
  - 3 for files using SPE registers to pass vectors.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 8.2 Defining New Object Attributes

If you want to define a new GNU object attribute, here are the places you will need to modify. New attributes should be discussed on the ``binutils'` mailing list.

- This manual, which is the official register of attributes.
- The header for your architecture ``include/elf'`, to define the tag.
- The ``bfd'` support file for your architecture, to merge the attribute and issue any appropriate link warnings.
- Test cases in ``ld/testsuite'` for merging and link warnings.
- ``binutils/readelf.c'` to display your attribute.
- GCC, if you want the compiler to mark the attribute automatically.

[ << ] | [ >> ] |  |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated by GNAT Mailserver on April, 10 2014 using texi2html