Apply workaround for conflicting types when including mach-o headers

This workaround was copied from Darling's `platform-include/mach-o/{fat,loader}.h`
This commit is contained in:
Ariel Abreu 2020-05-13 22:45:19 -04:00
parent 55c3dd7697
commit 55197a7077
No known key found for this signature in database
GPG Key ID: F42D99D3C57EFED6
2 changed files with 30 additions and 18 deletions

View File

@ -42,8 +42,14 @@
* and contains the constants for the possible values of these types.
*/
#include <stdint.h>
#include <mach/machine.h>
#include <architecture/byte_order.h>
#ifdef __APPLE__
#include <mach/machine.h>
#include <architecture/byte_order.h>
#else
typedef int cpu_type_t;
typedef int cpu_subtype_t;
#endif
#define FAT_MAGIC 0xcafebabe
#define FAT_CIGAM 0xbebafeca /* NXSwapLong(FAT_MAGIC) */

View File

@ -28,24 +28,30 @@
*/
#include <stdint.h>
/*
#ifdef __APPLE__
/*
* <mach/machine.h> is needed here for the cpu_type_t and cpu_subtype_t types
* and contains the constants for the possible values of these types.
*/
#include <mach/machine.h>
#include <mach/machine.h>
/*
/*
* <mach/vm_prot.h> is needed here for the vm_prot_t type and contains the
* constants that are or'ed together for the possible values of this type.
*/
#include <mach/vm_prot.h>
#include <mach/vm_prot.h>
/*
/*
* <machine/thread_status.h> is expected to define the flavors of the thread
* states and the structures of those flavors for each machine.
*/
#include <mach/machine/thread_status.h>
#include <architecture/byte_order.h>
#include <mach/machine/thread_status.h>
#include <architecture/byte_order.h>
#else
typedef int cpu_type_t;
typedef int cpu_subtype_t;
typedef int vm_prot_t;
#endif // __APPLE__
/*
* The 32-bit mach header appears at the very beginning of the object file for