public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r10-10784] libiberty, Darwin : Fix simple-object LTO table for cross-endian case.
@ 2022-05-29 19:06 Iain D Sandoe
  0 siblings, 0 replies; only message in thread
From: Iain D Sandoe @ 2022-05-29 19:06 UTC (permalink / raw)
  To: gcc-cvs

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

commit r10-10784-gd1618884bc3d0013df18a1e550357e6156e9a5ed
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.
    
    (cherry picked from commit 220c410162ebece4fffa2912ed79e348d3731d77)

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 14f53428643..f36b9640ebe 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 ((unsigned char *) &index[i], index[i]);
+
       sechdr_offset += sechdrsize;
 
       /* Write out the section names.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-29 19:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-29 19:06 [gcc r10-10784] libiberty, Darwin : Fix simple-object LTO table for cross-endian case Iain D Sandoe

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).