This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch libiberty/mach-o] fix byte-swapping of indices in wrapper sections.


Found while testing x86 X ppc ...
.. I missed byte-swapping the indices when outputting the index of the GNU wrapper for LTO sections.


OK/When?
Iain

libiberty:

	* simple-object-mach-o.c (simple_object_mach_o_write_segment):
	Byte-swap indices when required.

diff --git a/libiberty/simple-object-mach-o.c b/libiberty/simple- object-mach-o.c
index af5e4f9..fbf6a3f 100644
--- a/libiberty/simple-object-mach-o.c
+++ b/libiberty/simple-object-mach-o.c
@@ -1224,6 +1224,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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]