/* Define and initialize the `__libc_enable_secure' flag. Generic version.
- Copyright (C) 1996-2017 Free Software Foundation, Inc.
+ Copyright (C) 1996-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
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
+ <https://www.gnu.org/licenses/>. */
/* This file is used in the static libc. For the shared library,
dl-sysdep.c defines and initializes __libc_enable_secure. */
-#include <unistd.h>
+/* Mark symbols hidden in static PIE for early self relocation to work. */
+#if BUILD_PIE_DEFAULT
+# pragma GCC visibility push(hidden)
+#endif
+#include <startup.h>
#include <libc-internal.h>
/* If nonzero __libc_enable_secure is already set. */
__libc_init_secure (void)
{
if (__libc_enable_secure_decided == 0)
- __libc_enable_secure = (__geteuid () != __getuid ()
- || __getegid () != __getgid ());
+ __libc_enable_secure = (startup_geteuid () != startup_getuid ()
+ || startup_getegid () != startup_getgid ());
}