* alloca needs to be _alloca * int64_t and uint64_t are also defined in <sys/_types/_int64_t.h> but as long long, not as long, so adjust out <stddef.h> to agree on Darwin * define __APPLE_CC__ so that <TargetConditionals.h> correctly defines various macros like TARGET_OS_MAC and TARGET_CPU_X86_64
Unified · Split
| @@ -17,7 +17,7 @@ typedef union { long long __ll; long double __ld; } max_align_t; · 16 unmodified lines | ||
| 17 | 17 | typedef signed char int8_t; |
| 18 | 18 | typedef signed short int int16_t; |
| 19 | 19 | typedef signed int int32_t; |
| 20 | −#ifdef __LP64__ | |
| 20 | +#if defined(__LP64__) && !defined(__APPLE__) | |
| 21 | 21 | typedef signed long int int64_t; |
| 22 | 22 | #else |
| 23 | 23 | typedef signed long long int int64_t; |
| @@ -25,7 +25,7 @@ typedef signed long long int int64_t; · 1 unmodified line | ||
| 25 | 25 | typedef unsigned char uint8_t; |
| 26 | 26 | typedef unsigned short int uint16_t; |
| 27 | 27 | typedef unsigned int uint32_t; |
| 28 | −#ifdef __LP64__ | |
| 28 | +#if defined(__LP64__) && !defined(__APPLE__) | |
| 29 | 29 | typedef unsigned long int uint64_t; |
| 30 | 30 | #else |
| 31 | 31 | typedef unsigned long long int uint64_t; |
| @@ -36,6 +36,7 @@ typedef unsigned long long int uint64_t; · 4 unmodified lines | ||
| 36 | 36 | #define NULL ((void*)0) |
| 37 | 37 | #endif |
| 38 | 38 | |
| 39 | +#undef offsetof | |
| 39 | 40 | #define offsetof(type, field) ((size_t)&((type *)0)->field) |
| 40 | 41 | |
| 41 | 42 | void *alloca(size_t size); |
| @@ -1,6 +1,9 @@ | ||
| 1 | 1 | /* ---------------------------------------------- */ |
| 2 | 2 | /* alloca86_64.S */ |
| 3 | 3 | |
| 4 | +#ifdef __APPLE__ | |
| 5 | +#define alloca _alloca | |
| 6 | +#endif | |
| 4 | 7 | .globl alloca |
| 5 | 8 | |
| 6 | 9 | alloca: |
| @@ -943,6 +943,7 @@ LIBTCCAPI TCCState *tcc_new(void) · 942 unmodified lines | ||
| 943 | 943 | /* emulate APPLE-GCC to make libc's headerfiles compile: */ |
| 944 | 944 | tcc_define_symbol(s, "__APPLE__", "1"); |
| 945 | 945 | tcc_define_symbol(s, "__GNUC__", "4"); /* darwin emits warning on GCC<4 */ |
| 946 | + tcc_define_symbol(s, "__APPLE_CC__", "1"); /* for <TargetConditionals.h> */ | |
| 946 | 947 | |
| 947 | 948 | /* avoids usage of GCC/clang specific builtins in libc-headerfiles: */ |
| 948 | 949 | tcc_define_symbol(s, "__FINITE_MATH_ONLY__", "1"); |