Skip to content

[libc] temporaliy disable __USE_EXTERN_INLINES and set __USE_FORITFY_LEVEL to 1 before including in overlay mode #113012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
4 commits merged into from Oct 19, 2024

Conversation

ghost
Copy link

@ghost ghost commented Oct 19, 2024

No description provided.

@llvmbot llvmbot added the libc label Oct 19, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 19, 2024

@llvm/pr-subscribers-libc

Author: Job Henandez Lara (Jobhdez)

Changes

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

2 Files Affected:

  • (modified) libc/hdr/stdio_overlay.h (+21)
  • (modified) libc/hdr/wchar_overlay.h (+21)
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

@ghost ghost changed the title [libcdisable use extern inlines and fortify level [libc] disable __USE_EXTERN_INLINES and set __USE_FORITFY_LEVEL to 1 Oct 19, 2024
@ghost ghost changed the title [libc] disable __USE_EXTERN_INLINES and set __USE_FORITFY_LEVEL to 1 [libc] temporaliy disable __USE_EXTERN_INLINES and set __USE_FORITFY_LEVEL to 1 before including in overlay mode Oct 19, 2024
@@ -27,6 +27,17 @@
#undef _FORTIFY_SOURCE
#endif

#ifdef __USE_EXTERN_INLINES
#define LIBC_OLD_EXTERN_INLINES __USE_EXTERN_INLINES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#define LIBC_OLD_EXTERN_INLINES is enough, system headers do not set any value for __USE_EXTERN_INLINES

#endif

#ifdef LIBC_OLD_USE_EXTERN_INLINES
#define __USE_EXTERN_INLINES LIBC_OLD_USE_EXTERN_INLINES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#define __USE_EXTERN_INLINES is enough

Copy link

github-actions bot commented Oct 19, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@ghost ghost merged commit cf4442e into llvm:main Oct 19, 2024
7 checks passed
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants