public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Iain D Sandoe <iains@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-9092] libgcc, aarch64: Allow for BE platforms in heap trampolines.
Date: Wed, 21 Feb 2024 07:54:00 +0000 (GMT)	[thread overview]
Message-ID: <20240221075400.A81643858C53@sourceware.org> (raw)

https://gcc.gnu.org/g:c0a80af4a1d70562dd6671047fe6dd92dcc3f544

commit r14-9092-gc0a80af4a1d70562dd6671047fe6dd92dcc3f544
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sun Feb 18 06:52:47 2024 +0000

    libgcc, aarch64: Allow for BE platforms in heap trampolines.
    
    This arranges that the byte order of the instruction sequences is
    independent of the byte order of memory.
    
    libgcc/ChangeLog:
    
            * config/aarch64/heap-trampoline.c
            (aarch64_trampoline_insns): Arrange to encode instructions as a
            byte array so that the order is independent of memory byte order.
            (struct aarch64_trampoline): Likewise.
    
    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

Diff:
---
 libgcc/config/aarch64/heap-trampoline.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/libgcc/config/aarch64/heap-trampoline.c b/libgcc/config/aarch64/heap-trampoline.c
index 1e3460b1601d..885df629da71 100644
--- a/libgcc/config/aarch64/heap-trampoline.c
+++ b/libgcc/config/aarch64/heap-trampoline.c
@@ -30,23 +30,23 @@ void __gcc_nested_func_ptr_created (void *chain, void *func, void *dst);
 void __gcc_nested_func_ptr_deleted (void);
 
 #if defined(__linux__)
-static const uint32_t aarch64_trampoline_insns[] = {
-  0xd503245f, /* hint    34 */
-  0x580000b1, /* ldr     x17, .+20 */
-  0x580000d2, /* ldr     x18, .+24 */
-  0xd61f0220, /* br      x17 */
-  0xd5033f9f, /* dsb     sy */
-  0xd5033fdf /* isb */
+static const unsigned char aarch64_trampoline_insns[6][4] = {
+  {0x5f, 0x24, 0x03, 0xd5}, /* hint    34 */
+  {0xb1, 0x00, 0x00, 0x58}, /* ldr     x17, .+20 */
+  {0xd2, 0x00, 0x00, 0x58}, /* ldr     x18, .+24 */
+  {0x20, 0x02, 0x1f, 0xd6}, /* br      x17 */
+  {0x9f, 0x3f, 0x03, 0xd5}, /* dsb     sy */
+  {0xdf, 0x3f, 0x03, 0xd5} /* isb */
 };
 
 #elif __APPLE__
-static const uint32_t aarch64_trampoline_insns[] = {
-  0xd503245f, /* hint    34 */
-  0x580000b1, /* ldr     x17, .+20 */
-  0x580000d0, /* ldr     x16, .+24 */
-  0xd61f0220, /* br      x17 */
-  0xd5033f9f, /* dsb     sy */
-  0xd5033fdf /* isb */
+static const unsigned char aarch64_trampoline_insns[6][4] = {
+  {0x5f, 0x24, 0x03, 0xd5}, /* hint    34 */
+  {0xb1, 0x00, 0x00, 0x58}, /* ldr     x17, .+20 */
+  {0xd0, 0x00, 0x00, 0x58}, /* ldr     x16, .+24 */
+  {0x20, 0x02, 0x1f, 0xd6}, /* br      x17 */
+  {0x9f, 0x3f, 0x03, 0xd5}, /* dsb     sy */
+  {0xdf, 0x3f, 0x03, 0xd5} /* isb */
 };
 
 #else
@@ -54,7 +54,7 @@ static const uint32_t aarch64_trampoline_insns[] = {
 #endif
 
 struct aarch64_trampoline {
-  uint32_t insns[6];
+  unsigned char insns[6][4];
   void *func_ptr;
   void *chain_ptr;
 };

                 reply	other threads:[~2024-02-21  7:54 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=20240221075400.A81643858C53@sourceware.org \
    --to=iains@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).