2 * stubs for C-linkage library functions which we need to refer to
5 * (But note this is only the Linux version, as per the FIXME
6 * note in the BSD version in undefineds.h.)
8 * These stubs exist for the benefit of Lisp code that needs to refer
9 * to foreign symbols when dlsym() is not available (i.e. when dumping
10 * cold-sbcl.core, when we may be running in a host that's not SBCL,
11 * or on platforms that don't have it at all). If the runtime is
12 * dynamically linked, library functions won't be linked into it, so
13 * the map file won't show them. So, we need a bunch of stubs that
18 * This software is part of the SBCL system. See the README file for
21 * This software is derived from the CMU CL system, which was
22 * written at Carnegie Mellon University and released into the
23 * public domain. The software is in the public domain and is
24 * provided with absolutely no warranty. See the COPYING and CREDITS
25 * files for more information.
27 #define LANGUAGE_ASSEMBLY
32 #if defined LISP_FEATURE_X86
34 #define LDSO_STUBIFY(fct) \
36 .globl ldso_stub__ ## fct ; \
37 .type ldso_stub__ ## fct,@function ; \
38 ldso_stub__ ## fct: ; \
41 .size ldso_stub__ ## fct,.L ## fct ## e1-ldso_stub__ ## fct ;
43 #elif ((defined LISP_FEATURE_OSF1) && (defined LISP_FEATURE_ALPHA))
44 /* osf1 has ancient cpp that doesn't do ## */
45 #define LDSO_STUBIFY(fct) \
46 .globl ldso_stub__/**/fct ; \
47 ldso_stub__/**/fct: ; \
52 #elif ((defined LISP_FEATURE_LINUX) && (defined LISP_FEATURE_ALPHA))
53 /* but there's no reason we need to put up with that on modern (Linux) OSes */
54 #define LDSO_STUBIFY(fct) \
55 .globl ldso_stub__ ## fct ; \
56 .type ldso_stub__ ## fct,@function ; \
57 ldso_stub__ ## fct: ; \
60 .size ldso_stub__ ## fct,.L ## fct ## e1-ldso_stub__ ## fct ;
62 #elif ((defined LISP_FEATURE_PPC) && (defined LISP_FEATURE_LINUX))
63 #define LDSO_STUBIFY(fct) \
64 .globl ldso_stub__ ## fct ; \
65 .type ldso_stub__ ## fct,@function ; \
66 ldso_stub__ ## fct: ; \
69 .size ldso_stub__ ## fct,.L ## fct ## e1-ldso_stub__ ## fct ;
71 #elif ((defined LISP_FEATURE_PPC) && (defined LISP_FEATURE_DARWIN))
72 #define LDSO_STUBIFY(fct) @\
74 .globl ldso_stub___ ## fct @\
75 ldso_stub___ ## fct: @\
76 b ldso_stub__ ## fct ## stub @\
77 .symbol_stub ldso_stub__ ## fct ## stub: @\
78 .indirect_symbol _ ## fct @\
79 lis r11,ha16(ldso_stub__ ## fct ## $lazy_ptr) @\
80 lwz r12,lo16(ldso_stub__ ## fct ## $lazy_ptr)(r11) @\
82 addi r11,r11,lo16(ldso_stub__ ## fct ## $lazy_ptr) @\
84 .lazy_symbol_pointer @\
85 ldso_stub__ ## fct ## $lazy_ptr: @\
86 .indirect_symbol _ ## fct @\
87 .long dyld_stub_binding_helper
89 #elif defined LISP_FEATURE_SPARC
91 /* This is an attempt to follow DB's hint of sbcl-devel
92 * 2001-09-18. -- CSR */
93 #define LDSO_STUBIFY(fct) \
94 .globl ldso_stub__ ## fct ; \
95 .type ldso_stub__ ## fct,@function ; \
96 ldso_stub__ ## fct: ; \
97 sethi %hi(fct),%g1 ; \
98 jmpl %g1+%lo(fct),%g0 ; \
99 nop /* delay slot*/ ; \
101 .size ldso_stub__ ## fct,.L ## fct ## e1-ldso_stub__ ## fct ;
103 #elif defined LISP_FEATURE_MIPS
105 /* KLUDGE: set up the vital fifth argument, passed on the
106 stack. Do this unconditionally, even if the stub is for a
107 function with few arguments: it can't hurt. We only do this for
108 the fifth argument, as the first four are passed in registers
109 and we apparently don't ever need to pass six arguments to a
110 libc function. -- CSR, 2003-10-29 */
112 #define LDSO_STUBIFY(fct) \
113 .globl ldso_stub__ ## fct ; \
114 .type ldso_stub__ ## fct,@function ; \
115 ldso_stub__ ## fct: ; \
128 .size ldso_stub__ ## fct,.L ## fct ## e1-ldso_stub__ ## fct ;
131 #error unsupported CPU architecture
142 LDSO_STUBIFY(cfgetispeed)
143 LDSO_STUBIFY(cfgetospeed)
144 LDSO_STUBIFY(cfsetispeed)
145 LDSO_STUBIFY(cfsetospeed)
149 LDSO_STUBIFY(closedir)
150 LDSO_STUBIFY(connect)
153 #ifndef LISP_FEATURE_DARWIN
154 LDSO_STUBIFY(dlclose)
155 LDSO_STUBIFY(dlerror)
170 LDSO_STUBIFY(ftruncate)
172 LDSO_STUBIFY(getdtablesize)
173 LDSO_STUBIFY(getegid)
176 LDSO_STUBIFY(gethostbyaddr)
177 LDSO_STUBIFY(gethostbyname)
178 LDSO_STUBIFY(gethostname)
179 LDSO_STUBIFY(getitimer)
180 LDSO_STUBIFY(getpagesize)
181 LDSO_STUBIFY(getpeername)
182 LDSO_STUBIFY(getpgrp)
184 LDSO_STUBIFY(getppid)
185 LDSO_STUBIFY(getrusage)
186 LDSO_STUBIFY(getsockname)
187 LDSO_STUBIFY(gettimeofday)
200 LDSO_STUBIFY(memmove)
203 LDSO_STUBIFY(opendir)
207 LDSO_STUBIFY(readdir)
208 LDSO_STUBIFY(readlink)
214 LDSO_STUBIFY(setitimer)
215 LDSO_STUBIFY(setpgrp)
218 LDSO_STUBIFY(sigsetmask)
223 LDSO_STUBIFY(strerror)
225 LDSO_STUBIFY(symlink)
228 LDSO_STUBIFY(tcdrain)
230 LDSO_STUBIFY(tcflush)
231 LDSO_STUBIFY(tcgetattr)
232 LDSO_STUBIFY(tcsendbreak)
233 LDSO_STUBIFY(tcsetattr)
234 LDSO_STUBIFY(truncate)
235 LDSO_STUBIFY(ttyname)
243 * These aren't needed on the X86 because they're microcoded into the
244 * FPU, so the Lisp VOPs can implement them directly without having to
247 * Note: There might be some other functions in this category as well.
248 * E.g. I notice tanh() and acos() in the list above.. -- WHN 2001-06-07
250 #if !defined LISP_FEATURE_X86
262 LDSO_STUBIFY(ieee_get_fp_control)
263 LDSO_STUBIFY(ieee_set_fp_control)