Author: Schrodinger ZHU Yifan Date: 2024-07-06T18:32:00-07:00 New Revision: b734450e815feb02354c2e76c91228465eeefa72
URL: https://github.com/llvm/llvm-project/commit/b734450e815feb02354c2e76c91228465eeefa72 DIFF: https://github.com/llvm/llvm-project/commit/b734450e815feb02354c2e76c91228465eeefa72.diff LOG: Revert "[libc] Add `link.h` and `elf.h` headers (#97924)" This reverts commit ba255076a0efce1e2e7ecf5572a794912e23370b. Added: Modified: libc/config/linux/aarch64/headers.txt libc/config/linux/x86_64/headers.txt libc/include/CMakeLists.txt libc/include/llvm-libc-macros/CMakeLists.txt libc/include/llvm-libc-macros/link-macros.h libc/include/llvm-libc-types/CMakeLists.txt Removed: libc/include/llvm-libc-macros/elf-macros.h libc/include/llvm-libc-types/Dl_info.h libc/include/llvm-libc-types/__dl_iterate_phdr_callback_t.h libc/include/llvm-libc-types/struct_dl_phdr_info.h ################################################################################ diff --git a/libc/config/linux/aarch64/headers.txt b/libc/config/linux/aarch64/headers.txt index ebe053af99d80..8f898f0150905 100644 --- a/libc/config/linux/aarch64/headers.txt +++ b/libc/config/linux/aarch64/headers.txt @@ -2,7 +2,6 @@ set(TARGET_PUBLIC_HEADERS libc.include.assert libc.include.ctype libc.include.dlfcn - libc.include.elf libc.include.errno libc.include.features libc.include.fenv @@ -10,7 +9,6 @@ set(TARGET_PUBLIC_HEADERS libc.include.stdint libc.include.inttypes libc.include.limits - libc.include.link libc.include.math libc.include.pthread libc.include.signal diff --git a/libc/config/linux/x86_64/headers.txt b/libc/config/linux/x86_64/headers.txt index 903771c5f96a6..df276894246c4 100644 --- a/libc/config/linux/x86_64/headers.txt +++ b/libc/config/linux/x86_64/headers.txt @@ -3,7 +3,6 @@ set(TARGET_PUBLIC_HEADERS libc.include.ctype libc.include.dirent libc.include.dlfcn - libc.include.elf libc.include.errno libc.include.fcntl libc.include.features @@ -12,7 +11,6 @@ set(TARGET_PUBLIC_HEADERS libc.include.stdint libc.include.inttypes libc.include.limits - libc.include.link libc.include.math libc.include.pthread libc.include.sched diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt index a39c1c118165f..f8ef35078a8c4 100644 --- a/libc/include/CMakeLists.txt +++ b/libc/include/CMakeLists.txt @@ -56,7 +56,6 @@ add_gen_header( DEF_FILE dlfcn.h.def GEN_HDR dlfcn.h DEPENDS - .llvm-libc-types.Dl_info .llvm-libc-macros.dlfcn_macros .llvm_libc_common_h ) @@ -368,25 +367,6 @@ add_gen_header( .llvm-libc-types.posix_spawn_file_actions_t ) -add_gen_header( - link - DEF_FILE link.h.def - GEN_HDR link.h - DEPENDS - .llvm_libc_common_h - .llvm-libc-types.struct_dl_phdr_info - .llvm-libc-types.__dl_iterate_phdr_callback_t - .llvm-libc-macros.link_macros -) - -add_gen_header( - elf - DEF_FILE elf.h.def - GEN_HDR elf.h - DEPENDS - .llvm-libc-macros.elf_macros -) - # TODO: Not all platforms will have a include/sys directory. Add the sys # directory and the targets for sys/*.h files conditional to the OS requiring # them. diff --git a/libc/include/llvm-libc-macros/CMakeLists.txt b/libc/include/llvm-libc-macros/CMakeLists.txt index 60c8f5a9cd3de..86d6271ff88ac 100644 --- a/libc/include/llvm-libc-macros/CMakeLists.txt +++ b/libc/include/llvm-libc-macros/CMakeLists.txt @@ -283,9 +283,3 @@ add_macro_header( HDR dlfcn-macros.h ) - -add_macro_header( - elf_macros - HDR - elf-macros.h -) diff --git a/libc/include/llvm-libc-macros/elf-macros.h b/libc/include/llvm-libc-macros/elf-macros.h deleted file mode 100644 index fa4442abf0f5c..0000000000000 --- a/libc/include/llvm-libc-macros/elf-macros.h +++ /dev/null @@ -1,18 +0,0 @@ -//===-- Definition of macros from elf.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_ELF_MACROS_H -#define LLVM_LIBC_MACROS_ELF_MACROS_H - -#if __has_include(<linux/elf.h>) -#include <linux/elf.h> -#else -#error "cannot use <sys/elf.h> without proper system headers." -#endif - -#endif // LLVM_LIBC_MACROS_ELF_MACROS_H diff --git a/libc/include/llvm-libc-macros/link-macros.h b/libc/include/llvm-libc-macros/link-macros.h index f7461d9527a47..5c8cadab8e71c 100644 --- a/libc/include/llvm-libc-macros/link-macros.h +++ b/libc/include/llvm-libc-macros/link-macros.h @@ -6,30 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_LIBC_MACROS_LINK_MACROS_H -#define LLVM_LIBC_MACROS_LINK_MACROS_H - -#include "elf-macros.h" - #ifdef __LP64__ -#define ElfW(type) Elf64_##type +#define ElfW(type) Elf64_ ## type #else -#define ElfW(type) Elf32_##type -#endif - -struct link_map { - ElfW(Addr) l_addr; - char *l_name; - ElfW(Dyn) * l_ld; - struct link_map *l_next, *l_prev; -}; - -struct r_debug { - int r_version; - struct link_map *r_map; - ElfW(Addr) r_brk; - enum { RT_CONSISTENT, RT_ADD, RT_DELETE } r_state; - ElfW(Addr) r_ldbase; -}; - +#define ElfW(type) Elf32_ ## type #endif diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt index 87381136577ef..d8b975572e0dd 100644 --- a/libc/include/llvm-libc-types/CMakeLists.txt +++ b/libc/include/llvm-libc-types/CMakeLists.txt @@ -89,22 +89,6 @@ add_header(thrd_t HDR thrd_t.h DEPENDS .__thread_type) add_header(tss_t HDR tss_t.h) add_header(tss_dtor_t HDR tss_dtor_t.h) add_header(__atexithandler_t HDR __atexithandler_t.h) -add_header(Dl_info HDR Dl_info.h) -add_header( - __dl_iterate_phdr_callback_t - HDR __dl_iterate_phdr_callback_t.h - DEPENDS - .size_t -) -add_header( - struct_dl_phdr_info - HDR struct_dl_phdr_info.h - DEPENDS - .__dl_iterate_phdr_callback_t - .size_t - libc.include.llvm-libc-macros.link_macros -) - add_header(speed_t HDR speed_t.h) add_header(tcflag_t HDR tcflag_t.h) add_header(struct_termios HDR struct_termios.h DEPENDS .cc_t .speed_t .tcflag_t) diff --git a/libc/include/llvm-libc-types/Dl_info.h b/libc/include/llvm-libc-types/Dl_info.h deleted file mode 100644 index 613976a54bd61..0000000000000 --- a/libc/include/llvm-libc-types/Dl_info.h +++ /dev/null @@ -1,19 +0,0 @@ -//===-- Definition of type Dl_info ----------------------------------------===// -// -// 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_TYPES_DL_INFO_H -#define LLVM_LIBC_TYPES_DL_INFO_H - -typedef struct { - const char *dli_fname; - void *dli_fbase; - const char *dli_sname; - void *dli_saddr; -} Dl_info; - -#endif // LLVM_LIBC_TYPES_DL_INFO_H diff --git a/libc/include/llvm-libc-types/__dl_iterate_phdr_callback_t.h b/libc/include/llvm-libc-types/__dl_iterate_phdr_callback_t.h deleted file mode 100644 index 9d73e88076e00..0000000000000 --- a/libc/include/llvm-libc-types/__dl_iterate_phdr_callback_t.h +++ /dev/null @@ -1,17 +0,0 @@ -//===-- Definition of __dl_iterate_phdr_callback_t type -------------------===// -// -// 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_TYPES___DL_ITERATE_PHDR_CALLBACK_T_H -#define LLVM_LIBC_TYPES___DL_ITERATE_PHDR_CALLBACK_T_H - -#include "llvm-libc-types/size_t.h" - -typedef int (*__dl_iterate_phdr_callback_t)(struct dl_phdr_info *info, - size_t size, void *data); - -#endif // LLVM_LIBC_TYPES___DL_ITERATE_PHDR_CALLBACK_T_H diff --git a/libc/include/llvm-libc-types/struct_dl_phdr_info.h b/libc/include/llvm-libc-types/struct_dl_phdr_info.h deleted file mode 100644 index 66512b368e190..0000000000000 --- a/libc/include/llvm-libc-types/struct_dl_phdr_info.h +++ /dev/null @@ -1,26 +0,0 @@ -//===-- Definition of type struct dl_phdr_info ----------------------------===// -// -// 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_TYPES_STRUCT_DL_PHDR_INFO_H -#define LLVM_LIBC_TYPES_STRUCT_DL_PHDR_INFO_H - -#include "llvm-libc-macros/link-macros.h" -#include "llvm-libc-types/size_t.h" - -struct dl_phdr_info { - ElfW(Addr) dlpi_addr; - const char *dlpi_name; - const ElfW(Phdr) * dlpi_phdr; - ElfW(Half) dlpi_phnum; - unsigned long long int dlpi_adds; - unsigned long long int dlpi_subs; - size_t dlpi_tls_modid; - void *dlpi_tls_data; -}; - -#endif // LLVM_LIBC_TYPES_STRUCT_DL_PHDR_INFO_H _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits