GCS (Guarded Control Stack, an Armv9.4-a extension) requires some caution at runtime. The runtime linker needs to reason about the compatibility of a set of relocable object files that might not have been compiled with the same compiler. Up until now, those metadata, used for the previously mentioned runtime checks, have been provided to the runtime linker via GNU properties which are stored in the ELF section ".note.gnu.property". However, GNU properties are limited in their expressibility, and a long-term commmitment was taken in the ABI for the Arm architecture [1] to provide Build Attributes (a.k.a. BAs).
The series is composed of the following three patches: 1. Patch adding assembly debug comments (-dA) to the existing GNU properties, to improve testing and check the correctness of values. 2. A refactoring of the code emitting GNU properties. 3. The patch adding support for AEABI Build Attributes [1] in the context of GCS (Guarded Control Stack, an Armv9.4-a extension) to the AArch64 backend. **Special note regarding (3):** If Gas has support for build attributes, GCC will only emit Build Attributes. Then the GNU linker will translate the Build Attributes to GNU properties, and both of them will be stored into the output object. Bootstrapped on aarch64-none-linux-gnu, and no regression found. Regards, Matthieu ## References - [1]: [Build Attributes for the ArmĀ® 64-bit Architecture (AArch64)](https://github.com/ARM-software/abi-aa/blob/eec881270d5e3b23e58a6250640d06ff545ec1fc/buildattr64/buildattr64.rst) - [2]: https://gcc.gnu.org/pipermail/gcc-patches/2024-September/662825.html - [3]: https://gcc.gnu.org/pipermail/gcc-patches/2024-September/664004.html - [4]: https://gcc.gnu.org/pipermail/gcc-patches/2024-October/666178.html ## Previous revisions Diff with revision 3 [4]: - align the implementation with the latest revision of the AEABI Build Attributes specifications. - reorganize the series so that the two refactoring patches related to GNU properties are coming first, and can be merged earlier. - merge the two previous patches implementing the BAs into one. Diff with revision 2 [3]: - address comments of Richard Sandiford in revision 2. - fix several formatting mistakes. - remove RFC tag. Diff with revision 1 [2]: - update the description of (2) - address the comments related to the tests in (2) - add new commits (1), (3) and (4) Matthieu Longo (3): aarch64: add debug comments to feature properties in .note.gnu.property aarch64: encapsulate note.gnu.property emission into a class aarch64: add support for AEABI Build Attributes gcc/config.gcc | 2 +- gcc/config.in | 6 + gcc/config/aarch64/aarch64-dwarf-metadata.cc | 145 ++++++++++ gcc/config/aarch64/aarch64-dwarf-metadata.h | 253 ++++++++++++++++++ gcc/config/aarch64/aarch64-protos.h | 1 + gcc/config/aarch64/aarch64.cc | 82 +++--- gcc/config/aarch64/t-aarch64 | 10 + gcc/configure | 37 +++ gcc/configure.ac | 9 + gcc/testsuite/gcc.target/aarch64/bti-1.c | 13 +- .../aarch64-build-attributes.exp | 35 +++ .../build-attributes/build-attribute-bti.c | 11 + .../build-attributes/build-attribute-gcs.c | 11 + .../build-attributes/build-attribute-pac.c | 11 + .../build-attribute-standard.c | 13 + .../build-attributes/no-build-attribute-bti.c | 12 + .../build-attributes/no-build-attribute-gcs.c | 12 + .../build-attributes/no-build-attribute-pac.c | 12 + .../no-build-attribute-standard.c | 12 + gcc/testsuite/lib/target-supports.exp | 15 ++ 20 files changed, 651 insertions(+), 51 deletions(-) create mode 100644 gcc/config/aarch64/aarch64-dwarf-metadata.cc create mode 100644 gcc/config/aarch64/aarch64-dwarf-metadata.h create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/aarch64-build-attributes.exp create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-bti.c create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-gcs.c create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-pac.c create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/build-attribute-standard.c create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-bti.c create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-gcs.c create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-pac.c create mode 100644 gcc/testsuite/gcc.target/aarch64/build-attributes/no-build-attribute-standard.c -- 2.49.0