From 55197a7077608c9e91d57e75cecacb216c3110b8 Mon Sep 17 00:00:00 2001 From: Ariel Abreu Date: Wed, 13 May 2020 22:45:19 -0400 Subject: [PATCH] Apply workaround for conflicting types when including mach-o headers This workaround was copied from Darling's `platform-include/mach-o/{fat,loader}.h` --- cctools/include/mach-o/fat.h | 10 +++++++-- cctools/include/mach-o/loader.h | 38 +++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/cctools/include/mach-o/fat.h b/cctools/include/mach-o/fat.h index 98a7312..ddeef11 100644 --- a/cctools/include/mach-o/fat.h +++ b/cctools/include/mach-o/fat.h @@ -42,8 +42,14 @@ * and contains the constants for the possible values of these types. */ #include -#include -#include + +#ifdef __APPLE__ + #include + #include +#else + typedef int cpu_type_t; + typedef int cpu_subtype_t; +#endif #define FAT_MAGIC 0xcafebabe #define FAT_CIGAM 0xbebafeca /* NXSwapLong(FAT_MAGIC) */ diff --git a/cctools/include/mach-o/loader.h b/cctools/include/mach-o/loader.h index 193d424..a28d921 100644 --- a/cctools/include/mach-o/loader.h +++ b/cctools/include/mach-o/loader.h @@ -28,24 +28,30 @@ */ #include -/* - * 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 +#ifdef __APPLE__ + /* + * 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 -/* - * 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 + /* + * 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 -/* - * is expected to define the flavors of the thread - * states and the structures of those flavors for each machine. - */ -#include -#include + /* + * is expected to define the flavors of the thread + * states and the structures of those flavors for each machine. + */ + #include + #include +#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