From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2049) id 4DF92385DC03; Thu, 5 May 2022 12:09:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DF92385DC03 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Matthew Malcomson To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] morello: Tidy up defines and enable Morello-specific ones in Hybrid X-Act-Checkin: gcc X-Git-Author: Stam Markianos-Wright X-Git-Refname: refs/vendors/ARM/heads/morello X-Git-Oldrev: 2b0f5e04449b1b0dc577ef1e822b661777ac569d X-Git-Newrev: 46a374536a91244b517b37e0a36c69800051739a Message-Id: <20220505120959.4DF92385DC03@sourceware.org> Date: Thu, 5 May 2022 12:09:59 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2022 12:09:59 -0000 https://gcc.gnu.org/g:46a374536a91244b517b37e0a36c69800051739a commit 46a374536a91244b517b37e0a36c69800051739a Author: Stam Markianos-Wright Date: Fri Apr 29 10:59:32 2022 +0100 morello: Tidy up defines and enable Morello-specific ones in Hybrid This patch resolves a couple of the MORELLO TODOs we had in the codebase to remove the Morello defines from fake-capability compilation. It also removes `__CHERI_CAP_PERMISSION_PERMIT_CCALL__` to match the ACLE and ensures that the remaining ones are also defined when -march=morello. This now matches clang behaviour. Diff: --- gcc/c-family/c-cppbuiltin.c | 14 +++++--------- gcc/config/aarch64/aarch64-c.c | 22 +++------------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/gcc/c-family/c-cppbuiltin.c b/gcc/c-family/c-cppbuiltin.c index 8e4c338b8b0..a6c912dc352 100644 --- a/gcc/c-family/c-cppbuiltin.c +++ b/gcc/c-family/c-cppbuiltin.c @@ -1457,15 +1457,8 @@ c_cpp_builtins (cpp_reader *pfile) builtin_define_type_sizeof ("__SIZEOF_PTRDIFF_T__", unsigned_ptrdiff_type_node); - /* MORELLO TODO - For the moment we're going to predefine these macros when compiling for - fake-capability. - This should not stay for very long. - It's just here to help Carlos test the glibc build system in the time - before we have pure capability codegen. - Once we're getting pure-capability code running we should make these - predefined macros only available for that. */ - if (targetm.capability_mode().exists()) + if (targetm.capability_mode ().exists () + && targetm.capabilities_in_hardware ()) { /* N.b. I've not found these values defined in a document anywhere. The values were found by looking at the assembly after using them in @@ -1482,6 +1475,9 @@ c_cpp_builtins (cpp_reader *pfile) builtin_define_with_int_value ("__CHERI_CAP_PERMISSION_PERMIT_EXECUTE__", 32768); builtin_define_with_int_value ("__CHERI_CAP_PERMISSION_PERMIT_STORE__", 65536); builtin_define_with_int_value ("__CHERI_CAP_PERMISSION_PERMIT_LOAD__", 131072); + + if (targetm.capability_mode ().require () == Pmode) + cpp_define (pfile, "__CHERI_PURE_CAPABILITY__"); } /* A straightforward target hook doesn't work, because of problems diff --git a/gcc/config/aarch64/aarch64-c.c b/gcc/config/aarch64/aarch64-c.c index 72036213cc5..4798d80407e 100644 --- a/gcc/config/aarch64/aarch64-c.c +++ b/gcc/config/aarch64/aarch64-c.c @@ -140,32 +140,16 @@ aarch64_update_cpp_builtins (cpp_reader *pfile) aarch64_def_or_undef (TARGET_CAPABILITY_ANY, "__GCC_ARM_CAPABILITY_ANY", pfile); - /* MORELLO TODO - For the moment we're going to predefine these macros when compiling for - fake-capability. - This should not stay for very long. - It's just here to help Carlos test the glibc build system in the time - before we have pure capability codegen. - Once we're getting pure-capability code running we should make these - predefined macros only available for that. */ aarch64_def_or_undef (AARCH64_ISA_C64, "__ARM_FEATURE_C64", pfile); - if (TARGET_CAPABILITY_PURE || TARGET_CAPABILITY_FAKE) + + if (TARGET_MORELLO) { - /* N.b. I've only found the values for __ARM_CAP* defined in a document. - The others were found by looking at the assembly after using them in - the compiler explorer. */ - cpp_undef (pfile, "__CHERI_CAP_PERMISSION_PERMIT_CCALL__"); + /* These defines are Morello-specific, as per the Morello ACLE. */ builtin_define_with_int_value ("__ARM_CAP_PERMISSION_EXECUTIVE__", 2); builtin_define_with_int_value ("__ARM_CAP_PERMISSION_MUTABLE_LOAD__", 64); builtin_define_with_int_value ("__ARM_CAP_PERMISSION_COMPARTMENT_ID__", 128); builtin_define_with_int_value ("__ARM_CAP_PERMISSION_BRANCH_SEALED_PAIR__", 256); } - /* MORELLO TODO I guess there should be a hook to give the information of - whether we're targetting a pure capability ABI or not the frontend so that - `__CHERI_PURE_CAPABILITY__` can be defined in the `c_cpp_builtins` in the - C frontend code rather than in the backend. */ - aarch64_def_or_undef (TARGET_CAPABILITY_PURE, "__CHERI_PURE_CAPABILITY__", - pfile); aarch64_def_or_undef (TARGET_CRYPTO, "__ARM_FEATURE_CRYPTO", pfile); aarch64_def_or_undef (TARGET_SIMD_RDMA, "__ARM_FEATURE_QRDMX", pfile);