aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2021-04-09 13:40:11 +0100
committerIain Sandoe <iain@sandoe.co.uk>2021-08-18 19:33:49 +0100
commit220c410162ebece4fffa2912ed79e348d3731d77 (patch)
tree8198223ef5e41232252406ab2828b088a4ff1aa8
parent15bdae016654f63a36e49a37c9d26282bebb1da9 (diff)
downloadgcc-220c410162ebece4fffa2912ed79e348d3731d77.zip
gcc-220c410162ebece4fffa2912ed79e348d3731d77.tar.gz
gcc-220c410162ebece4fffa2912ed79e348d3731d77.tar.bz2
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.
-rw-r--r--libiberty/simple-object-mach-o.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libiberty/simple-object-mach-o.c b/libiberty/simple-object-mach-o.c
index aa5e095..72b69d1 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.