[libc-commits] [libc] [libc] Also remove _FORTIFY_SOURCE before including <stdlib.h> in overlay mode. (PR #142647)

via libc-commits libc-commits at lists.llvm.org
Tue Jun 3 10:49:26 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: None (lntue)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/142647.diff


1 Files Affected:

- (modified) libc/hdr/stdlib_overlay.h (+10) 


``````````diff
diff --git a/libc/hdr/stdlib_overlay.h b/libc/hdr/stdlib_overlay.h
index f095cafe5e0bc..53c32ec0ae332 100644
--- a/libc/hdr/stdlib_overlay.h
+++ b/libc/hdr/stdlib_overlay.h
@@ -19,6 +19,11 @@
 // functions, causing external alias errors.  They are guarded by
 // `__USE_FORTIFY_LEVEL`, which will be temporarily disabled.
 
+#ifdef _FORTIFY_SOURCE
+#define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
+#undef _FORTIFY_SOURCE
+#endif
+
 #ifdef __USE_FORTIFY_LEVEL
 #define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
 #undef __USE_FORTIFY_LEVEL
@@ -27,6 +32,11 @@
 
 #include <stdlib.h>
 
+#ifdef LIBC_OLD_FORTIFY_SOURCE
+#define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
+#undef LIBC_OLD_FORTIFY_SOURCE
+#endif
+
 #ifdef LIBC_OLD_USE_FORTIFY_LEVEL
 #undef __USE_FORTIFY_LEVEL
 #define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL

``````````

</details>


https://github.com/llvm/llvm-project/pull/142647


More information about the libc-commits mailing list