Skip to content

[libc] Add dlfcn.h headers #97772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libc/config/linux/aarch64/headers.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions libc/config/linux/x86_64/headers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions libc/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ add_gen_header(
.llvm_libc_common_h
)

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
Expand Down
17 changes: 17 additions & 0 deletions libc/include/dlfcn.h.def
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions libc/include/llvm-libc-macros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,9 @@ add_macro_header(
HDR
stdckdint-macros.h
)

add_macro_header(
dlfcn_macros
HDR
dlfcn-macros.h
)
23 changes: 23 additions & 0 deletions libc/include/llvm-libc-macros/dlfcn-macros.h
Original file line number Diff line number Diff line change
@@ -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
Loading