[libc-commits] [libc] [libc] temporaliy disable __USE_EXTERN_INLINES and set __USE_FORITFY_LEVEL to 1 before including in overlay mode (PR #113012)
Job Henandez Lara via libc-commits
libc-commits at lists.llvm.org
Fri Oct 18 18:54:59 PDT 2024
https://github.com/Jobhdez updated https://github.com/llvm/llvm-project/pull/113012
>From c06c029727d950d2b3b4c81b27dd87f8a6520601 Mon Sep 17 00:00:00 2001
From: Job Hernandez <jobhdezlara93 at gmail.com>
Date: Fri, 18 Oct 2024 18:07:37 -0700
Subject: [PATCH 1/4] disable use extern inlines and fortify level
---
libc/hdr/stdio_overlay.h | 21 +++++++++++++++++++++
libc/hdr/wchar_overlay.h | 21 +++++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/libc/hdr/stdio_overlay.h b/libc/hdr/stdio_overlay.h
index cec55abfde7bf6..9b97fce45787ab 100644
--- a/libc/hdr/stdio_overlay.h
+++ b/libc/hdr/stdio_overlay.h
@@ -27,6 +27,17 @@
#undef _FORTIFY_SOURCE
#endif
+#ifdef __USE_EXTERN_INLINES
+#define LIBC_OLD_EXTERN_INLINES __USE_EXTERN_INLINES
+#undef __USE_EXTERN_INLINES
+#endif
+
+#ifdef __USE_FORTIFY_LEVEL
+#define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
+#undef __USE_FORTIFY_LEVEL
+#define __USE_FORTIFY_LEVEL 0
+#endif
+
#ifndef __NO_INLINE__
#define __NO_INLINE__ 1
#define LIBC_SET_NO_INLINE
@@ -44,4 +55,14 @@
#undef LIBC_SET_NO_INLINE
#endif
+#ifdef LIBC_OLD_FORTIFY_LEVEL
+#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
+#undef LIBC_OLD_USE_FORTIFY_LEVEL
+#endif
+
+#ifdef LIBC_OLD_USE_EXTERN_INLINES
+#define __USE_EXTERN_INLINES LIBC_OLD_USE_EXTERN_INLINES
+#undef LIBC_OLD_USE_EXTERN_INLINES
+#endif
+
#endif // LLVM_LIBC_HDR_STDIO_OVERLAY_H
diff --git a/libc/hdr/wchar_overlay.h b/libc/hdr/wchar_overlay.h
index a1de9d5085d47b..22777fdf0c2805 100644
--- a/libc/hdr/wchar_overlay.h
+++ b/libc/hdr/wchar_overlay.h
@@ -32,6 +32,17 @@
#define LIBC_SET_NO_INLINE
#endif
+#ifdef __USE_EXTERN_INLINES
+#define LIBC_OLD_EXTERN_INLINES __USE_EXTERN_INLINES
+#undef __USE_EXTERN_INLINES
+#endif
+
+#ifdef __USE_FORTIFY_LEVEL
+#define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
+#undef __USE_FORTIFY_LEVEL
+#define __USE_FORTIFY_LEVEL 0
+#endif
+
#include <wchar.h>
#ifdef LIBC_OLD_FORTIFY_SOURCE
@@ -44,4 +55,14 @@
#undef LIBC_SET_NO_INLINE
#endif
+#ifdef LIBC_OLD_FORTIFY_LEVEL
+#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
+#undef LIBC_OLD_USE_FORTIFY_LEVEL
+#endif
+
+#ifdef LIBC_OLD_USE_EXTERN_INLINES
+#define __USE_EXTERN_INLINES LIBC_OLD_USE_EXTERN_INLINES
+#undef LIBC_OLD_USE_EXTERN_INLINES
+#endif
+
#endif // LLVM_LIBC_HDR_WCHAR_OVERLAY_H
>From e2d42841909d26dc2b50710489c14a1e2ef9d8f3 Mon Sep 17 00:00:00 2001
From: Job Hernandez <jobhdezlara93 at gmail.com>
Date: Fri, 18 Oct 2024 18:45:42 -0700
Subject: [PATCH 2/4] address review
---
libc/hdr/stdio_overlay.h | 5 +++--
libc/hdr/wchar_overlay.h | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libc/hdr/stdio_overlay.h b/libc/hdr/stdio_overlay.h
index 9b97fce45787ab..b411e751854e11 100644
--- a/libc/hdr/stdio_overlay.h
+++ b/libc/hdr/stdio_overlay.h
@@ -28,7 +28,7 @@
#endif
#ifdef __USE_EXTERN_INLINES
-#define LIBC_OLD_EXTERN_INLINES __USE_EXTERN_INLINES
+#define LIBC_OLD_EXTERN_INLINES
#undef __USE_EXTERN_INLINES
#endif
@@ -56,12 +56,13 @@
#endif
#ifdef LIBC_OLD_FORTIFY_LEVEL
+#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
#undef LIBC_OLD_USE_FORTIFY_LEVEL
#endif
#ifdef LIBC_OLD_USE_EXTERN_INLINES
-#define __USE_EXTERN_INLINES LIBC_OLD_USE_EXTERN_INLINES
+#define __USE_EXTERN_INLINES
#undef LIBC_OLD_USE_EXTERN_INLINES
#endif
diff --git a/libc/hdr/wchar_overlay.h b/libc/hdr/wchar_overlay.h
index 22777fdf0c2805..4efe980acff7ac 100644
--- a/libc/hdr/wchar_overlay.h
+++ b/libc/hdr/wchar_overlay.h
@@ -33,7 +33,7 @@
#endif
#ifdef __USE_EXTERN_INLINES
-#define LIBC_OLD_EXTERN_INLINES __USE_EXTERN_INLINES
+#define LIBC_OLD_EXTERN_INLINES
#undef __USE_EXTERN_INLINES
#endif
@@ -56,12 +56,13 @@
#endif
#ifdef LIBC_OLD_FORTIFY_LEVEL
+#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
#undef LIBC_OLD_USE_FORTIFY_LEVEL
#endif
#ifdef LIBC_OLD_USE_EXTERN_INLINES
-#define __USE_EXTERN_INLINES LIBC_OLD_USE_EXTERN_INLINES
+#define __USE_EXTERN_INLINES
#undef LIBC_OLD_USE_EXTERN_INLINES
#endif
>From 052a16578cd77af1dd35a56c21480f682344d9c4 Mon Sep 17 00:00:00 2001
From: Job Hernandez <jobhdezlara93 at gmail.com>
Date: Fri, 18 Oct 2024 18:51:42 -0700
Subject: [PATCH 3/4] fix typo
---
libc/hdr/stdio_overlay.h | 4 ++--
libc/hdr/wchar_overlay.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libc/hdr/stdio_overlay.h b/libc/hdr/stdio_overlay.h
index b411e751854e11..aef8c448fe49d4 100644
--- a/libc/hdr/stdio_overlay.h
+++ b/libc/hdr/stdio_overlay.h
@@ -28,7 +28,7 @@
#endif
#ifdef __USE_EXTERN_INLINES
-#define LIBC_OLD_EXTERN_INLINES
+#define LIBC_OLD_USE_EXTERN_INLINES
#undef __USE_EXTERN_INLINES
#endif
@@ -55,7 +55,7 @@
#undef LIBC_SET_NO_INLINE
#endif
-#ifdef LIBC_OLD_FORTIFY_LEVEL
+#ifdef LIBC_OLD_USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
#undef LIBC_OLD_USE_FORTIFY_LEVEL
diff --git a/libc/hdr/wchar_overlay.h b/libc/hdr/wchar_overlay.h
index 4efe980acff7ac..a63bf2b3b67e1b 100644
--- a/libc/hdr/wchar_overlay.h
+++ b/libc/hdr/wchar_overlay.h
@@ -33,7 +33,7 @@
#endif
#ifdef __USE_EXTERN_INLINES
-#define LIBC_OLD_EXTERN_INLINES
+#define LIBC_OLD_USE_EXTERN_INLINES
#undef __USE_EXTERN_INLINES
#endif
@@ -55,7 +55,7 @@
#undef LIBC_SET_NO_INLINE
#endif
-#ifdef LIBC_OLD_FORTIFY_LEVEL
+#ifdef LIBC_OLD_USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
#undef LIBC_OLD_USE_FORTIFY_LEVEL
>From 0eee09ec099ddbf48d8e05cebd113ca036a0a944 Mon Sep 17 00:00:00 2001
From: Job Hernandez <jobhdezlara93 at gmail.com>
Date: Fri, 18 Oct 2024 18:54:42 -0700
Subject: [PATCH 4/4] format code
---
libc/hdr/wchar_overlay.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/hdr/wchar_overlay.h b/libc/hdr/wchar_overlay.h
index a63bf2b3b67e1b..99a70899779e7c 100644
--- a/libc/hdr/wchar_overlay.h
+++ b/libc/hdr/wchar_overlay.h
@@ -62,7 +62,7 @@
#endif
#ifdef LIBC_OLD_USE_EXTERN_INLINES
-#define __USE_EXTERN_INLINES
+#define __USE_EXTERN_INLINES
#undef LIBC_OLD_USE_EXTERN_INLINES
#endif
More information about the libc-commits
mailing list