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 ;
104 #error unsupported CPU architecture
115 LDSO_STUBIFY(cfgetispeed)
116 LDSO_STUBIFY(cfgetospeed)
117 LDSO_STUBIFY(cfsetispeed)
118 LDSO_STUBIFY(cfsetospeed)
122 LDSO_STUBIFY(closedir)
123 LDSO_STUBIFY(connect)
126 #ifndef LISP_FEATURE_DARWIN
127 LDSO_STUBIFY(dlclose)
128 LDSO_STUBIFY(dlerror)
143 LDSO_STUBIFY(ftruncate)
145 LDSO_STUBIFY(getdtablesize)
146 LDSO_STUBIFY(getegid)
149 LDSO_STUBIFY(gethostbyaddr)
150 LDSO_STUBIFY(gethostbyname)
151 LDSO_STUBIFY(gethostname)
152 LDSO_STUBIFY(getitimer)
153 LDSO_STUBIFY(getpagesize)
154 LDSO_STUBIFY(getpeername)
155 LDSO_STUBIFY(getpgrp)
157 LDSO_STUBIFY(getppid)
158 LDSO_STUBIFY(getrusage)
159 LDSO_STUBIFY(getsockname)
160 LDSO_STUBIFY(gettimeofday)
173 LDSO_STUBIFY(memmove)
176 LDSO_STUBIFY(opendir)
180 LDSO_STUBIFY(readdir)
181 LDSO_STUBIFY(readlink)
187 LDSO_STUBIFY(setitimer)
188 LDSO_STUBIFY(setpgrp)
191 LDSO_STUBIFY(sigsetmask)
196 LDSO_STUBIFY(strerror)
198 LDSO_STUBIFY(symlink)
201 LDSO_STUBIFY(tcdrain)
203 LDSO_STUBIFY(tcflush)
204 LDSO_STUBIFY(tcgetattr)
205 LDSO_STUBIFY(tcsendbreak)
206 LDSO_STUBIFY(tcsetattr)
207 LDSO_STUBIFY(truncate)
208 LDSO_STUBIFY(ttyname)
216 * These aren't needed on the X86 because they're microcoded into the
217 * FPU, so the Lisp VOPs can implement them directly without having to
220 * Note: There might be some other functions in this category as well.
221 * E.g. I notice tanh() and acos() in the list above.. -- WHN 2001-06-07
223 #if !defined LISP_FEATURE_X86
235 LDSO_STUBIFY(ieee_get_fp_control)
236 LDSO_STUBIFY(ieee_set_fp_control)