Skip to content

Commit 4653ecf

Browse files
committed
Add enough headers to support bdwgc
1 parent 5ae8020 commit 4653ecf

21 files changed

+8376
-6
lines changed

README.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ This is only rarely needed: macOS binaries will usually run just fine on a newer
7676
7777
This project is licensed under APSL 2.0, a variety of BSD style licenses, and public domain code:
7878
79-
* `src/usr/include` is extracted from the Libc, xnu, libpthread, libdispatch, and Libm. The source files are under a mix of the APSL 2.0 and a variety of BSD-style licenses. There are a few files that just say "all rights reserved". All those files have been replaced with a public domain version so they are also in effect open source.
79+
* `src/usr/include` is extracted from the Libc, xnu, cctools, libpthread, libdispatch, and Libm. The source files are under a mix of the APSL 2.0 and a variety of BSD-style licenses. There are a few files that just say "all rights reserved". All those files have been replaced with a public domain version so they are also in effect open source.
8080
* `src/*/libSystem.s` is extracted from the above, but because it's only a list of function names I don't believe it is covered by copyright and therefore can be considered public domain. If it is covered by copyright (I'm not a lawyer), it is covered by the same copyright as `src/usr/include` above.
8181
* Other files like the various update scripts are placed in the public domain.
8282

generate-stubs.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@
3232
def generateStubs(sysroot, outfile, target):
3333
# These symbols are not defined in the header files, but must be declared
3434
# anyway.
35-
symbols = {'dyld_stub_binder', '___bzero', '__tlv_bootstrap'}
35+
symbols = {
36+
'dyld_stub_binder',
37+
'___bzero',
38+
'__tlv_bootstrap',
39+
'___memmove_chk', '___memset_chk',
40+
'___stack_chk_guard', '___stack_chk_fail',
41+
}
3642

3743
# Parse the src/libSystem.h file to get a list of functions declared in libSystem.
3844
index = clang.cindex.Index.create()

src/TargetConditionals.h

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// This file is placed in the public domain.
2+
//
3+
// This file is a replacement for TargetConditionals.h for which I can't find an
4+
// open source version in an open source Apple library. (There is one in
5+
// CarbonHeaders but it is outdated doesn't support ARM64).
6+
7+
#define TARGET_CPU_PPC 0
8+
#define TARGET_CPU_PPC64 0
9+
#define TARGET_CPU_68K 0
10+
#define TARGET_CPU_X86 0
11+
#define TARGET_CPU_X86_64 defined(__x86_64__)
12+
#define TARGET_CPU_ARM 0
13+
#define TARGET_CPU_ARM64 defined(__arm64__)
14+
#define TARGET_CPU_MIPS 0
15+
#define TARGET_CPU_SPARC 0
16+
#define TARGET_CPU_ALPHA 0
17+
18+
// We only support macOS (OSX) right now.
19+
#define TARGET_OS_WIN32 0
20+
#define TARGET_OS_WINDOWS 0
21+
#define TARGET_OS_UNIX 0
22+
#define TARGET_OS_LINUX 0
23+
#define TARGET_OS_MAC 1
24+
#define TARGET_OS_OSX 1
25+
#define TARGET_OS_IPHONE 0
26+
#define TARGET_OS_IOS 0
27+
#define TARGET_OS_MACCATALYST 0
28+
#define TARGET_OS_TV 0
29+
#define TARGET_OS_WATCH 0
30+
#define TARGET_OS_VISION 0
31+
#define TARGET_OS_BRIDGE 0
32+
#define TARGET_OS_SIMULATOR 0
33+
#define TARGET_OS_DRIVERKIT 0

src/arm64/libSystem.s

+12
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ ___math_errhandling:
5555
.global ___mb_cur_max
5656
___mb_cur_max:
5757

58+
.global ___memmove_chk
59+
___memmove_chk:
60+
61+
.global ___memset_chk
62+
___memset_chk:
63+
5864
.global ___nan
5965
___nan:
6066

@@ -76,6 +82,12 @@ ___sputc:
7682
.global ___srget
7783
___srget:
7884

85+
.global ___stack_chk_fail
86+
___stack_chk_fail:
87+
88+
.global ___stack_chk_guard
89+
___stack_chk_guard:
90+
7991
.global ___stderrp
8092
___stderrp:
8193

0 commit comments

Comments
 (0)