[libc-commits] [libc] [libc] Add proxy header for the stack_t type (PR #107559)
via libc-commits
libc-commits at lists.llvm.org
Fri Sep 6 11:17:18 PDT 2024
https://github.com/wldfngrs updated https://github.com/llvm/llvm-project/pull/107559
>From 4cae19606b665f3b8fe607fed38678468c7594ff Mon Sep 17 00:00:00 2001
From: wldfngrs <wldfngrs at gmail.com>
Date: Fri, 6 Sep 2024 11:37:26 +0100
Subject: [PATCH 1/2] add stack_t proxy header
---
libc/hdr/types/CMakeLists.txt | 9 +++++++++
libc/hdr/types/stack_t.h | 23 +++++++++++++++++++++++
libc/src/signal/sigaltstack.h | 2 +-
3 files changed, 33 insertions(+), 1 deletion(-)
create mode 100644 libc/hdr/types/stack_t.h
diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt
index ea7bbccffbb819..fdd8b3fea665a8 100644
--- a/libc/hdr/types/CMakeLists.txt
+++ b/libc/hdr/types/CMakeLists.txt
@@ -181,3 +181,12 @@ add_proxy_header_library(
libc.include.signal
)
+add_proxy_header_library(
+ stack_t
+ HDRS
+ stack_t
+ FULL_BUILD_DEPENDS
+ libc.include.llvm-libc-types.stack_t
+ libc.include.signal
+)
+
diff --git a/libc/hdr/types/stack_t.h b/libc/hdr/types/stack_t.h
new file mode 100644
index 00000000000000..88dd41d07d747f
--- /dev/null
+++ b/libc/hdr/types/stack_t.h
@@ -0,0 +1,23 @@
+//===-- Definition of macros from stack_t.h -------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https:llvm.or/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_HDR_STACK_T_H
+#define LLVM_LIBC_HDR_STACK_T_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/stack_t.h"
+
+#else // overlay mode
+
+#include <signal.h>
+
+#endif // LLVM_LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_STACK_T_H
diff --git a/libc/src/signal/sigaltstack.h b/libc/src/signal/sigaltstack.h
index fc6ec356e5ef86..7a82c0ee997118 100644
--- a/libc/src/signal/sigaltstack.h
+++ b/libc/src/signal/sigaltstack.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC_SIGNAL_SIGALTSTACK_H
#define LLVM_LIBC_SRC_SIGNAL_SIGALTSTACK_H
+#include "hdr/types/stack_t.h"
#include "src/__support/macros/config.h"
-#include <signal.h>
namespace LIBC_NAMESPACE_DECL {
>From 8abad7468c876c664d151ae06a06bb5d98a2d9a9 Mon Sep 17 00:00:00 2001
From: wldfngrs <wldfngrs at gmail.com>
Date: Fri, 6 Sep 2024 19:16:43 +0100
Subject: [PATCH 2/2] dependency update for linux directory
---
libc/hdr/types/stack_t.h | 2 +-
libc/src/signal/linux/CMakeLists.txt | 1 +
libc/src/signal/linux/sigaltstack.cpp | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libc/hdr/types/stack_t.h b/libc/hdr/types/stack_t.h
index 88dd41d07d747f..8c7c37a5d814ee 100644
--- a/libc/hdr/types/stack_t.h
+++ b/libc/hdr/types/stack_t.h
@@ -1,4 +1,4 @@
-//===-- Definition of macros from stack_t.h -------------------------------===//
+//===-- Definition of stack_t.h -------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https:llvm.or/LICENSE.txt for license information.
diff --git a/libc/src/signal/linux/CMakeLists.txt b/libc/src/signal/linux/CMakeLists.txt
index 5a6be242ddd94f..7b1a2fe4d95d54 100644
--- a/libc/src/signal/linux/CMakeLists.txt
+++ b/libc/src/signal/linux/CMakeLists.txt
@@ -77,6 +77,7 @@ add_entrypoint_object(
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
libc.src.errno.errno
+ libc.hdr.types.stack_t
)
add_entrypoint_object(
diff --git a/libc/src/signal/linux/sigaltstack.cpp b/libc/src/signal/linux/sigaltstack.cpp
index 2e142a473fea71..8fcf60be0a436c 100644
--- a/libc/src/signal/linux/sigaltstack.cpp
+++ b/libc/src/signal/linux/sigaltstack.cpp
@@ -10,10 +10,10 @@
#include "src/__support/macros/config.h"
#include "src/errno/libc_errno.h"
#include "src/signal/linux/signal_utils.h"
+#include "hdr/types/stack_t.h"
#include "src/__support/common.h"
-#include <signal.h>
#include <sys/syscall.h>
namespace LIBC_NAMESPACE_DECL {
More information about the libc-commits
mailing list