about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-08-25 09:47:31 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-04-17 16:12:41 -0300
commit3fd243990decbecb032f6a4ea1c834d7d833c638 (patch)
tree2dfe943cf0404eac7a177a835a9b8828942f8d17
parent367d2d90444b50233aae754903898f4c15c181f0 (diff)
downloadglibc-3fd243990decbecb032f6a4ea1c834d7d833c638.tar.gz
glibc-3fd243990decbecb032f6a4ea1c834d7d833c638.tar.xz
glibc-3fd243990decbecb032f6a4ea1c834d7d833c638.zip
Move inhibit_stack_protector to its own header
It is used on tests as well.
-rw-r--r--include/libc-symbols.h15
-rw-r--r--include/stackprotector.h38
2 files changed, 39 insertions, 14 deletions
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 92b64c09f1..014f695f85 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -87,6 +87,7 @@
 /* Obtain the definition of symbol_version_reference.  */
 #include <libc-symver.h>
 #include <libc-diag.h>
+#include <stackprotector.h>
 
 /* When PIC is defined and SHARED isn't defined, we are building PIE
    by default.  */
@@ -363,20 +364,6 @@ for linking")
 #define attribute_relro __attribute__ ((section (".data.rel.ro")))
 
 
-/* Used to disable stack protection in sensitive places, like ifunc
-   resolvers and early static TLS init.  */
-#ifdef HAVE_CC_NO_STACK_PROTECTOR
-# ifdef __clang__
-#  define inhibit_stack_protector \
-     __attribute__((no_stack_protector))
-# else
-#  define inhibit_stack_protector \
-    __attribute__ ((__optimize__ ("-fno-stack-protector")))
-# endif
-#else
-# define inhibit_stack_protector
-#endif
-
 /* The following macros are used for PLT bypassing within libc.so
    (and if needed other libraries similarly).
    First of all, you need to have the function prototyped somewhere,
diff --git a/include/stackprotector.h b/include/stackprotector.h
new file mode 100644
index 0000000000..10230bac06
--- /dev/null
+++ b/include/stackprotector.h
@@ -0,0 +1,38 @@
+/* Details about stack protection enablement and how to disable it.
+   Copyright (C) 2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _INCLUDE_STACKPROTECTOR_H
+#define _INCLUDE_STACKPROTECTOR_H
+
+#include <config.h>
+
+/* Used to disable stack protection in sensitive places, like ifunc
+   resolvers and early static TLS init.  */
+#ifdef HAVE_CC_NO_STACK_PROTECTOR
+# ifdef __clang__
+#  define inhibit_stack_protector \
+     __attribute__((no_stack_protector))
+# else
+#  define inhibit_stack_protector \
+    __attribute__ ((__optimize__ ("-fno-stack-protector")))
+# endif
+#else
+# define inhibit_stack_protector
+#endif
+
+#endif