File tree 16 files changed +166
-25
lines changed
16 files changed +166
-25
lines changed Original file line number Diff line number Diff line change @@ -842,6 +842,9 @@ if(LLVM_LIBC_FULL_BUILD)
842
842
libc.src.arpa.inet.ntohl
843
843
libc.src.arpa.inet.ntohs
844
844
845
+ # link.h entrypoints
846
+ libc.src.link.dl_iterate_phdr
847
+
845
848
# pthread.h entrypoints
846
849
libc.src.pthread.pthread_atfork
847
850
libc.src.pthread.pthread_attr_destroy
Original file line number Diff line number Diff line change @@ -795,6 +795,9 @@ if(LLVM_LIBC_FULL_BUILD)
795
795
libc.src.arpa.inet.ntohl
796
796
libc.src.arpa.inet.ntohs
797
797
798
+ # link.h entrypoints
799
+ libc.src.link.dl_iterate_phdr
800
+
798
801
# pthread.h entrypoints
799
802
libc.src.pthread.pthread_atfork
800
803
libc.src.pthread.pthread_attr_destroy
Original file line number Diff line number Diff line change @@ -960,6 +960,9 @@ if(LLVM_LIBC_FULL_BUILD)
960
960
libc.src.arpa.inet.ntohl
961
961
libc.src.arpa.inet.ntohs
962
962
963
+ # link.h entrypoints
964
+ libc.src.link.dl_iterate_phdr
965
+
963
966
# pthread.h entrypoints
964
967
libc.src.pthread.pthread_atfork
965
968
libc.src.pthread.pthread_attr_destroy
Original file line number Diff line number Diff line change @@ -9,6 +9,14 @@ add_proxy_header_library(
9
9
libc.include .stdlib
10
10
)
11
11
12
+ add_proxy_header_library(
13
+ struct_dl_phdr_info
14
+ HDRS
15
+ struct_dl_phdr_info.h
16
+ FULL_BUILD_DEPENDS
17
+ libc.include .llvm-libc-types.struct_dl_phdr_info
18
+ )
19
+
12
20
add_proxy_header_library(
13
21
ldiv_t
14
22
HDRS
Original file line number Diff line number Diff line change
1
+ //===-- Proxy for struct dl_phdr_info -----------------------------------===//
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
+ #ifndef LLVM_LIBC_HDR_TYPES_STRUCT_DL_PHDR_INFO_H
9
+ #define LLVM_LIBC_HDR_TYPES_STRUCT_DL_PHDR_INFO_H
10
+
11
+ #ifdef LIBC_FULL_BUILD
12
+
13
+ #include "include/llvm-libc-types/struct_dl_phdr_info.h"
14
+
15
+ #else
16
+
17
+ #include <link.h>
18
+
19
+ #endif // LIBC_FULL_BUILD
20
+
21
+ #endif // LLVM_LIBC_HDR_TYPES_STRUCT_DL_PHDR_INFO_H
Original file line number Diff line number Diff line change @@ -431,6 +431,8 @@ add_header_macro(
431
431
DEPENDS
432
432
.llvm_libc_common_h
433
433
.llvm-libc-macros .link_macros
434
+ .llvm-libc-types.struct_dl_phdr_info
435
+ .llvm-libc-types.__dl_iterate_phdr_callback_t
434
436
)
435
437
436
438
add_header_macro(
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
header : link.h
2
- header_template : link.h.def
3
2
standards :
4
- - Linux
5
- macros : []
6
- types : []
7
- enums : []
8
- objects : []
9
- functions : []
3
+ - svid
4
+ macros :
5
+ - macro_name : ElfW
6
+ standards :
7
+ - gnu
8
+ macro_header : link-macros.h
9
+ types :
10
+ - type_name : struct_dl_phdr_info
11
+ standards :
12
+ - gnu
13
+ functions :
14
+ - name : dl_iterate_phdr
15
+ standards :
16
+ - gnu
17
+ return_type : int
18
+ arguments :
19
+ - type : __dl_iterate_phdr_callback_t
20
+ - type : void *
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ add_header(__atfork_callback_t HDR __atfork_callback_t.h)
5
5
add_header(__bsearchcompare_t HDR __bsearchcompare_t.h)
6
6
add_header(__lsearchcompare_t HDR __lsearchcompare_t.h)
7
7
add_header(__call_once_func_t HDR __call_once_func_t.h)
8
+ add_header(__dl_iterate_phdr_callback_t HDR __dl_iterate_phdr_callback_t.h DEPENDS .size_t)
8
9
add_header(__exec_argv_t HDR __exec_argv_t.h)
9
10
add_header(__exec_envp_t HDR __exec_envp_t.h)
10
11
add_header(__futex_word HDR __futex_word.h)
@@ -69,6 +70,7 @@ add_header(sighandler_t HDR sighandler_t.h)
69
70
add_header(stack_t HDR stack_t.h DEPENDS .size_t)
70
71
add_header(suseconds_t HDR suseconds_t.h)
71
72
add_header(struct_dirent HDR struct_dirent.h DEPENDS .ino_t .off_t)
73
+ add_header(struct_dl_phdr_info HDR struct_dl_phdr_info.h DEPENDS .size_t libc.include .llvm-libc-macros .link_macros)
72
74
add_header(struct_f_owner_ex HDR struct_f_owner_ex.h DEPENDS .pid_t)
73
75
add_header(struct_flock HDR struct_flock.h DEPENDS .off_t .pid_t)
74
76
add_header(struct_flock64 HDR struct_flock64.h DEPENDS .off64_t .pid_t)
Original file line number Diff line number Diff line change
1
+ //===-- Definition of type __dl_iterate_phdr_callback_t ------------------===//
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_TYPES___DL_ITERATE_PHDR_CALLBACK_T_H
10
+ #define LLVM_LIBC_TYPES___DL_ITERATE_PHDR_CALLBACK_T_H
11
+
12
+ #include "size_t.h"
13
+
14
+ struct dl_phdr_info ;
15
+
16
+ typedef int (* __dl_iterate_phdr_callback_t )(struct dl_phdr_info * , size_t ,
17
+ void * );
18
+
19
+ #endif // LLVM_LIBC_TYPES___DL_ITERATE_PHDR_CALLBACK_T_H
Original file line number Diff line number Diff line change
1
+ //===-- Definition of type struct dl_phdr_info ---------------------------===//
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_TYPES_STRUCT_DL_PHDR_INFO_H
10
+ #define LLVM_LIBC_TYPES_STRUCT_DL_PHDR_INFO_H
11
+
12
+ #include "../llvm-libc-macros/link-macros.h"
13
+ #include "size_t.h"
14
+ #include <elf.h>
15
+ #include <stdint.h>
16
+
17
+ struct dl_phdr_info {
18
+ ElfW (Addr ) dlpi_addr ;
19
+ const char * dlpi_name ;
20
+ const ElfW (Phdr ) * dlpi_phdr ;
21
+ ElfW (Half ) dlpi_phnum ;
22
+
23
+ uint64_t dlpi_adds ;
24
+ uint64_t dlpi_subs ;
25
+
26
+ size_t dlpi_tls_modid ;
27
+ void * dlpi_tls_data ;
28
+ };
29
+
30
+ #endif // LLVM_LIBC_TYPES_STRUCT_DL_PHDR_INFO_H
Original file line number Diff line number Diff line change @@ -6,16 +6,17 @@ add_subdirectory(dlfcn)
6
6
add_subdirectory (errno)
7
7
add_subdirectory (fenv)
8
8
add_subdirectory (inttypes)
9
+ add_subdirectory (link)
9
10
add_subdirectory (math)
10
11
add_subdirectory (stdbit)
11
12
add_subdirectory (stdfix)
12
13
add_subdirectory (stdio)
13
14
add_subdirectory (stdlib)
14
15
add_subdirectory (string )
15
16
add_subdirectory (strings )
16
- add_subdirectory (wchar)
17
17
add_subdirectory (time)
18
18
add_subdirectory (unistd)
19
+ add_subdirectory (wchar)
19
20
20
21
if (${LIBC_TARGET_OS} STREQUAL "linux" )
21
22
add_subdirectory (dirent)
Original file line number Diff line number Diff line change
1
+ add_entrypoint_object(
2
+ dl_iterate_phdr
3
+ SRCS
4
+ dl_iterate_phdr.cpp
5
+ HDRS
6
+ dl_iterate_phdr.h
7
+ )
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation of dl_iterate_phdr --------------------------------===//
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
+ #include " dl_iterate_phdr.h"
10
+
11
+ #include " src/__support/common.h"
12
+ #include " src/__support/macros/config.h"
13
+
14
+ namespace LIBC_NAMESPACE_DECL {
15
+
16
+ LLVM_LIBC_FUNCTION (int , dl_iterate_phdr,
17
+ (__dl_iterate_phdr_callback_t callback, void *arg)) {
18
+ // FIXME: For pure static linking, this can report just the executable with
19
+ // info from __ehdr_start or AT_{PHDR,PHNUM} decoding, and its PT_TLS; and it
20
+ // could report the vDSO.
21
+ (void )callback, (void )arg;
22
+ return 0 ;
23
+ }
24
+
25
+ } // namespace LIBC_NAMESPACE_DECL
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation header of dl_iterate_phdr ---------------*- C++ -*-===//
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_SRC_DLFCN_DL_ITERATE_PHDR_H
10
+ #define LLVM_LIBC_SRC_DLFCN_DL_ITERATE_PHDR_H
11
+
12
+ #include " hdr/types/struct_dl_phdr_info.h"
13
+ #include " include/llvm-libc-types/__dl_iterate_phdr_callback_t.h"
14
+ #include " src/__support/macros/config.h"
15
+
16
+ namespace LIBC_NAMESPACE_DECL {
17
+
18
+ int dl_iterate_phdr (__dl_iterate_phdr_callback_t , void *);
19
+
20
+ } // namespace LIBC_NAMESPACE_DECL
21
+
22
+ #endif // LLVM_LIBC_SRC_DLFCN_DL_ITERATE_PHDR_H
Original file line number Diff line number Diff line change 44
44
"gnu" : "GNU" ,
45
45
"linux" : "Linux" ,
46
46
"uefi" : "UEFI" ,
47
+ "svid" : "SVID" ,
47
48
}
48
49
49
50
HEADER_TEMPLATE = """\
You can’t perform that action at this time.
0 commit comments