aarch64: merge of Object Attributes v2 during linkage
This patch adds support to AArch64 backend to process AEABI Build
Attributes and raise any compatibility issue.
AArch64 backend declares 2 vendor subsections, and their associated tags:
- aeabi_feature_and_bits: contains tags that describe the same optional
bits as the GNU_PROPERTY_AARCH64_FEATURE_1_AND. For now, the following
attributes are recognized:
- Tag_Feature_BTI: means that all the executable sections are
compatible with Branch Target Identification (BTI) mechanism.
- Tag_Feature_PAC: means that all the executable sections have been
protected with Return Address Signing.
- Tag_Feature_GCS: means that all the executable sections are
compatible with the Guarded Control Stack (GCS) extension.
- aeabi_pauthabi: contains information about the Pointer Authentication
Signing schema when the object uses an extension to ELF, PAUTHABI64,
which is currently not supported by GCC toolchain. The pointers that
are signed as well as the modifiers and key used for each type of
pointer are known as the signing schema. The support of this
subsection is there for completeness with the AEABI Build Attributes
document, and allows readelf to dump the data nicely, and the linker
to detect a use of a signing schema, and error.
- Tag_PAuth_Paltform: the platform vendor id.
- Tag_PAuth_Schema: the version numner of the schema.
For backward-compatibilty purpose, AArch64 backend translates
GNU_PROPERTY_AARCH64_FEATURE_1_AND in input files to its OAv2 equivalents.
The frozen set of OAv2 is populated with values derived from command-line
options for BTI (-z force-bti) and GCS (-z gcs=*).
It also reports incompatibilities for BTI and GCS, and set BTI PLT type
depending on the OAv2 merge result.
Regarding incompatibilities, only the ones detected in objects constituting
the output link unit will be reported. Supports for detecting incompatibilities
in shared objects might be a future work to bring it in pair with the GNU
properties merge. However, since OAv2 are translated to GNU properties,
detection will still happen so this feature seems redundant and of little
value given the backward compatibility support for GNU properties is
required (see next paragraph).
Finally, it translates OAv2s in subsection "aeabi_feature_and_bits" to
GNU_PROPERTY_AARCH64_FEATURE_1_AND as GNU properties are required for
the dynamic linker (it does not understand OAv2s yet).