[libc] Add dlinfo + RTLD_DI_* macros to dlfcn.h (#149938)
An initial commit for #149911, this adds a stub implementation for dlinfo and the enums list of `RTLD_DI_*` values. While the dlinfo implementation relies on dynamic linker support, this patch will add its prototype in the generated dlfcn.h header so that it can be used by downstream platforms that have their own dlinfo implementation.
This commit is contained in:
parent
da6424c9e3
commit
cfd1ee781f
@ -37,6 +37,55 @@ macros:
|
||||
standards:
|
||||
- gnu
|
||||
macro_value: "((void *) 0)"
|
||||
enums:
|
||||
- name: RTLD_DI_LMID
|
||||
standards:
|
||||
- gnu
|
||||
value: 1
|
||||
- name: RTLD_DI_LINKMAP
|
||||
standards:
|
||||
- gnu
|
||||
value: 2
|
||||
- name: RTLD_DI_CONFIGADDR,
|
||||
standards:
|
||||
- gnu
|
||||
value: 3
|
||||
- name: RTLD_DI_SERINFO
|
||||
standards:
|
||||
- gnu
|
||||
value: 4
|
||||
- name: RTLD_DI_SERINFOSIZE
|
||||
standards:
|
||||
- gnu
|
||||
value: 5
|
||||
- name: RTLD_DI_ORIGIN
|
||||
standards:
|
||||
- gnu
|
||||
value: 6
|
||||
- name: RTLD_DI_PROFILENAME
|
||||
standards:
|
||||
- gnu
|
||||
value: 7
|
||||
- name: RTLD_DI_PROFILEOUT
|
||||
standards:
|
||||
- gnu
|
||||
value: 8
|
||||
- name: RTLD_DI_TLS_MODID
|
||||
standards:
|
||||
- gnu
|
||||
value: 9
|
||||
- name: RTLD_DI_TLS_DATA
|
||||
standards:
|
||||
- gnu
|
||||
value: 10
|
||||
- name: RTLD_DI_PHDR
|
||||
standards:
|
||||
- gnu
|
||||
value: 11
|
||||
- name: RTLD_DI_MAX
|
||||
standards:
|
||||
- gnu
|
||||
value: 11
|
||||
functions:
|
||||
- name: dlclose
|
||||
standards:
|
||||
@ -63,3 +112,11 @@ functions:
|
||||
arguments:
|
||||
- type: void *__restrict
|
||||
- type: const char *__restrict
|
||||
- name: dlinfo
|
||||
standards:
|
||||
- gnu
|
||||
return_type: int
|
||||
arguments:
|
||||
- type: void *__restrict
|
||||
- type: int
|
||||
- type: void *__restrict
|
||||
|
@ -38,3 +38,14 @@ add_entrypoint_object(
|
||||
libc.include.dlfcn
|
||||
libc.src.errno.errno
|
||||
)
|
||||
|
||||
add_entrypoint_object(
|
||||
dlinfo
|
||||
SRCS
|
||||
dlinfo.cpp
|
||||
HDRS
|
||||
dlinfo.h
|
||||
DEPENDS
|
||||
libc.include.dlfcn
|
||||
libc.src.errno.errno
|
||||
)
|
||||
|
23
libc/src/dlfcn/dlinfo.cpp
Normal file
23
libc/src/dlfcn/dlinfo.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
//===-- Implementation of dlinfo ------------------------------------------===//
|
||||
//
|
||||
// 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "dlinfo.h"
|
||||
|
||||
#include "src/__support/common.h"
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
// TODO: https://github.com/llvm/llvm-project/issues/149911
|
||||
LLVM_LIBC_FUNCTION(int, dlinfo,
|
||||
(void *restrict handle, int request, void *restrict info)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
20
libc/src/dlfcn/dlinfo.h
Normal file
20
libc/src/dlfcn/dlinfo.h
Normal file
@ -0,0 +1,20 @@
|
||||
//===-- Implementation header of dlinfo -------------------------*- C++ -*-===//
|
||||
//
|
||||
// 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_SRC_DLFCN_DLINFO_H
|
||||
#define LLVM_LIBC_SRC_DLFCN_DLINFO_H
|
||||
|
||||
#include "src/__support/macros/config.h"
|
||||
|
||||
namespace LIBC_NAMESPACE_DECL {
|
||||
|
||||
int dlinfo(void *restrict, int, void *restrict);
|
||||
|
||||
} // namespace LIBC_NAMESPACE_DECL
|
||||
|
||||
#endif // LLVM_LIBC_SRC_DLFCN_DLINFO_H
|
Loading…
x
Reference in New Issue
Block a user