History

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

Michael Matz committed 6 years ago

Commit 5d2f4cb1 parent b0b0e483 files · +7 −2Browse files

Unified · Split

3 files
  1. include/stddef.h +3 −2
  2. lib/alloca86_64.S +3 −0
  3. libtcc.c +1 −0
include/stddef.h+3−2
@@ -17,7 +17,7 @@ typedef union { long long __ll; long double __ld; } max_align_t; · 16 unmodified lines
1717 typedef signed char int8_t;
1818 typedef signed short int int16_t;
1919 typedef signed int int32_t;
20−#ifdef __LP64__
20+#if defined(__LP64__) && !defined(__APPLE__)
2121 typedef signed long int int64_t;
2222 #else
2323 typedef signed long long int int64_t;
@@ -25,7 +25,7 @@ typedef signed long long int int64_t; · 1 unmodified line
2525 typedef unsigned char uint8_t;
2626 typedef unsigned short int uint16_t;
2727 typedef unsigned int uint32_t;
28−#ifdef __LP64__
28+#if defined(__LP64__) && !defined(__APPLE__)
2929 typedef unsigned long int uint64_t;
3030 #else
3131 typedef unsigned long long int uint64_t;
@@ -36,6 +36,7 @@ typedef unsigned long long int uint64_t; · 4 unmodified lines
3636 #define NULL ((void*)0)
3737 #endif
3838
39+#undef offsetof
3940 #define offsetof(type, field) ((size_t)&((type *)0)->field)
4041
4142 void *alloca(size_t size);
lib/alloca86_64.S+3−0
@@ -1,6 +1,9 @@
11 /* ---------------------------------------------- */
22 /* alloca86_64.S */
33
4+#ifdef __APPLE__
5+#define alloca _alloca
6+#endif
47 .globl alloca
58
69 alloca:
libtcc.c+1−0
@@ -943,6 +943,7 @@ LIBTCCAPI TCCState *tcc_new(void) · 942 unmodified lines
943943 /* emulate APPLE-GCC to make libc's headerfiles compile: */
944944 tcc_define_symbol(s, "__APPLE__", "1");
945945 tcc_define_symbol(s, "__GNUC__", "4"); /* darwin emits warning on GCC<4 */
946+ tcc_define_symbol(s, "__APPLE_CC__", "1"); /* for <TargetConditionals.h> */
946947
947948 /* avoids usage of GCC/clang specific builtins in libc-headerfiles: */
948949 tcc_define_symbol(s, "__FINITE_MATH_ONLY__", "1");

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t