Automatic date update in version.in
[binutils-gdb.git] / libiberty / simple-object-mach-o.c
index b90fca88b2368d27191be5618e312bda645033a9..bbb7d7550d43967bd0040c678926c33e05c91344 100644 (file)
@@ -1,5 +1,5 @@
 /* simple-object-mach-o.c -- routines to manipulate Mach-O object files.
-   Copyright (C) 2010-2017 Free Software Foundation, Inc.
+   Copyright (C) 2010-2022 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Google.
 
 This program is free software; you can redistribute it and/or modify it
@@ -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.