public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3005] libiberty, Darwin : Fix simple-object LTO table for cross-endian case.
@ 2021-08-18 18:34 Iain D Sandoe
  0 siblings, 0 replies; only message in thread
From: Iain D Sandoe @ 2021-08-18 18:34 UTC (permalink / raw)
  To: gcc-cvs

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.


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

only message in thread, other threads:[~2021-08-18 18:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 18:34 [gcc r12-3005] 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).