aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <mcgrathr@google.com>2025-07-17 15:05:20 -0700
committerGitHub <noreply@github.com>2025-07-17 15:05:20 -0700
commit72a2d8220ade3f9ac96f5424f803c774499cf54c (patch)
tree3f5914b6587b816b8b170fe2d221cfdee02923c1
parentfae8df2b82692ec8f69ba578847713f0da6e1ddc (diff)
downloadllvm-72a2d8220ade3f9ac96f5424f803c774499cf54c.zip
llvm-72a2d8220ade3f9ac96f5424f803c774499cf54c.tar.gz
llvm-72a2d8220ade3f9ac96f5424f803c774499cf54c.tar.bz2
[libc] Convert dlfcn.h to pure YAML (#149362)
Remove the unnecessary .h.def file and move all the macro definitions directly into dlfcn.yaml.
-rw-r--r--libc/include/CMakeLists.txt1
-rw-r--r--libc/include/dlfcn.h.def17
-rw-r--r--libc/include/dlfcn.yaml33
-rw-r--r--libc/include/llvm-libc-macros/dlfcn-macros.h23
4 files changed, 25 insertions, 49 deletions
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 984b960..7321382 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
)
diff --git a/libc/include/dlfcn.h.def b/libc/include/dlfcn.h.def
deleted file mode 100644
index 3139587..0000000
--- 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 78bbeff..28be34d 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 dcd202b..0000000
--- 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