summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/errno-loc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/errno-loc.c')
-rw-r--r--sysdeps/mach/hurd/errno-loc.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/sysdeps/mach/hurd/errno-loc.c b/sysdeps/mach/hurd/errno-loc.c
index 4dca6ddca7..05e7673743 100644
--- a/sysdeps/mach/hurd/errno-loc.c
+++ b/sysdeps/mach/hurd/errno-loc.c
@@ -1,5 +1,5 @@
/* __errno_location -- helper function for locating per-thread errno value
- Copyright (C) 2002-2016 Free Software Foundation, Inc.
+ Copyright (C) 2002-2018 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
@@ -16,13 +16,19 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <hurd/threadvar.h>
+#if IS_IN (rtld)
+/* rtld can not access TLS too early, thus rtld_errno.
-int *
+ Instead of making __open/__close pass errno from TLS to rtld_errno, simply
+ use a weak __errno_location using rtld_errno, which will be overriden by the
+ libc definition. */
+static int rtld_errno;
+int * weak_function
__errno_location (void)
{
- return (int *) __hurd_threadvar_location (_HURD_THREADVAR_ERRNO);
+ return &rtld_errno;
}
-strong_alias (__errno_location, __hurd_errno_location)
-libc_hidden_def (__errno_location)
+libc_hidden_weak (__errno_location)
+#else
+#include "../../../csu/errno-loc.c"
+#endif