mirror of
https://github.com/frida/tinycc
synced 2024-11-23 16:19:35 +03:00
macos: various fixes
* 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
This commit is contained in:
parent
b0b0e48409
commit
5d2f4cb403
@ -17,7 +17,7 @@ typedef union { long long __ll; long double __ld; } max_align_t;
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int int16_t;
|
||||
typedef signed int int32_t;
|
||||
#ifdef __LP64__
|
||||
#if defined(__LP64__) && !defined(__APPLE__)
|
||||
typedef signed long int int64_t;
|
||||
#else
|
||||
typedef signed long long int int64_t;
|
||||
@ -25,7 +25,7 @@ typedef signed long long int int64_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short int uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
#ifdef __LP64__
|
||||
#if defined(__LP64__) && !defined(__APPLE__)
|
||||
typedef unsigned long int uint64_t;
|
||||
#else
|
||||
typedef unsigned long long int uint64_t;
|
||||
@ -36,6 +36,7 @@ typedef unsigned long long int uint64_t;
|
||||
#define NULL ((void*)0)
|
||||
#endif
|
||||
|
||||
#undef offsetof
|
||||
#define offsetof(type, field) ((size_t)&((type *)0)->field)
|
||||
|
||||
void *alloca(size_t size);
|
||||
|
@ -1,6 +1,9 @@
|
||||
/* ---------------------------------------------- */
|
||||
/* alloca86_64.S */
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define alloca _alloca
|
||||
#endif
|
||||
.globl alloca
|
||||
|
||||
alloca:
|
||||
|
1
libtcc.c
1
libtcc.c
@ -943,6 +943,7 @@ LIBTCCAPI TCCState *tcc_new(void)
|
||||
/* emulate APPLE-GCC to make libc's headerfiles compile: */
|
||||
tcc_define_symbol(s, "__APPLE__", "1");
|
||||
tcc_define_symbol(s, "__GNUC__", "4"); /* darwin emits warning on GCC<4 */
|
||||
tcc_define_symbol(s, "__APPLE_CC__", "1"); /* for <TargetConditionals.h> */
|
||||
|
||||
/* avoids usage of GCC/clang specific builtins in libc-headerfiles: */
|
||||
tcc_define_symbol(s, "__FINITE_MATH_ONLY__", "1");
|
||||
|
Loading…
Reference in New Issue
Block a user