Re: [RFC] Linux system call builtins

2024-04-10 Thread Szabolcs Nagy via Gcc
The 04/09/2024 23:59, Matheus Afonso Martins Moreira via Gcc wrote: > > and using raw syscalls outside of the single runtime the > > application is using is problematic (at least on linux). > > Why do you say they are problematic on Linux though? Please elaborate. because the portable c api

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Introduce indirect_return attribute

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:3458fa6e8c32f128c666b49cfcb65dfdd52d7e43 commit 3458fa6e8c32f128c666b49cfcb65dfdd52d7e43 Author: Szabolcs Nagy Date: Thu Dec 28 13:37:38 2023 + aarch64: Introduce indirect_return attribute Tail calls of indirect_return functions from non-indirect_return

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: libitm: Add GCS support

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:9f2fe2932ca35b736685753a85bd5c43459f24de commit 9f2fe2932ca35b736685753a85bd5c43459f24de Author: Szabolcs Nagy Date: Tue Apr 2 15:43:23 2024 +0100 aarch64: libitm: Add GCS support Transaction begin and abort use setjmp/longjmp like operations that need

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: libatomic: add GCS marking to asm

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:78b29b5934193bd7e057aa8196ab8645df092d44 commit 78b29b5934193bd7e057aa8196ab8645df092d44 Author: Szabolcs Nagy Date: Fri Dec 22 15:11:25 2023 + aarch64: libatomic: add GCS marking to asm libatomic/ChangeLog: * config/linux/aarch64

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Emit GNU property NOTE for GCS

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:99a291c0313e8e839c3ffd1fdc5132b4d6462968 commit 99a291c0313e8e839c3ffd1fdc5132b4d6462968 Author: Szabolcs Nagy Date: Tue May 9 14:32:46 2023 +0100 aarch64: Emit GNU property NOTE for GCS TODO: relies on experimental binutils ABI, should use build attributes

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: libgcc: add GCS marking to asm

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:b32a17f9f43d68859e31d7a6af7b21ac2ed42742 commit b32a17f9f43d68859e31d7a6af7b21ac2ed42742 Author: Szabolcs Nagy Date: Fri Dec 22 13:44:19 2023 + aarch64: libgcc: add GCS marking to asm libgcc/ChangeLog: * config/aarch64/aarch64-asm.h

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Add test for GCS ACLE defs

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:2a9d500c8f2fd1004cdcbcdec063681dbb0bb1f1 commit 2a9d500c8f2fd1004cdcbcdec063681dbb0bb1f1 Author: Szabolcs Nagy Date: Wed Jun 7 16:17:53 2023 +0100 aarch64: Add test for GCS ACLE defs gcc/testsuite/ChangeLog: * gcc.target/aarch64

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Add GCS support to the unwinder

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:2185dc7cdb6d536e4d9a49a77c552e58041cb0bc commit 2185dc7cdb6d536e4d9a49a77c552e58041cb0bc Author: Szabolcs Nagy Date: Wed Apr 19 14:01:36 2023 +0100 aarch64: Add GCS support to the unwinder TODO: - Follows the current linux ABI that uses single signal

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Add GCS support for nonlocal stack save

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:d5a22a53f58403c888a43c75c5983ba3cb5023ae commit d5a22a53f58403c888a43c75c5983ba3cb5023ae Author: Szabolcs Nagy Date: Fri Apr 14 18:23:52 2023 +0100 aarch64: Add GCS support for nonlocal stack save Nonlocal stack save and restore has to also save and restore

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Add ACLE feature macros for GCS

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:f94cfdab086f521592939f03408f59f39a4bdd5a commit f94cfdab086f521592939f03408f59f39a4bdd5a Author: Szabolcs Nagy Date: Tue May 9 17:04:34 2023 +0100 aarch64: Add ACLE feature macros for GCS gcc/ChangeLog: * config/aarch64/aarch64-c.cc

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Add GCS instructions

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:57aec9c418f837bf427d8317bebdc0f825cbb043 commit 57aec9c418f837bf427d8317bebdc0f825cbb043 Author: Szabolcs Nagy Date: Tue May 9 16:00:01 2023 +0100 aarch64: Add GCS instructions Add instructions for the Guarded Control Stack extension. GCSSS1

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Add non-local goto and jump tests for GCS

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:87217fd89a9bd595a58897bafc593a7e25051ee4 commit 87217fd89a9bd595a58897bafc593a7e25051ee4 Author: Szabolcs Nagy Date: Wed Jun 7 10:58:06 2023 +0100 aarch64: Add non-local goto and jump tests for GCS These are scan asm tests only, relying on existing execution

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Add __builtin_aarch64_gcs* tests

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:90ff9175ede4f4671755f0296b5ce89d8d69f966 commit 90ff9175ede4f4671755f0296b5ce89d8d69f966 Author: Szabolcs Nagy Date: Tue Jun 6 17:35:51 2023 +0100 aarch64: Add __builtin_aarch64_gcs* tests gcc/testsuite/ChangeLog: * gcc.target/aarch64

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Add GCS builtins

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:4880a14b6222839396bcb93ee27669db4e88ff01 commit 4880a14b6222839396bcb93ee27669db4e88ff01 Author: Szabolcs Nagy Date: Tue May 9 16:21:28 2023 +0100 aarch64: Add GCS builtins Add new builtins for GCS: void *__builtin_aarch64_gcspr (void

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Add __builtin_aarch64_chkfeat tests

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:0c0ee07e8b10e071c5b88fbae6f109778a4e578c commit 0c0ee07e8b10e071c5b88fbae6f109778a4e578c Author: Szabolcs Nagy Date: Fri Jun 2 16:15:25 2023 +0100 aarch64: Add __builtin_aarch64_chkfeat tests gcc/testsuite/ChangeLog: * gcc.target/aarch64

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Add __builtin_aarch64_chkfeat

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:e26ccd302f4face487da5b530d4dbeb4eebf7d43 commit e26ccd302f4face487da5b530d4dbeb4eebf7d43 Author: Szabolcs Nagy Date: Tue May 9 15:24:18 2023 +0100 aarch64: Add __builtin_aarch64_chkfeat Builtin for chkfeat: the input argument is used to initialize x16

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Add support for chkfeat insn

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:309f26c5301d11891a6adddf9515adf5a9b0 commit 309f26c5301d11891a6adddf9515adf5a9b0 Author: Szabolcs Nagy Date: Tue May 9 15:37:49 2023 +0100 aarch64: Add support for chkfeat insn This is a hint space instruction to check for enabled HW features

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Add target pragma tests for gcs

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:311c3aa1e58672c36991a193db5752d3dcf8e7d9 commit 311c3aa1e58672c36991a193db5752d3dcf8e7d9 Author: Szabolcs Nagy Date: Fri Jun 30 16:50:23 2023 +0100 aarch64: Add target pragma tests for gcs gcc/testsuite/ChangeLog: * gcc.target/aarch64

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Add branch-protection target pragma tests

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:2c160a731e7764e97a2b8014149aaee47a11fbba commit 2c160a731e7764e97a2b8014149aaee47a11fbba Author: Szabolcs Nagy Date: Fri Jun 30 16:31:23 2023 +0100 aarch64: Add branch-protection target pragma tests gcc/testsuite/ChangeLog: * gcc.target

[gcc(refs/vendors/ARM/heads/gcs)] aarch64: Add -mbranch-protection=gcs option

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:50dc77071139c477a10c78d3d73ff2db4dcd6ef7 commit 50dc77071139c477a10c78d3d73ff2db4dcd6ef7 Author: Szabolcs Nagy Date: Mon Jun 19 12:57:56 2023 +0100 aarch64: Add -mbranch-protection=gcs option This enables Guarded Control Stack (GCS) compatible code

[gcc/ARM/heads/gcs] (924 commits) aarch64: Introduce indirect_return attribute

2024-04-10 Thread Szabolcs Nagy via Gcc-cvs
The branch 'ARM/heads/gcs' was updated to point to: 3458fa6e8c3... aarch64: Introduce indirect_return attribute It previously pointed to: 7f952ecef18... aarch64: Introduce indirect_return attribute Diff: !!! WARNING: THE FOLLOWING COMMITS ARE NO LONGER ACCESSIBLE (LOST):

Re: [RFC] Linux system call builtins

2024-04-09 Thread Szabolcs Nagy via Gcc
The 04/08/2024 06:19, Matheus Afonso Martins Moreira via Gcc wrote: > __builtin_linux_system_call(long n, ...) ... > Calling these builtins will make GCC place all the parameters > in the correct registers for the system call, emit the appropriate > instruction for the target architecture and

[gcc r14-9426] aarch64,arm: Move branch-protection data to targets

2024-03-11 Thread Szabolcs Nagy via Gcc-cvs
https://gcc.gnu.org/g:1bf70e68e4910fe0904466d06cae7f747c02ab72 commit r14-9426-g1bf70e68e4910fe0904466d06cae7f747c02ab72 Author: Szabolcs Nagy Date: Mon Jun 19 12:56:41 2023 +0100 aarch64,arm: Move branch-protection data to targets The branch-protection types are target specific

[PATCH] aarch64: libgcc: Cleanup ELF marking in asm

2024-01-30 Thread Szabolcs Nagy
Use aarch64-asm.h in asm code consistently, this was started in commit c608ada288ced0268c1fd4136f56c34b24d4 Author: Zac Walker CommitDate: 2024-01-23 15:32:30 + Ifdef `.hidden`, `.type`, and `.size` pseudo-ops for `aarch64-w64-mingw32` target But that commit failed to

Re: [RFC] Either fix or disable SME feature for `aarch64-w64-mingw32` target?

2024-01-25 Thread Szabolcs Nagy
this patch added double notes on crt*.o and lse derived objects. (which does not seem to cause build break but some linkers may not like it) after #include "aarch64-asm.h" all gnu-stack and gnu-property related stuff should be removed since the header takes care of it.

Re: [RFC] Either fix or disable SME feature for `aarch64-w64-mingw32` target?

2024-01-25 Thread Szabolcs Nagy
The 01/15/2024 17:21, Radek Barton wrote: v4-0001-Ifdef-.hidden-.type-and-.size-pseudo-ops-for-aarc.patch Description: v4-0001-Ifdef-.hidden-.type-and-.size-pseudo-ops-for-aarc.patch

[PATCH v2] aarch64: Fix eh_return for -mtrack-speculation [PR112987]

2024-01-25 Thread Szabolcs Nagy
Recent commit introduced a conditional branch in eh_return epilogues that is not compatible with speculation tracking: commit 426fddcbdad6746fe70e031f707fb07f55dfb405 Author: Szabolcs Nagy CommitDate: 2023-11-27 15:52:48 + aarch64: Use br instead of ret for eh_return Refactor

[PATCH] aarch64: Fix eh_return for -mtrack-speculation [PR112987]

2024-01-17 Thread Szabolcs Nagy
Recent commit introduced a conditional branch in eh_return epilogues that is not compatible with speculation tracking: commit 426fddcbdad6746fe70e031f707fb07f55dfb405 Author: Szabolcs Nagy CommitDate: 2023-11-27 15:52:48 + aarch64: Use br instead of ret for eh_return gcc

Re: New TLS usage in libgcc_s.so.1, compatibility impact

2024-01-15 Thread Szabolcs Nagy via Gcc
The 01/13/2024 13:49, Florian Weimer wrote: > This commit > > commit 8abddb187b33480d8827f44ec655f45734a1749d > Author: Andrew Burgess > Date: Sat Aug 5 14:31:06 2023 +0200 > > libgcc: support heap-based trampolines > > Add support for heap-based trampolines on x86_64-linux,

Re: [PATCH v2 7/7] aarch64,arm: Move branch-protection data to targets

2024-01-11 Thread Szabolcs Nagy
The 12/07/2023 13:13, Richard Earnshaw wrote: > On 03/11/2023 15:36, Szabolcs Nagy wrote: > > * config/aarch64/aarch64.cc (aarch_handle_no_branch_protection): Copy. > > (aarch_handle_standard_branch_protection): Copy. > > (aarch_handle_pac_

[PATCH v4] aarch64,arm: Move branch-protection data to targets

2024-01-11 Thread Szabolcs Nagy
The branch-protection types are target specific, not the same on arm and aarch64. This currently affects pac-ret+b-key, but there will be a new type on aarch64 that is not relevant for arm. After the move, change aarch_ identifiers to aarch64_ or arm_ as appropriate. Refactor

[PATCH] aarch64: fortran: Adjust vect-8.f90 for libmvec

2023-12-28 Thread Szabolcs Nagy
With new glibc one more loop can be vectorized via simd exp in libmvec. Found by the Linaro TCWG CI. gcc/testsuite/ChangeLog: * gfortran/vect/vect-8.f90: Accept more vectorized loops. --- gcc/testsuite/gfortran.dg/vect/vect-8.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2

[PATCH v3] aarch64,arm: Move branch-protection data to targets

2023-12-12 Thread Szabolcs Nagy
The branch-protection types are target specific, not the same on arm and aarch64. This currently affects pac-ret+b-key, but there will be a new type on aarch64 that is not relevant for arm. After the move, change aarch_ identifiers to aarch64_ or arm_ as appropriate. gcc/ChangeLog: *

Re: [PATCH] libatomic: Add rcpc3 128-bit atomic operations for AArch64

2023-12-08 Thread Szabolcs Nagy
The 11/13/2023 11:47, Victor Do Nascimento wrote: > +/* LRCPC atomic support encoded in ID_AA64ISAR1_EL1.Atomic, > + bits[23:20]. The expected value is 0b0011. Check that. */ > +#define HAS_LRCPC3() ({ \ > + unsigned long val;

Re: [PATCH v2 2/2] libatomic: Enable LSE128 128-bit atomics for armv9.4-a

2023-12-08 Thread Szabolcs Nagy
The 11/29/2023 15:15, Richard Earnshaw wrote: > On 13/11/2023 11:37, Victor Do Nascimento wrote: > > +/* LSE128 atomic support encoded in ID_AA64ISAR0_EL1.Atomic, > > + bits[23:20]. The expected value is 0b0011. Check that. */ > > +#define HAS_LSE128() ({

[committed] libgcc: Fix config.in

2023-12-08 Thread Szabolcs Nagy
It was updated incorrectly in commit dbbfb52b0e9c66ee9d05b8fd17c4f44655e48463 Author: Szabolcs Nagy CommitDate: 2023-12-08 11:29:06 + libgcc: aarch64: Configure check for __getauxval so regenerate it. libgcc/ChangeLog: * config.in: Regenerate. --- libgcc/config.in

[PATCH v2] libgcc: aarch64: Add SME runtime support

2023-12-08 Thread Szabolcs Nagy
The call ABI for SME (Scalable Matrix Extension) requires a number of helper routines which are added to libgcc so they are tied to the compiler version instead of the libc version. See https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#sme-support-routines The routines are in

Re: [PATCH 3/4] libgcc: aarch64: Add SME runtime support

2023-12-07 Thread Szabolcs Nagy
The 12/07/2023 17:36, Richard Sandiford wrote: > Szabolcs Nagy writes: > > + > > +#include "auto-target.h" > > +#include > > + sorry, this seems to fail when building --without-headers i will respin this, handling the 'inhibit_libc' case.

[PATCH 4/4] libgcc: aarch64: Add SME unwinder support

2023-12-07 Thread Szabolcs Nagy
To support the ZA lazy save scheme, the PCS requires the unwinder to reset the SME state to PSTATE.SM=0, PSTATE.ZA=0, TPIDR2_EL0=0 on entry to an exception handler. We use the __arm_za_disable SME runtime call unconditionally to achieve this.

[PATCH 3/4] libgcc: aarch64: Add SME runtime support

2023-12-07 Thread Szabolcs Nagy
The call ABI for SME (Scalable Matrix Extension) requires a number of helper routines which are added to libgcc so they are tied to the compiler version instead of the libc version. See https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#sme-support-routines The routines are in

[PATCH 2/4] libgcc: aarch64: Configure check for __getauxval

2023-12-07 Thread Szabolcs Nagy
Add configure check for the __getauxval ABI symbol, which is always available on aarch64 glibc, and may be available on other linux C runtimes. For now only enabled on glibc, others have to override it target_configargs=libgcc_cv_have___getauxval=yes This is deliberately obscure as it should

[PATCH 1/4] libgcc: aarch64: Configure check for .variant_pcs support

2023-12-07 Thread Szabolcs Nagy
Ideally SME support routines in libgcc are marked as variant PCS symbols so check if as supports the directive. --- libgcc/config.in| 3 +++ libgcc/configure| 39 +++ libgcc/configure.ac | 17 + 3 files changed, 59 insertions(+) diff

[PATCH 0/4] libgcc: aarch64: Add SME runtime

2023-12-07 Thread Szabolcs Nagy
Add SME (Scalable Matrix Extension) support to libgcc. Szabolcs Nagy (4): libgcc: aarch64: Configure check for .variant_pcs support libgcc: aarch64: Configure check for __getauxval libgcc: aarch64: Add SME runtime support libgcc: aarch64: Add SME unwinder support libgcc/config.in

[PATCH] aarch64: fix eh_return-3.c test

2023-12-04 Thread Szabolcs Nagy
gcc/testsuite/ChangeLog: * gcc.target/aarch64/eh_return-3.c: Fix when retaa is available. --- gcc/testsuite/gcc.target/aarch64/eh_return-3.c | 4 1 file changed, 4 insertions(+) diff --git a/gcc/testsuite/gcc.target/aarch64/eh_return-3.c

Re: [PATCH] aarch64: Avoid -Wincompatible-pointer-types warning in Linux unwinder

2023-11-29 Thread Szabolcs Nagy
The 11/10/2023 19:48, Florian Weimer wrote: > * config/aarch64/linux-unwind.h > (aarch64_fallback_frame_state): Add cast to the expected type > in sc assignment. > > (Almost a v2, but the other issue was already fixed via in r14-4183.) > > --- >

Re: [PATCH] aarch64: Call named function in gcc.target/aarch64/aapcs64/ice_1.c

2023-11-29 Thread Szabolcs Nagy
The 11/10/2023 12:22, Florian Weimer wrote: > This test looks like it intends to pass a small struct argument > through both a non-variadic and variadic argument, but due to > the typo, it does not achieve that. > > gcc/testsuite/ > > * gcc.target/aarch64/aapcs64/ice_1.c (foo): Call named.

Re: [PATCH v2 3/7] aarch64: Add eh_return compile tests

2023-11-27 Thread Szabolcs Nagy
The 11/26/2023 14:37, Richard Sandiford wrote: > Szabolcs Nagy writes: > > +++ b/gcc/testsuite/gcc.target/aarch64/eh_return-3.c > > @@ -0,0 +1,30 @@ > > +/* { dg-do compile } */ > > +/* { dg-options "-O2 -mbranch-protection=pac-ret+leaf" } */ > > Pr

Re: [PATCH v2 3/7] aarch64: Add eh_return compile tests

2023-11-27 Thread Szabolcs Nagy
The 11/26/2023 14:37, Richard Sandiford wrote: > Szabolcs Nagy writes: > > +++ b/gcc/testsuite/gcc.target/aarch64/eh_return-3.c > > @@ -0,0 +1,30 @@ > > +/* { dg-do compile } */ > > +/* { dg-options "-O2 -mbranch-protection=pac-ret+leaf" } */ > > Pr

Re: [PATCH v2 1/7] aarch64: Use br instead of ret for eh_return

2023-11-13 Thread Szabolcs Nagy
The 11/13/2023 01:27, Hans-Peter Nilsson wrote: > > From: Szabolcs Nagy > > Date: Fri, 3 Nov 2023 15:36:08 + > > I don't see others commenting on this patch, and you're not > mentioning this aspect, so I wonder: > > > * config/aarch64/aarch64.h

[PATCH v2 7/7] aarch64,arm: Move branch-protection data to targets

2023-11-03 Thread Szabolcs Nagy
The branch-protection types are target specific, not the same on arm and aarch64. This currently affects pac-ret+b-key, but there will be a new type on aarch64 that is not relevant for arm. gcc/ChangeLog: * config/aarch64/aarch64-opts.h (enum aarch64_key_type): Rename to ...

[PATCH v2 4/7] aarch64: Disable branch-protection for pcs tests

2023-11-03 Thread Szabolcs Nagy
The tests manipulate the return address in abitest-2.h and thus not compatible with -mbranch-protection=pac-ret+leaf or -mbranch-protection=gcs. gcc/testsuite/ChangeLog: * gcc.target/aarch64/aapcs64/func-ret-1.c: Disable branch-protection. *

[PATCH v2 2/7] aarch64: Do not force a stack frame for EH returns

2023-11-03 Thread Szabolcs Nagy
EH returns no longer rely on clobbering the return address on the stack so forcing a stack frame is not necessary. This does not actually change the code gen for the unwinder since there are calls before the EH return. gcc/ChangeLog: * config/aarch64/aarch64.cc

[PATCH v2 6/7] aarch64,arm: Fix branch-protection= parsing

2023-11-03 Thread Szabolcs Nagy
Refactor the parsing to have a single API and fix a few parsing issues: - Different handling of "bti+none" and "none+bti": these should be rejected because "none" can only appear alone. - Accepted empty strings such as "bti++pac-ret" or "bti+", this bug was caused by using strtok_r. -

[PATCH v2 3/7] aarch64: Add eh_return compile tests

2023-11-03 Thread Szabolcs Nagy
gcc/testsuite/ChangeLog: * gcc.target/aarch64/eh_return-2.c: New test. * gcc.target/aarch64/eh_return-3.c: New test. --- v2: check-function-bodies in eh_return-3.c (this is not very robust, but easier to read) --- .../gcc.target/aarch64/eh_return-2.c | 9 ++

[PATCH v2 5/7] aarch64,arm: Remove accepted_branch_protection_string

2023-11-03 Thread Szabolcs Nagy
On aarch64 this caused ICE with pragma push_options since commit ae54c1b09963779c5c3914782324ff48af32e2f1 Author: Wilco Dijkstra CommitDate: 2022-06-01 18:13:57 +0100 AArch64: Cleanup option processing code The failure is at pop_options: internal compiler error: ‘global_options’

[PATCH v2 1/7] aarch64: Use br instead of ret for eh_return

2023-11-03 Thread Szabolcs Nagy
The expected way to handle eh_return is to pass the stack adjustment offset and landing pad address via EH_RETURN_STACKADJ_RTX EH_RETURN_HANDLER_RTX to the epilogue that is shared between normal return paths and the eh_return paths. EH_RETURN_HANDLER_RTX is the stack slot of the return

[PATCH v2 0/7] aarch64 GCS preliminary patches

2023-11-03 Thread Szabolcs Nagy
Szabolcs Nagy (7): aarch64: Use br instead of ret for eh_return aarch64: Do not force a stack frame for EH returns aarch64: Add eh_return compile tests aarch64: Disable branch-protection for pcs tests aarch64,arm: Remove accepted_branch_protection_string aarch64,arm: Fix branch-protection

Re: [PATCH 10/11] aarch64: Fix branch-protection error message tests

2023-10-23 Thread Szabolcs Nagy
The 10/13/2023 11:29, Richard Earnshaw (lists) wrote: > On 05/09/2023 16:00, Richard Sandiford via Gcc-patches wrote: > > Szabolcs Nagy writes: > >> @@ -4,19 +4,19 @@ void __attribute__ ((target("branch-protection=leaf"))) > >> foo1 () > >> { > &

[PATCH 11/11] aarch64,arm: Move branch-protection data to targets

2023-08-22 Thread Szabolcs Nagy via Gcc-patches
The branch-protection types are target specific, not the same on arm and aarch64. This currently affects pac-ret+b-key, but there will be a new type on aarch64 that is not relevant for arm. gcc/ChangeLog: * config/aarch64/aarch64-opts.h (enum aarch64_key_type): Rename to ...

[PATCH 05/11] aarch64: Add eh_return compile tests

2023-08-22 Thread Szabolcs Nagy via Gcc-patches
gcc/testsuite/ChangeLog: * gcc.target/aarch64/eh_return-2.c: New test. * gcc.target/aarch64/eh_return-3.c: New test. --- gcc/testsuite/gcc.target/aarch64/eh_return-2.c | 9 + gcc/testsuite/gcc.target/aarch64/eh_return-3.c | 14 ++ 2 files changed, 23

[PATCH 10/11] aarch64: Fix branch-protection error message tests

2023-08-22 Thread Szabolcs Nagy via Gcc-patches
Update tests for the new branch-protection parser errors. gcc/testsuite/ChangeLog: * gcc.target/aarch64/branch-protection-attr.c: Update. * gcc.target/aarch64/branch-protection-option.c: Update. --- gcc/testsuite/gcc.target/aarch64/branch-protection-attr.c | 6 +++---

[PATCH 04/11] aarch64: Do not force a stack frame for EH returns

2023-08-22 Thread Szabolcs Nagy via Gcc-patches
EH returns no longer rely on clobbering the return address on the stack so forcing a stack frame is not necessary. This does not actually change the code gen for the unwinder since there are calls before the EH return. gcc/ChangeLog: * config/aarch64/aarch64.cc

[PATCH 09/11] aarch64,arm: Fix branch-protection= parsing

2023-08-22 Thread Szabolcs Nagy via Gcc-patches
Refactor the parsing to have a single API and fix a few parsing issues: - Different handling of "bti+none" and "none+bti": these should be rejected because "none" can only appear alone. - Accepted empty strings such as "bti++pac-ret" or "bti+", this bug was caused by using strtok_r. -

[PATCH 02/11] Handle epilogues that contain jumps

2023-08-22 Thread Szabolcs Nagy via Gcc-patches
From: Richard Sandiford The prologue/epilogue pass allows the prologue sequence to contain jumps. The sequence is then partitioned into basic blocks using find_many_sub_basic_blocks. This patch treats epilogues in the same way. It's needed for a follow-on aarch64 patch that adds conditional

[PATCH 03/11] aarch64: Use br instead of ret for eh_return

2023-08-22 Thread Szabolcs Nagy via Gcc-patches
The expected way to handle eh_return is to pass the stack adjustment offset and landing pad address via EH_RETURN_STACKADJ_RTX EH_RETURN_HANDLER_RTX to the epilogue that is shared between normal return paths and the eh_return paths. EH_RETURN_HANDLER_RTX is the stack slot of the return

[PATCH 08/11] aarch64,arm: Remove accepted_branch_protection_string

2023-08-22 Thread Szabolcs Nagy via Gcc-patches
On aarch64 this caused ICE with pragma push_options since commit ae54c1b09963779c5c3914782324ff48af32e2f1 Author: Wilco Dijkstra CommitDate: 2022-06-01 18:13:57 +0100 AArch64: Cleanup option processing code The failure is at pop_options: internal compiler error: ‘global_options’

[PATCH 07/11] aarch64: Disable branch-protection for pcs tests

2023-08-22 Thread Szabolcs Nagy via Gcc-patches
The tests manipulate the return address in abitest-2.h and thus not compatible with -mbranch-protection=pac-ret+leaf or -mbranch-protection=gcs. gcc/testsuite/ChangeLog: * gcc.target/aarch64/aapcs64/func-ret-1.c: Disable branch-protection. *

[PATCH 06/11] aarch64: Fix pac-ret eh_return tests

2023-08-22 Thread Szabolcs Nagy via Gcc-patches
This is needed since eh_return no longer prevents pac-ret in the normal return path. gcc/testsuite/ChangeLog: * gcc.target/aarch64/return_address_sign_1.c: Move func4 to ... * gcc.target/aarch64/return_address_sign_2.c: ... here and fix the scan asm check. *

[PATCH 01/11] aarch64: AARCH64_ISA_RCPC was defined twice

2023-08-22 Thread Szabolcs Nagy via Gcc-patches
gcc/ChangeLog: * config/aarch64/aarch64.h (AARCH64_ISA_RCPC): Remove dup. --- gcc/config/aarch64/aarch64.h | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index 2b0fc97bb71..c783cb96c48 100644 ---

[PATCH 00/11] aarch64 GCS preliminary patches

2023-08-22 Thread Szabolcs Nagy via Gcc-patches
://lore.kernel.org/lkml/20230807-arm64-gcs-v4-0-68cfa37f9...@kernel.org/ so it will come later. Richard Sandiford (1): Handle epilogues that contain jumps Szabolcs Nagy (10): aarch64: AARCH64_ISA_RCPC was defined twice aarch64: Use br instead of ret for eh_return aarch64: Do not force a stack frame for EH

Re: [PATCH] aarch64: Fix warnings during libgcc build

2023-07-12 Thread Szabolcs Nagy via Gcc-patches
The 07/11/2023 17:20, Florian Weimer wrote: > * Richard Earnshaw: > > > On 11/07/2023 10:37, Florian Weimer via Gcc-patches wrote: > >> libgcc/ > >>* config/aarch64/aarch64-unwind.h > >> (aarch64_cie_signed_with_b_key): > >>Add missing const qualifier. Cast from const unsigned char * >

Re: [PATCH] libgcc: Fix uninitialized RA signing on AArch64 [PR107678]

2023-01-05 Thread Szabolcs Nagy via Gcc-patches
The 01/03/2023 17:27, Wilco Dijkstra wrote: > > > Also, if I understood correctly, the reason we use REG_UNSAVED is to > > ensure that state from one frame isn't carried across to a parent frame, > > in cases where the parent frame lacks any signing. That is, each frame > > should start out with

Re: [PATCH] libgcc: Fix uninitialized RA signing on AArch64 [PR107678]

2022-12-06 Thread Szabolcs Nagy via Gcc-patches
The 12/06/2022 11:58, Wilco Dijkstra wrote: > > i don't think how[*RA_STATE] can ever be set to REG_SAVED_OFFSET, > > this pseudo reg is not spilled to the stack, it is reset to 0 in > > each frame and then toggled within a frame. > > It's is just a state, we can use any state we want since it is

Re: [PATCH] libgcc: Fix uninitialized RA signing on AArch64 [PR107678]

2022-12-06 Thread Szabolcs Nagy via Gcc-patches
The 12/05/2022 19:04, Richard Sandiford wrote: > Wilco Dijkstra writes: > > A recent change only initializes the regs.how[] during Dwarf unwinding > > which resulted in an uninitialized offset used in return address signing > > and random failures during unwinding. The fix is to use

Re: Division by zero on A53 which does not raise an exception

2022-11-29 Thread Szabolcs Nagy via Gcc
The 11/28/2022 21:37, Stephen Smith via Binutils wrote: > I am working on a project which is using an A53 core. The core does not > raise an exception if there is a division by zero (for either integer or > floating point division). floating-point division by zero signals the FE_DIVBYZERO

Re: Adding file descriptor attribute(s) to gcc and glibc

2022-07-14 Thread Szabolcs Nagy via Gcc
The 07/13/2022 12:55, David Malcolm wrote: > On Wed, 2022-07-13 at 16:01 +0200, Florian Weimer wrote: > > * David Malcolm: > GCC trunk's -fanalyzer implements the new warnings via a state machine > for file-descriptor values; it currently has rules for handling "open", > "close", "read", and

Re: Adding file descriptor attribute(s) to gcc and glibc

2022-07-13 Thread Szabolcs Nagy via Gcc
The 07/12/2022 18:25, David Malcolm via Libc-alpha wrote: > On Tue, 2022-07-12 at 18:16 -0400, David Malcolm wrote: > > On Tue, 2022-07-12 at 23:03 +0530, Mir Immad wrote: > > GCC's attribute syntax here: > >   https://gcc.gnu.org/onlinedocs/gcc/Attribute-Syntax.html > > allows for a parenthesized

AArch64 vector ABI vs OpenMP

2022-06-29 Thread Szabolcs Nagy via Gcc
Last time aarch64 libmvec was discussed, the OpenMP declare variant syntax support was not ready in gcc and there were open questions around how simd isa variants would be supported. https://gcc.gnu.org/pipermail/gcc-patches/2019-October/532940.html The vector function ABI for aarch64 allows the

Re: [PATCH] aarch64: Fix pac-ret with unusual dwarf in libgcc unwinder [PR104689]

2022-05-24 Thread Szabolcs Nagy via Gcc-patches
The 05/13/2022 16:35, Richard Sandiford wrote: > Szabolcs Nagy via Gcc-patches writes: > > The RA_SIGN_STATE dwarf pseudo-register is normally only set using the > > DW_CFA_AARCH64_negate_ra_state (== DW_CFA_window_save) operation which > > toggles the return address signedne

[PATCH] aarch64: Fix pac-ret with unusual dwarf in libgcc unwinder [PR104689]

2022-05-10 Thread Szabolcs Nagy via Gcc-patches
The RA_SIGN_STATE dwarf pseudo-register is normally only set using the DW_CFA_AARCH64_negate_ra_state (== DW_CFA_window_save) operation which toggles the return address signedness state (the default state is 0). (It may be set by remember/restore_state CFI too, those save/restore the state of all

Re: [PATCH] [RFC][PR102768] aarch64: Add compiler support for Shadow Call Stack

2021-11-23 Thread Szabolcs Nagy via Gcc-patches
The 11/23/2021 16:32, Dan Li wrote: > On 11/3/21 8:00 PM, Szabolcs Nagy wrote: > > i assume exception handling info has to change for scs to > > work (to pop the shadow stack when transferring control), > > so either scs must require -fno-exceptions or the eh info > >

Re: [PATCH] [RFC][PR102768] aarch64: Add compiler support for Shadow Call Stack

2021-11-03 Thread Szabolcs Nagy via Gcc-patches
The 11/03/2021 00:24, Dan Li wrote: > On 11/2/21 9:04 PM, Szabolcs Nagy wrote: > > The 11/02/2021 00:06, Dan Li via Gcc-patches wrote: > > > Shadow Call Stack can be used to protect the return address of a > > > function at runtime, and clang alre

Re: [PATCH] [RFC][PR102768] aarch64: Add compiler support for Shadow Call Stack

2021-11-02 Thread Szabolcs Nagy via Gcc-patches
The 11/02/2021 00:06, Dan Li via Gcc-patches wrote: > Shadow Call Stack can be used to protect the return address of a > function at runtime, and clang already supports this feature[1]. > > To enable SCS in user mode, in addition to compiler, other support > is also required (as described in

Re: unnormal Intel 80-bit long doubles and isnanl

2020-11-24 Thread Szabolcs Nagy via Gcc
The 11/24/2020 16:23, Siddhesh Poyarekar wrote: > Hi, > > The Intel 80-bit long double format has a concept of "unnormal" numbers that > have a non-zero exponent and zero integer bit (i.e. bit 63) in the mantissa; > all valid long double numbers have their integer bit set to 1. Unnormal >

Re: Fix handling of stores in modref_summary::useful_p

2020-10-06 Thread Szabolcs Nagy via Gcc-patches
The 10/05/2020 23:45, Jan Hubicka wrote: > > The 10/05/2020 17:28, Szabolcs Nagy via Gcc-patches wrote: > > minimal reproducer: > > > > #include > > int main() > > { > > int r,t; > > r = sscanf("01", "%2x", );

Re: Fix handling of stores in modref_summary::useful_p

2020-10-05 Thread Szabolcs Nagy via Gcc-patches
The 10/05/2020 17:28, Szabolcs Nagy via Gcc-patches wrote: > The 10/05/2020 12:52, Vaseeharan Vinayagamoorthy wrote: > > Hi, > > > > After this patch, I am noticing that some glibc crypto tests get stuck in > > scanf which goes into busy loop. > > > > M

Re: Fix handling of stores in modref_summary::useful_p

2020-10-05 Thread Szabolcs Nagy via Gcc-patches
The 10/05/2020 12:52, Vaseeharan Vinayagamoorthy wrote: > Hi, > > After this patch, I am noticing that some glibc crypto tests get stuck in > scanf which goes into busy loop. > > My build/host/target setup is: > Build: aarch64-none-linux-gnu > Host: aarch64-none-linux-gnu > Target:

Re: [PING 2][PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-10-05 Thread Szabolcs Nagy via Gcc-patches
The 09/23/2020 21:45, Jeff Law wrote: > On 9/23/20 11:45 AM, Martin Sebor via Gcc-patches wrote: > > On 9/23/20 9:44 AM, Szabolcs Nagy wrote: > > > The 09/23/2020 09:22, Szabolcs Nagy wrote: > > > > The 09/21/2020 12:45, Martin Sebor via Gcc-patches wrote: > > &

Re: [RFC] man7/system_data_types.7: Document [unsigned] __int128

2020-10-01 Thread Szabolcs Nagy via Gcc
The 10/01/2020 12:14, Alejandro Colomar via Gcc wrote: > Here is the rendered intmax_t: > > intmax_t > Include: . Alternatively, . > > A signed integer type capable of representing any value of any > signed integer type supported by the implementation. According > to

Re: [PING 2][PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-09-23 Thread Szabolcs Nagy
The 09/23/2020 09:22, Szabolcs Nagy wrote: > The 09/21/2020 12:45, Martin Sebor via Gcc-patches wrote: > > On 9/21/20 12:20 PM, Vaseeharan Vinayagamoorthy wrote: > > > After this patch, I am seeing this -Warray-parameter error: > > > > > > In file

Re: [PING 2][PATCH 2/5] C front end support to detect out-of-bounds accesses to array parameters

2020-09-23 Thread Szabolcs Nagy
The 09/21/2020 12:45, Martin Sebor via Gcc-patches wrote: > On 9/21/20 12:20 PM, Vaseeharan Vinayagamoorthy wrote: > > After this patch, I am seeing this -Warray-parameter error: > > > > In file included from ../include/pthread.h:1, > > from ../sysdeps/nptl/thread_db.h:25, > >

Re: [PATCH] configure: Require C++11 for building code generation tools

2020-08-20 Thread Szabolcs Nagy
The 08/20/2020 13:59, Vasee Vinayagamoorthy wrote: > +# Also require C++11 for building code generation tools. > +# Do nothing if "${build}" = "${host}", because in this case > +# CXX_FOR_BUILD="\$(CXX)", and $CXX is already set to the correct value > above. > +if test "${build}" != "${host}";

[PATCH 2/2] aarch64: add PAC-RET protection to libitm sjlj.S

2020-07-23 Thread Szabolcs Nagy
_ITM_beginTransaction is a 'returns_twice' function that saves x30 on the stack as part of gtm_jmpbuf (that is passed down to GTM_begin_transaction), but the saved x30 is also used for return. The return path should be protected so we don't leave an ldp x29, x30, [sp] ret gadget in the code,

[PATCH 1/2] aarch64: add PAC GNU property note to libgcc lse.S

2020-07-23 Thread Szabolcs Nagy
This note is not used anywhere currently but it is supposed to mark objects if the return address is protected with PAC on the stack. Since lse.S only has leaf functions the return address is never saved on the stack so we can add the note. The note is only added if pac-ret is enabled because it

Re: [PATCH 4/4] doc: Clarify __builtin_return_address [PR94891]

2020-07-13 Thread Szabolcs Nagy
The 07/13/2020 12:24, Richard Sandiford wrote: > Szabolcs Nagy writes: > > The expected semantics and valid usage of __builtin_return_address is > > not clear since it exposes implementation internals that are normally > > not meaningful to portable c code. > > > >

[PATCH 6/6] aarch64: Fix BTI support in libitm

2020-07-08 Thread Szabolcs Nagy
instructions are added unconditionally. libitm/ChangeLog: 2020-07-08 Szabolcs Nagy * config/aarch64/sjlj.S: Add BTI marking and related definitions, and add BTI c to function entries. --- Note: there is some redundancy: the libgcc fixup patch needed the same macro definitions

[PATCH 4/6] aarch64: Fix noexecstack note in libgcc

2020-07-08 Thread Szabolcs Nagy
lse.S did not have GNU stack note, this may cause missing PT_GNU_STACK in binaries on Linux and FreeBSD. libgcc/ChangeLog: 2020-07-08 Szabolcs Nagy * config/aarch64/lse.S: Add stack note. --- libgcc/config/aarch64/lse.S | 4 1 file changed, 4 insertions(+) diff --git a/libgcc

[PATCH 3/6] aarch64: Fix noexecstack note in libitm

2020-07-08 Thread Szabolcs Nagy
sjlj.S only had the note on Linux, but it is supposed to have it on FreeBSD too. libitm/ChangeLog: 2020-07-08 Szabolcs Nagy * config/aarch64/sjlj.S: Add stack note if __FreeBSD__ is defined. --- Note: this is a minor change to make the asm consistent with gcc code generation (which

[PATCH 5/6] aarch64: Fix BTI support in libgcc

2020-07-08 Thread Szabolcs Nagy
: 2020-07-08 Szabolcs Nagy * config/aarch64/lse.S: Add BTI marking and related definitions, and add BTI c to function entries. --- libgcc/config/aarch64/lse.S | 26 ++ 1 file changed, 26 insertions(+) diff --git a/libgcc/config/aarch64/lse.S b/libgcc/config

[PATCH 1/6] aarch64: Add missing ACLE support for BTI

2020-07-08 Thread Szabolcs Nagy
Define the __ARM_FEATURE_BTI_DEFAULT feature test macro when BTI branch protection is enabled. gcc/ChangeLog: 2020-07-08 Szabolcs Nagy * config/aarch64/aarch64-c.c (aarch64_update_cpp_builtins): Add __ARM_FEATURE_BTI_DEFAULT support. --- gcc/config/aarch64/aarch64-c.c | 3

  1   2   3   4   5   >