https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96973
--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> --- (In reply to Francois-Xavier Coudert from comment #4) from fat.h FAT headers are always written bigendian * at least there's no statement revoking that in the section on FAT64 * it doesn't seem that the FAT64 format is considered stable yet - so we might need to experiment, There's no statement that says the FAT64 > if (is_64) > - memcpy (&fat_arch, > - (const char *) arch_view.data + i * arch_size, > - arch_size); > + { > + memcpy (&fat_arch, > + (const char *) arch_view.data + i * arch_size, > + arch_size); > + if (swapped) > + fat_arch.offset = __builtin_bswap64 (fat_arch.offset); > + } > else > { > struct macho_fat_arch fat_arch_32; > @@ -809,7 +813,10 @@ macho_add_fat (struct backtrace_state *state, const > char *filename, > arch_size); > fat_arch.cputype = fat_arch_32.cputype; > fat_arch.cpusubtype = fat_arch_32.cpusubtype; > - fat_arch.offset = (uint64_t) fat_arch_32.offset; > + if (swapped) > + fat_arch.offset = (uint64_t) > __builtin_bswap32(fat_arch_32.offset); > + else > + fat_arch.offset = (uint64_t) fat_arch_32.offset; So in the case of 32b FAT entries... We also need to swap any other items we use (and before promoting to 64b in the case of the size.) > fat_arch.size = (uint64_t) fat_arch_32.size; > fat_arch.align = fat_arch_32.align; > fat_arch.reserved = 0;