public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Matthew Malcomson <matmal01@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/ARM/heads/morello)] aarch64: Update definition of (U)INTPTR_TYPE for purecap
Date: Tue, 21 Sep 2021 09:14:30 +0000 (GMT)	[thread overview]
Message-ID: <20210921091430.B204B385800A@sourceware.org> (raw)

https://gcc.gnu.org/g:2e79b38d26c995cd2521d6919047dda499ffdb6e

commit 2e79b38d26c995cd2521d6919047dda499ffdb6e
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Thu Sep 9 18:21:57 2021 +0100

    aarch64: Update definition of (U)INTPTR_TYPE for purecap
    
    We were previously defining __INTPTR_TYPE__ to __intcap_t but now that
    we support __intcap we should use that type directly, not least because
    this is what newlib expects. Likewise, __UINTPTR_TYPE__ should be
    defined to unsigned __intcap.
    
    This fixes build errors with tests that end up including newlib's
    sys/_intsup.h.
    
    gcc/ChangeLog:
    
            * config/aarch64/aarch64-elf.h (INTPTR_TYPE): update to use
            __intcap for pure/fakecap instead of older __intcap_t.
            (UINTPTR_TYPE): Update to use unsigned __intcap.
    
    gcc/c-family/ChangeLog:
    
            * c-common.c (c_common_nodes_and_builtins): Record unsigned
            __intcap as a builtin type. This is required for the
            identifier_global_value call to succeed on UINTPTR_TYPE later in
            the function.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/aarch64/morello/predefines.c: Fix up test accordingly.

Diff:
---
 gcc/c-family/c-common.c                               | 1 +
 gcc/config/aarch64/aarch64-elf.h                      | 4 ++--
 gcc/testsuite/gcc.target/aarch64/morello/predefines.c | 9 ++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 7f8e01aa57d..650b1c94610 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -4120,6 +4120,7 @@ c_common_nodes_and_builtins (void)
   if (intcap_type_node)
     {
       record_builtin_type (RID_INTCAP, NULL, intcap_type_node);
+      record_builtin_type (RID_MAX, "unsigned __intcap", uintcap_type_node);
       lang_hooks.types.register_builtin_type (intcap_type_node, "__intcap_t");
       lang_hooks.types.register_builtin_type (uintcap_type_node, "__uintcap_t");
     }
diff --git a/gcc/config/aarch64/aarch64-elf.h b/gcc/config/aarch64/aarch64-elf.h
index 2ffdbebe6ac..492b4fa6af2 100644
--- a/gcc/config/aarch64/aarch64-elf.h
+++ b/gcc/config/aarch64/aarch64-elf.h
@@ -151,10 +151,10 @@ ASM_MABI_SPEC
 #undef UINTPTR_TYPE
 #undef PTRADDR_TYPE
 #define INTPTR_TYPE ((TARGET_CAPABILITY_FAKE || TARGET_CAPABILITY_PURE) \
-			? "__intcap_t" \
+			? "__intcap" \
 			: (LONG_TYPE_SIZE == 64 ? "long int" : "int"))
 #define UINTPTR_TYPE ((TARGET_CAPABILITY_FAKE || TARGET_CAPABILITY_PURE) \
-			? "__uintcap_t" \
+			? "unsigned __intcap" \
 			: (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int"))
 #define PTRADDR_TYPE "long unsigned int"
 
diff --git a/gcc/testsuite/gcc.target/aarch64/morello/predefines.c b/gcc/testsuite/gcc.target/aarch64/morello/predefines.c
index 2a2b47109dc..2da0ba1cd96 100644
--- a/gcc/testsuite/gcc.target/aarch64/morello/predefines.c
+++ b/gcc/testsuite/gcc.target/aarch64/morello/predefines.c
@@ -2,11 +2,11 @@
 
 /* Declare twice to ensure that the types are the same (error otherwise).  */
 __INTPTR_TYPE__ x(int);
-__intcap_t x(int);
+__intcap x(int);
 
 /* Declare twice to ensure that the types are the same (error otherwise).  */
 __UINTPTR_TYPE__ y(int);
-__uintcap_t y(int);
+unsigned __intcap y(int);
 
 /* Declare twice to ensure that the types are the same (error otherwise).  */
 __PTRADDR_TYPE__ z(int);
@@ -16,8 +16,7 @@ long unsigned int z(int);
    should remove one later since having two is superfluous.  */
 #define make_func(X) func ## X
 #define wrapper(X) make_func(X)()
-int func__intcap_t () { return 0; }
-int func__uintcap_t () { return 0; }
+int func__intcap () { return 0; }
 
 #define assert(x) do {if (!(x)) { __builtin_abort (); }} while (0)
 struct myval {
@@ -66,5 +65,5 @@ int main()
 	assert (__CHERI_CAP_PERMISSION_PERMIT_EXECUTE__ == 32768);
 	assert (__CHERI_CAP_PERMISSION_PERMIT_STORE__ == 65536);
 	assert (__CHERI_CAP_PERMISSION_PERMIT_LOAD__ == 131072);
-	return wrapper(__INTPTR_TYPE__) + wrapper(__UINTPTR_TYPE__);
+	return wrapper(__INTPTR_TYPE__);
 }


                 reply	other threads:[~2021-09-21  9:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210921091430.B204B385800A@sourceware.org \
    --to=matmal01@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).