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

via libc-commits libc-commits at lists.llvm.org
Tue Jun 3 11:25:50 PDT 2025


Author: lntue
Date: 2025-06-03T14:25:46-04:00
New Revision: b994299e59c9aac01ca0a494b2b861ebd5acc190

URL: https://github.com/llvm/llvm-project/commit/b994299e59c9aac01ca0a494b2b861ebd5acc190
DIFF: https://github.com/llvm/llvm-project/commit/b994299e59c9aac01ca0a494b2b861ebd5acc190.diff

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

Added: 
    

Modified: 
    libc/hdr/stdlib_overlay.h

Removed: 
    


################################################################################
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


        


More information about the libc-commits mailing list