[v2,0/4] aarch64: add minimal support of AEABI build attributes for GCS

Message ID 20241023103600.500910-1-matthieu.longo@arm.com
Headers
Series aarch64: add minimal support of AEABI build attributes for GCS |

Message

Matthieu Longo Oct. 23, 2024, 10:35 a.m. UTC
  The primary focus of this patch series is to add support for build attributes in the context of GCS (Guarded Control Stack, an Armv9.4-a extension) to the AArch64 backend.
It addresses comments from revision 1 [2] and 2 [3], and proposes a different approach compared to the previous implementation of the build attributes.

The series is composed of the following 4 patches:
1. Patch adding assembly debug comments (-dA) to the existing GNU properties, to improve testing and check the correctness of values.
2. The minimal patch adding support for build attributes in the context of GCS.
3. A refactoring of (2) to make things less error-prone and more modular, add support for asciz attributes and more debug information.
4. A refactoring of (1) relying partly on (3).
The targeted final state of this series would consist in squashing (2) + (3), and (1) + (4).

**Special note regarding (2):** If Gas has support for build attributes, both build attributes and GNU properties will be emitted. This behavior is still open for discussion. Please, let me know your thoughts regarding this behavior.

This patch series needs to be applied on top of the patch series for GCS [1].

Bootstrapped on aarch64-none-linux-gnu, and no regression found.

[1]: https://gcc.gnu.org/git/?p=gcc.git;a=shortlog;h=refs/vendors/ARM/heads/gcs
[2]: https://gcc.gnu.org/pipermail/gcc-patches/2024-September/662825.html
[3]: https://gcc.gnu.org/pipermail/gcc-patches/2024-September/664004.html

Regards,
Matthieu

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)

Diff with revision 2 [3]:
- address comments of Richard Sandiford in revision 2.
- fix several formatting mistakes.
- remove RFC tag.


Matthieu Longo (3):
  aarch64: add debug comments to feature properties in .note.gnu.property
  aarch64: improve assembly debug comments for AEABI build attributes
  aarch64: encapsulate note.gnu.property emission into a class

Srinath Parvathaneni (1):
  aarch64: add minimal support of AEABI build attributes for GCS.

 gcc/config.gcc                                |   2 +-
 gcc/config.in                                 |   6 +
 gcc/config/aarch64/aarch64-dwarf-metadata.cc  | 145 +++++++++++
 gcc/config/aarch64/aarch64-dwarf-metadata.h   | 245 ++++++++++++++++++
 gcc/config/aarch64/aarch64.cc                 |  69 ++---
 gcc/config/aarch64/t-aarch64                  |  10 +
 gcc/configure                                 |  38 +++
 gcc/configure.ac                              |  10 +
 gcc/testsuite/gcc.target/aarch64/bti-1.c      |  13 +-
 .../aarch64-build-attributes.exp              |  35 +++
 .../build-attributes/build-attribute-gcs.c    |  12 +
 .../build-attribute-standard.c                |  12 +
 .../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         |  16 ++
 17 files changed, 611 insertions(+), 50 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-gcs.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
  

Comments

Richard Sandiford Oct. 23, 2024, 4:43 p.m. UTC | #1
Matthieu Longo <matthieu.longo@arm.com> writes:
> The primary focus of this patch series is to add support for build attributes in the context of GCS (Guarded Control Stack, an Armv9.4-a extension) to the AArch64 backend.
> It addresses comments from revision 1 [2] and 2 [3], and proposes a different approach compared to the previous implementation of the build attributes.
>
> The series is composed of the following 4 patches:
> 1. Patch adding assembly debug comments (-dA) to the existing GNU properties, to improve testing and check the correctness of values.
> 2. The minimal patch adding support for build attributes in the context of GCS.
> 3. A refactoring of (2) to make things less error-prone and more modular, add support for asciz attributes and more debug information.
> 4. A refactoring of (1) relying partly on (3).
> The targeted final state of this series would consist in squashing (2) + (3), and (1) + (4).
>
> **Special note regarding (2):** If Gas has support for build attributes, both build attributes and GNU properties will be emitted. This behavior is still open for discussion. Please, let me know your thoughts regarding this behavior.

I don't have a strong opinion.  But emitting both seems like the safe
and conservatively correct behaviour, so I think the onus would be
on anyone who wants to drop the old information to make the case
for doing that.

> This patch series needs to be applied on top of the patch series for GCS [1].
>
> Bootstrapped on aarch64-none-linux-gnu, and no regression found.
>
> [1]: https://gcc.gnu.org/git/?p=gcc.git;a=shortlog;h=refs/vendors/ARM/heads/gcs
> [2]: https://gcc.gnu.org/pipermail/gcc-patches/2024-September/662825.html
> [3]: https://gcc.gnu.org/pipermail/gcc-patches/2024-September/664004.html
>
> Regards,
> Matthieu
>
> 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)
>
> Diff with revision 2 [3]:
> - address comments of Richard Sandiford in revision 2.
> - fix several formatting mistakes.
> - remove RFC tag.
>
>
> Matthieu Longo (3):
>   aarch64: add debug comments to feature properties in .note.gnu.property
>   aarch64: improve assembly debug comments for AEABI build attributes
>   aarch64: encapsulate note.gnu.property emission into a class
>
> Srinath Parvathaneni (1):
>   aarch64: add minimal support of AEABI build attributes for GCS.

Looks good, thanks.  OK for trunk with the suggested changes for
patches 2 and 3.

Richard

>  gcc/config.gcc                                |   2 +-
>  gcc/config.in                                 |   6 +
>  gcc/config/aarch64/aarch64-dwarf-metadata.cc  | 145 +++++++++++
>  gcc/config/aarch64/aarch64-dwarf-metadata.h   | 245 ++++++++++++++++++
>  gcc/config/aarch64/aarch64.cc                 |  69 ++---
>  gcc/config/aarch64/t-aarch64                  |  10 +
>  gcc/configure                                 |  38 +++
>  gcc/configure.ac                              |  10 +
>  gcc/testsuite/gcc.target/aarch64/bti-1.c      |  13 +-
>  .../aarch64-build-attributes.exp              |  35 +++
>  .../build-attributes/build-attribute-gcs.c    |  12 +
>  .../build-attribute-standard.c                |  12 +
>  .../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         |  16 ++
>  17 files changed, 611 insertions(+), 50 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-gcs.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
  
Matthieu Longo Nov. 11, 2024, 4:52 p.m. UTC | #2
On 2024-10-23 17:43, Richard Sandiford wrote:
> Matthieu Longo <matthieu.longo@arm.com> writes:
>> The primary focus of this patch series is to add support for build attributes in the context of GCS (Guarded Control Stack, an Armv9.4-a extension) to the AArch64 backend.
>> It addresses comments from revision 1 [2] and 2 [3], and proposes a different approach compared to the previous implementation of the build attributes.
>>
>> The series is composed of the following 4 patches:
>> 1. Patch adding assembly debug comments (-dA) to the existing GNU properties, to improve testing and check the correctness of values.
>> 2. The minimal patch adding support for build attributes in the context of GCS.
>> 3. A refactoring of (2) to make things less error-prone and more modular, add support for asciz attributes and more debug information.
>> 4. A refactoring of (1) relying partly on (3).
>> The targeted final state of this series would consist in squashing (2) + (3), and (1) + (4).
>>
>> **Special note regarding (2):** If Gas has support for build attributes, both build attributes and GNU properties will be emitted. This behavior is still open for discussion. Please, let me know your thoughts regarding this behavior.
> 
> I don't have a strong opinion.  But emitting both seems like the safe
> and conservatively correct behaviour, so I think the onus would be
> on anyone who wants to drop the old information to make the case
> for doing that.
> 
>> This patch series needs to be applied on top of the patch series for GCS [1].
>>
>> Bootstrapped on aarch64-none-linux-gnu, and no regression found.
>>
>> [1]: https://gcc.gnu.org/git/?p=gcc.git;a=shortlog;h=refs/vendors/ARM/heads/gcs
>> [2]: https://gcc.gnu.org/pipermail/gcc-patches/2024-September/662825.html
>> [3]: https://gcc.gnu.org/pipermail/gcc-patches/2024-September/664004.html
>>
>> Regards,
>> Matthieu
>>
>> 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)
>>
>> Diff with revision 2 [3]:
>> - address comments of Richard Sandiford in revision 2.
>> - fix several formatting mistakes.
>> - remove RFC tag.
>>
>>
>> Matthieu Longo (3):
>>    aarch64: add debug comments to feature properties in .note.gnu.property
>>    aarch64: improve assembly debug comments for AEABI build attributes
>>    aarch64: encapsulate note.gnu.property emission into a class
>>
>> Srinath Parvathaneni (1):
>>    aarch64: add minimal support of AEABI build attributes for GCS.
> 
> Looks good, thanks.  OK for trunk with the suggested changes for
> patches 2 and 3.
> 
> Richard
> 

Thanks Richard for the review.
I addressed all the comments as you requested.
I will synchronize with Yury Khrustalev to see when he plans to merge 
GCS patch series for GCC. I would like those changes to be merged for 
stage 1.

Matthieu