File tree Expand file tree Collapse file tree 19 files changed +290
-0
lines changed Expand file tree Collapse file tree 19 files changed +290
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,12 @@ set(TARGET_LIBC_ENTRYPOINTS
17
17
libc.src.ctype.tolower
18
18
libc.src.ctype.toupper
19
19
20
+ # dlfcn.h entrypoints
21
+ libc.src.dlfcn.dlopen
22
+ libc.src.dlfcn.dlsym
23
+ libc.src.dlfcn.dlclose
24
+ libc.src.dlfcn.dlerror
25
+
20
26
# errno.h entrypoints
21
27
libc.src.errno.errno
22
28
Original file line number Diff line number Diff line change 1
1
set(TARGET_PUBLIC_HEADERS
2
2
libc.include.assert
3
3
libc.include.ctype
4
+ libc.include.dlfcn
4
5
libc.include.errno
5
6
libc.include.features
6
7
libc.include.fenv
Original file line number Diff line number Diff line change @@ -17,6 +17,12 @@ set(TARGET_LIBC_ENTRYPOINTS
17
17
libc.src.ctype.tolower
18
18
libc.src.ctype.toupper
19
19
20
+ # dlfcn.h entrypoints
21
+ libc.src.dlfcn.dlopen
22
+ libc.src.dlfcn.dlsym
23
+ libc.src.dlfcn.dlclose
24
+ libc.src.dlfcn.dlerror
25
+
20
26
# errno.h entrypoints
21
27
libc.src.errno.errno
22
28
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ set(TARGET_PUBLIC_HEADERS
2
2
libc.include.assert
3
3
libc.include.ctype
4
4
libc.include.dirent
5
+ libc.include.dlfcn
5
6
libc.include.errno
6
7
libc.include.fcntl
7
8
libc.include.features
Original file line number Diff line number Diff line change @@ -51,6 +51,15 @@ add_gen_header(
51
51
.llvm_libc_common_h
52
52
)
53
53
54
+ add_gen_header (
55
+ dlfcn
56
+ DEF_FILE dlfcn.h.def
57
+ GEN_HDR dlfcn.h
58
+ DEPENDS
59
+ .llvm-libc-macros.dlfcn_macros
60
+ .llvm_libc_common_h
61
+ )
62
+
54
63
add_gen_header (
55
64
features
56
65
DEF_FILE features.h.def
Original file line number Diff line number Diff line change
1
+ //===-- C standard library header dlfcn.h ---------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #ifndef LLVM_LIBC_DLFCN_H
10
+ #define LLVM_LIBC_DLFCN_H
11
+
12
+ #include "__llvm-libc-common.h"
13
+ #include "llvm-libc-macros/dlfcn-macros.h"
14
+
15
+ %%public_api()
16
+
17
+ #endif // LLVM_LIBC_DLFCN_H
Original file line number Diff line number Diff line change @@ -277,3 +277,9 @@ add_macro_header(
277
277
HDR
278
278
stdckdint-macros.h
279
279
)
280
+
281
+ add_macro_header (
282
+ dlfcn_macros
283
+ HDR
284
+ dlfcn-macros.h
285
+ )
Original file line number Diff line number Diff line change
1
+ //===-- Definition of macros from dlfcn.h ---------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #ifndef LLVM_LIBC_MACROS_DLFCN_MACROS_H
10
+ #define LLVM_LIBC_MACROS_DLFCN_MACROS_H
11
+
12
+ #define RTLD_LAZY 0x00001
13
+ #define RTLD_NOW 0x00002
14
+ #define RTLD_GLOBAL 0x00100
15
+ #define RTLD_LOCAL 0
16
+
17
+ // Non-standard stuff here
18
+ #define RTLD_BINDING_MASK 0x3
19
+ #define RTLD_NOLOAD 0x00004
20
+ #define RTLD_DEEPBIND 0x00008
21
+ #define RTLD_NODELETE 0x01000
22
+
23
+ #endif // LLVM_LIBC_MACROS_DLFCN_MACROS_H
Original file line number Diff line number Diff line change @@ -222,6 +222,40 @@ def POSIX : StandardSpec<"POSIX"> {
222
222
[] // Functions
223
223
>;
224
224
225
+ HeaderSpec DlFcn = HeaderSpec<
226
+ "dlfcn.h",
227
+ [
228
+ Macro<"RTLD_LAZY">,
229
+ Macro<"RTLD_NOW">,
230
+ Macro<"RTLD_GLOBAL">,
231
+ Macro<"RTLD_LOCAL">,
232
+ ],
233
+ [], // Types
234
+ [], // Enumerations
235
+ [
236
+ FunctionSpec<
237
+ "dlclose",
238
+ RetValSpec<IntType>,
239
+ [ArgSpec<VoidPtr>]
240
+ >,
241
+ FunctionSpec<
242
+ "dlerror",
243
+ RetValSpec<CharPtr>,
244
+ []
245
+ >,
246
+ FunctionSpec<
247
+ "dlopen",
248
+ RetValSpec<VoidPtr>,
249
+ [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
250
+ >,
251
+ FunctionSpec<
252
+ "dlsym",
253
+ RetValSpec<VoidPtr>,
254
+ [ArgSpec<VoidRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
255
+ >,
256
+ ]
257
+ >;
258
+
225
259
HeaderSpec FCntl = HeaderSpec<
226
260
"fcntl.h",
227
261
[], // Macros
@@ -1690,6 +1724,7 @@ def POSIX : StandardSpec<"POSIX"> {
1690
1724
ArpaInet,
1691
1725
CType,
1692
1726
Dirent,
1727
+ DlFcn,
1693
1728
Errno,
1694
1729
FCntl,
1695
1730
PThread,
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ add_subdirectory(stdio)
11
11
add_subdirectory (stdlib )
12
12
add_subdirectory (string )
13
13
add_subdirectory (wchar )
14
+ add_subdirectory (dlfcn )
14
15
15
16
if (${LIBC_TARGET_OS} STREQUAL "linux" )
16
17
add_subdirectory (dirent )
You can’t perform that action at this time.
0 commit comments