OLD | NEW |
| (Empty) |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 # Definitions of symbols that may be needed at runtime but aren't necessarily | |
6 # present in the SDK chosen for compilation. | |
7 # | |
8 # This file provides symbols for _NSConcreteGlobalBlock and | |
9 # _NSConcreteStackBlock, normally present in libSystem.dylib and provided by | |
10 # by libclosure-38/data.c in Mac OS X 10.6 and later. It also provides symbols | |
11 # for various block runtime functions provided by libclosure-38/runtime.c. | |
12 # When using the 10.5 SDK, the symbols are not present. This file's definition | |
13 # can be used with extreme care in an application that needs to use the 10.5 | |
14 # SDK in conjunction with blocks. | |
15 # | |
16 # This file cooperates with the build system to produce a dynamic library | |
17 # that, when linked against, causes dependents to look in libSystem for the | |
18 # symbols provided here. It also cooperates with a header that causes | |
19 # dependents to treat the symbols provided here as weak imports, critical for | |
20 # the resultant output to be loadable on 10.5. | |
21 | |
22 # To simplify things, this file assumes it's being built with the 10.5 SDK, | |
23 # a deployment target of 10.5, and is producing 32-bit x86 code. Other | |
24 # combinations are possible, but not interesting for the time being. See | |
25 # <sys/cdefs.h> for interesting ways that names might be mangled in other | |
26 # configurations. | |
27 | |
28 #include <AvailabilityMacros.h> | |
29 | |
30 #if MAC_OS_X_VERSION_MIN_REQUIRED != MAC_OS_X_VERSION_10_5 || \ | |
31 MAC_OS_X_VERSION_MAX_ALLOWED != MAC_OS_X_VERSION_10_5 || \ | |
32 !defined(__i386__) | |
33 #error This file only supports 32-bit x86 code with both SDK and DT set to 10.5 | |
34 #endif | |
35 | |
36 #define DEFINE_GLOBAL_SYMBOL(name) \ | |
37 .globl name ## ;\ | |
38 name ## : | |
39 | |
40 .text | |
41 | |
42 # Mac OS X 10.6.8 libclosure-38/runtime.c | |
43 | |
44 DEFINE_GLOBAL_SYMBOL(__Block_copy) | |
45 DEFINE_GLOBAL_SYMBOL(__Block_release) | |
46 DEFINE_GLOBAL_SYMBOL(__Block_object_assign) | |
47 DEFINE_GLOBAL_SYMBOL(__Block_object_dispose) | |
48 | |
49 .section __DATA,__data | |
50 | |
51 # Mac OS X 10.6.8 libclosure-38/data.c | |
52 | |
53 DEFINE_GLOBAL_SYMBOL(__NSConcreteGlobalBlock) | |
54 DEFINE_GLOBAL_SYMBOL(__NSConcreteStackBlock) | |
55 | |
56 # When this file is in use, the linker is expected to link things against both | |
57 # this file and the real copy of libSystem present in the SDK. When doing so, | |
58 # the linker is smart enough to produce only one LC_LOAD_DYLIB load command. | |
59 # However, it's not smart enough to notice that while this file's dylib only | |
60 # provides weak-imported symbols, the real libSystem's dylib does not. | |
61 # Consequently, it may produce an LC_LOAD_WEAK_DYLIB load command for | |
62 # libSystem instead of an ordinary LC_LOAD_DYLIB command. LC_LOAD_WEAK_DYLIB | |
63 # declares that any symbol offered by the library, and in fact the entire | |
64 # library, is permitted to be missing at runtime. This is entirely | |
65 # inappropriate for libSystem. To counteract this problem, this file also | |
66 # defines some other symbols that libSystem provides. Dependents of this | |
67 # library are not expected to treat these other symbols as weak imports. In | |
68 # order for any dependent that links against this library to load it with an | |
69 # LC_LOAD_DYLIB command instead of an LC_LOAD_WEAK_DYLIB command, this library | |
70 # must satisfy at least one unresolved non-weak-import symbol required by the | |
71 # dependent. | |
72 | |
73 .text | |
74 | |
75 # |exit| is a good one: because it's referenced by crt1.o, ordinary executables | |
76 # are guaranteed to need this symbol. Unfortunately, there's no such symbol in | |
77 # dylib1.o that libSystem is expected to provide, so a few other common libc | |
78 # symbols are thrown into the mix. | |
79 DEFINE_GLOBAL_SYMBOL(_exit) | |
80 | |
81 # Include |close| because well-written programs that use the standard library | |
82 # are likely to refer to it. Include |open| for good measure because it goes | |
83 # pretty well with this. Include the stdio abstractions for these functions | |
84 # as well. | |
85 DEFINE_GLOBAL_SYMBOL(_close$UNIX2003) | |
86 DEFINE_GLOBAL_SYMBOL(_open$UNIX2003) | |
87 DEFINE_GLOBAL_SYMBOL(_fclose) | |
88 DEFINE_GLOBAL_SYMBOL(_fopen) | |
89 DEFINE_GLOBAL_SYMBOL(_fdopen) | |
90 DEFINE_GLOBAL_SYMBOL(_freopen$UNIX2003) | |
91 | |
92 # Commonly-used allocation functions. | |
93 DEFINE_GLOBAL_SYMBOL(_malloc) | |
94 DEFINE_GLOBAL_SYMBOL(_calloc) | |
95 DEFINE_GLOBAL_SYMBOL(_realloc) | |
96 DEFINE_GLOBAL_SYMBOL(_reallocf) | |
97 DEFINE_GLOBAL_SYMBOL(_valloc) | |
98 DEFINE_GLOBAL_SYMBOL(_free) | |
99 | |
100 # Include |printf|, |fprintf|, |sprintf|, |snprintf|, and |puts|, because | |
101 # small test programs are likely to refer to one of these. puts is rarely | |
102 # invoked directly, but the compiler may optimize simple printf calls into | |
103 # puts calls. | |
104 DEFINE_GLOBAL_SYMBOL(_printf) | |
105 DEFINE_GLOBAL_SYMBOL(_fprintf) | |
106 DEFINE_GLOBAL_SYMBOL(_sprintf) | |
107 DEFINE_GLOBAL_SYMBOL(_snprintf) | |
108 DEFINE_GLOBAL_SYMBOL(_puts) | |
109 | |
110 # Some <string.h> functions that are commonly used. | |
111 DEFINE_GLOBAL_SYMBOL(_memcmp) | |
112 DEFINE_GLOBAL_SYMBOL(_memcpy) | |
113 DEFINE_GLOBAL_SYMBOL(_memmove) | |
114 DEFINE_GLOBAL_SYMBOL(_memset) | |
115 DEFINE_GLOBAL_SYMBOL(_strcasecmp) | |
116 DEFINE_GLOBAL_SYMBOL(_strcat) | |
117 DEFINE_GLOBAL_SYMBOL(_strchr) | |
118 DEFINE_GLOBAL_SYMBOL(_strcmp) | |
119 DEFINE_GLOBAL_SYMBOL(_strcpy) | |
120 DEFINE_GLOBAL_SYMBOL(_strdup) | |
121 DEFINE_GLOBAL_SYMBOL(_strlcat) | |
122 DEFINE_GLOBAL_SYMBOL(_strlcpy) | |
123 DEFINE_GLOBAL_SYMBOL(_strlen) | |
124 DEFINE_GLOBAL_SYMBOL(_strncasecmp) | |
125 DEFINE_GLOBAL_SYMBOL(_strncat) | |
126 DEFINE_GLOBAL_SYMBOL(_strncmp) | |
127 DEFINE_GLOBAL_SYMBOL(_strncpy) | |
128 DEFINE_GLOBAL_SYMBOL(_strnstr) | |
129 DEFINE_GLOBAL_SYMBOL(_strstr) | |
130 | |
131 # Some data-section symbols that might be referenced. | |
132 | |
133 .section __DATA,__data | |
134 | |
135 DEFINE_GLOBAL_SYMBOL(___stdinp) | |
136 DEFINE_GLOBAL_SYMBOL(___stdoutp) | |
137 DEFINE_GLOBAL_SYMBOL(___stderrp) | |
138 | |
139 #undef DEFINE_GLOBAL_SYMBOL | |
OLD | NEW |