aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIzaak Schroeder <izaak.schroeder@gmail.com>2024-07-05 22:02:04 -0700
committerGitHub <noreply@github.com>2024-07-05 22:02:04 -0700
commitccf357ff643c6af86bb459eba5a00f40f1dcaf22 (patch)
tree7deeb29bd10fc28f34b12f1a0fe9b84d75574f2e
parenta348824798e03c1ffd10e6a1c5340130b0f48bf9 (diff)
downloadllvm-ccf357ff643c6af86bb459eba5a00f40f1dcaf22.zip
llvm-ccf357ff643c6af86bb459eba5a00f40f1dcaf22.tar.gz
llvm-ccf357ff643c6af86bb459eba5a00f40f1dcaf22.tar.bz2
[libc] Add `dlfcn.h` headers (#97772)
-rw-r--r--libc/config/linux/aarch64/headers.txt1
-rw-r--r--libc/config/linux/x86_64/headers.txt1
-rw-r--r--libc/include/CMakeLists.txt9
-rw-r--r--libc/include/dlfcn.h.def17
-rw-r--r--libc/include/llvm-libc-macros/CMakeLists.txt6
-rw-r--r--libc/include/llvm-libc-macros/dlfcn-macros.h23
6 files changed, 57 insertions, 0 deletions
diff --git a/libc/config/linux/aarch64/headers.txt b/libc/config/linux/aarch64/headers.txt
index 7d25877..8f898f0 100644
--- a/libc/config/linux/aarch64/headers.txt
+++ b/libc/config/linux/aarch64/headers.txt
@@ -1,6 +1,7 @@
set(TARGET_PUBLIC_HEADERS
libc.include.assert
libc.include.ctype
+ libc.include.dlfcn
libc.include.errno
libc.include.features
libc.include.fenv
diff --git a/libc/config/linux/x86_64/headers.txt b/libc/config/linux/x86_64/headers.txt
index 44d640b..df27689 100644
--- a/libc/config/linux/x86_64/headers.txt
+++ b/libc/config/linux/x86_64/headers.txt
@@ -2,6 +2,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.assert
libc.include.ctype
libc.include.dirent
+ libc.include.dlfcn
libc.include.errno
libc.include.fcntl
libc.include.features
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 3ab7817..f8ef350 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -52,6 +52,15 @@ add_gen_header(
)
add_gen_header(
+ dlfcn
+ DEF_FILE dlfcn.h.def
+ GEN_HDR dlfcn.h
+ DEPENDS
+ .llvm-libc-macros.dlfcn_macros
+ .llvm_libc_common_h
+)
+
+add_gen_header(
features
DEF_FILE features.h.def
GEN_HDR features.h
diff --git a/libc/include/dlfcn.h.def b/libc/include/dlfcn.h.def
new file mode 100644
index 0000000..3139587
--- /dev/null
+++ b/libc/include/dlfcn.h.def
@@ -0,0 +1,17 @@
+//===-- C standard library header dlfcn.h ---------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_DLFCN_H
+#define LLVM_LIBC_DLFCN_H
+
+#include "__llvm-libc-common.h"
+#include "llvm-libc-macros/dlfcn-macros.h"
+
+%%public_api()
+
+#endif // LLVM_LIBC_DLFCN_H
diff --git a/libc/include/llvm-libc-macros/CMakeLists.txt b/libc/include/llvm-libc-macros/CMakeLists.txt
index f6af11a..86d6271 100644
--- a/libc/include/llvm-libc-macros/CMakeLists.txt
+++ b/libc/include/llvm-libc-macros/CMakeLists.txt
@@ -277,3 +277,9 @@ add_macro_header(
HDR
stdckdint-macros.h
)
+
+add_macro_header(
+ dlfcn_macros
+ HDR
+ dlfcn-macros.h
+)
diff --git a/libc/include/llvm-libc-macros/dlfcn-macros.h b/libc/include/llvm-libc-macros/dlfcn-macros.h
new file mode 100644
index 0000000..dcd202b
--- /dev/null
+++ b/libc/include/llvm-libc-macros/dlfcn-macros.h
@@ -0,0 +1,23 @@
+//===-- Definition of macros from dlfcn.h ---------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_MACROS_DLFCN_MACROS_H
+#define LLVM_LIBC_MACROS_DLFCN_MACROS_H
+
+#define RTLD_LAZY 0x00001
+#define RTLD_NOW 0x00002
+#define RTLD_GLOBAL 0x00100
+#define RTLD_LOCAL 0
+
+// Non-standard stuff here
+#define RTLD_BINDING_MASK 0x3
+#define RTLD_NOLOAD 0x00004
+#define RTLD_DEEPBIND 0x00008
+#define RTLD_NODELETE 0x01000
+
+#endif // LLVM_LIBC_MACROS_DLFCN_MACROS_H