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 r12-3005] libiberty, Darwin : Fix simple-object LTO table for cross-endian case.
Date: Wed, 18 Aug 2021 18:34:52 +0000 (GMT)	[thread overview]
Message-ID: <20210818183452.955143854812@sourceware.org> (raw)

https://gcc.gnu.org/g:220c410162ebece4fffa2912ed79e348d3731d77

commit r12-3005-g220c410162ebece4fffa2912ed79e348d3731d77
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Fri Apr 9 13:40:11 2021 +0100

    libiberty, Darwin : Fix simple-object LTO table for cross-endian case.
    
    We encapsulate streamed IR in three special sections with a table
    that describes their entries.  The table is expected to be written
    with native endianness for the target, but for cross-endian cross-
    compilation the swapping was omitted.  Fixed thus.
    
    Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
    
    libiberty/ChangeLog:
    
            * simple-object-mach-o.c (simple_object_mach_o_write_segment):
            Arrange to swap the LTO index tables where needed.

Diff:
---
 libiberty/simple-object-mach-o.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libiberty/simple-object-mach-o.c b/libiberty/simple-object-mach-o.c
index aa5e0952faf..72b69d19c21 100644
--- a/libiberty/simple-object-mach-o.c
+++ b/libiberty/simple-object-mach-o.c
@@ -1225,6 +1225,11 @@ simple_object_mach_o_write_segment (simple_object_write *sobj, int descriptor,
 	index[4 * i] -= index[0];
       index[0] = 0;
 
+      /* Swap the indices, if required.  */
+
+      for (i = 0; i < (nsects_in * 4); ++i)
+	set_32 (&index[i], index[i]);
+
       sechdr_offset += sechdrsize;
 
       /* Write out the section names.


                 reply	other threads:[~2021-08-18 18:34 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=20210818183452.955143854812@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).