From 5006f6105126c115e4755900cd225161233eb5a2 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 17 Jul 2025 10:25:49 -0700 Subject: [PATCH 1/2] [libc] Convert dlfcn.h to pure YAML Remove the unnecessary .h.def file and move all the macro definitions directly into dlfcn.yaml. --- libc/include/dlfcn.h.def | 17 ---------- libc/include/dlfcn.yaml | 33 +++++++++++++++----- libc/include/llvm-libc-macros/dlfcn-macros.h | 23 -------------- 3 files changed, 25 insertions(+), 48 deletions(-) delete mode 100644 libc/include/dlfcn.h.def delete mode 100644 libc/include/llvm-libc-macros/dlfcn-macros.h diff --git a/libc/include/dlfcn.h.def b/libc/include/dlfcn.h.def deleted file mode 100644 index 31395871c6b97..0000000000000 --- a/libc/include/dlfcn.h.def +++ /dev/null @@ -1,17 +0,0 @@ -//===-- 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/dlfcn.yaml b/libc/include/dlfcn.yaml index 78bbeff4e60d9..28be34dbd95bd 100644 --- a/libc/include/dlfcn.yaml +++ b/libc/include/dlfcn.yaml @@ -1,17 +1,34 @@ header: dlfcn.h -header_template: dlfcn.h.def +standards: + - posix macros: + # Note that macro values are quoted to keep the integer literals as + # written. Without the quotes, YAML will normalize them to minimal + # decimal, which is less readable for humans seeing the generated header. - macro_name: RTLD_LAZY - macro_header: dlfcn-macros.h + macro_value: "0x00001" - macro_name: RTLD_NOW - macro_header: dlfcn-macros.h + macro_value: "0x00002" - macro_name: RTLD_GLOBAL - macro_header: dlfcn-macros.h + macro_value: "0x00100" - macro_name: RTLD_LOCAL - macro_header: dlfcn-macros.h -types: [] -enums: [] -objects: [] + macro_value: "0" + - macro_name: RTLD_BINDING_MASK + standards: + - gnu + macro_value: "0x00003" + - macro_name: RTLD_NOLOAD + standards: + - gnu + macro_value: "0x00004" + - macro_name: RTLD_DEEPBIND + standards: + - gnu + macro_value: "0x00008" + - macro_name: RTLD_NODELETE + standards: + - gnu + macro_value: "0x01000" functions: - name: dlclose standards: diff --git a/libc/include/llvm-libc-macros/dlfcn-macros.h b/libc/include/llvm-libc-macros/dlfcn-macros.h deleted file mode 100644 index dcd202b9ab435..0000000000000 --- a/libc/include/llvm-libc-macros/dlfcn-macros.h +++ /dev/null @@ -1,23 +0,0 @@ -//===-- 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 From f6ff1de45962bf167d75c8d6ff033409cd4488c9 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 17 Jul 2025 12:33:35 -0700 Subject: [PATCH 2/2] update cmake --- libc/include/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt index 55268d19529c7..177346a424906 100644 --- a/libc/include/CMakeLists.txt +++ b/libc/include/CMakeLists.txt @@ -69,7 +69,6 @@ add_header_macro( ../libc/include/dlfcn.yaml dlfcn.h DEPENDS - .llvm-libc-macros.dlfcn_macros .llvm_libc_common_h )