summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldso/ldso/arm/dl-syscalls.h9
-rw-r--r--ldso/ldso/cris/dl-syscalls.h10
-rw-r--r--ldso/ldso/frv/dl-syscalls.h9
-rw-r--r--ldso/ldso/i386/dl-syscalls.h9
-rw-r--r--ldso/ldso/ldso.c1
-rw-r--r--ldso/ldso/m68k/dl-syscalls.h31
-rw-r--r--ldso/ldso/mips/dl-syscalls.h9
-rw-r--r--ldso/ldso/powerpc/dl-syscalls.h7
-rw-r--r--ldso/ldso/sh/dl-syscalls.h9
-rw-r--r--ldso/ldso/sh64/dl-syscalls.h11
-rw-r--r--ldso/ldso/sparc/dl-syscalls.h16
11 files changed, 62 insertions, 59 deletions
diff --git a/ldso/ldso/arm/dl-syscalls.h b/ldso/ldso/arm/dl-syscalls.h
index c020832bb..f0f4baed8 100644
--- a/ldso/ldso/arm/dl-syscalls.h
+++ b/ldso/ldso/arm/dl-syscalls.h
@@ -1,7 +1,6 @@
-/* Define the __set_errno macro as nothing so that INLINE_SYSCALL
- * won't set errno, which is important since we make system calls
- * before the errno symbol is dynamicly linked. */
-
-#define __set_errno(X) {(void)(X);}
+/* We can't use the real errno in ldso, since it has not yet
+ * been dynamicly linked in yet. */
+extern int _dl_errno;
+#define __set_errno(X) {(_dl_errno) = (X);}
#include "sys/syscall.h"
diff --git a/ldso/ldso/cris/dl-syscalls.h b/ldso/ldso/cris/dl-syscalls.h
index 651280c18..dc0cc6164 100644
--- a/ldso/ldso/cris/dl-syscalls.h
+++ b/ldso/ldso/cris/dl-syscalls.h
@@ -1,7 +1,5 @@
-/*
- * Define the __set_errno macro as nothing so that INLINE_SYSCALL
- * won't set errno, which is important since we make system calls
- * before the errno symbol is dynamicly linked.
- */
-#define __set_errno(X) {(void)(X);}
+/* We can't use the real errno in ldso, since it has not yet
+ * been dynamicly linked in yet. */
+extern int _dl_errno;
+#define __set_errno(X) {(_dl_errno) = (X);}
#include "sys/syscall.h"
diff --git a/ldso/ldso/frv/dl-syscalls.h b/ldso/ldso/frv/dl-syscalls.h
index bef4f1720..b51a78a79 100644
--- a/ldso/ldso/frv/dl-syscalls.h
+++ b/ldso/ldso/frv/dl-syscalls.h
@@ -17,12 +17,11 @@ You should have received a copy of the GNU Lesser General Public
License along with uClibc; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
USA. */
-
-/* Define the __set_errno macro as nothing so that INLINE_SYSCALL
- * won't set errno, which is important since we make system calls
- * before the errno symbol is dynamicly linked. */
-#define __set_errno(X) {(void)(X);}
+/* We can't use the real errno in ldso, since it has not yet
+ * been dynamicly linked in yet. */
+extern int _dl_errno;
+#define __set_errno(X) {(_dl_errno) = (X);}
#include "sys/syscall.h"
#include <sys/mman.h>
diff --git a/ldso/ldso/i386/dl-syscalls.h b/ldso/ldso/i386/dl-syscalls.h
index c020832bb..f0f4baed8 100644
--- a/ldso/ldso/i386/dl-syscalls.h
+++ b/ldso/ldso/i386/dl-syscalls.h
@@ -1,7 +1,6 @@
-/* Define the __set_errno macro as nothing so that INLINE_SYSCALL
- * won't set errno, which is important since we make system calls
- * before the errno symbol is dynamicly linked. */
-
-#define __set_errno(X) {(void)(X);}
+/* We can't use the real errno in ldso, since it has not yet
+ * been dynamicly linked in yet. */
+extern int _dl_errno;
+#define __set_errno(X) {(_dl_errno) = (X);}
#include "sys/syscall.h"
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 97d1c27db..9b7c7380e 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -46,6 +46,7 @@ unsigned char *_dl_mmap_zero = 0; /* Also used by _dl_malloc */
unsigned long *_dl_brkp = 0; /* The end of the data segment for brk and sbrk */
unsigned long *_dl_envp = 0; /* The environment address */
int _dl_secure = 1; /* Are we dealing with setuid stuff? */
+int _dl_errno = 0; /* We can't use the real errno in ldso */
size_t _dl_pagesize = 0; /* Store the page size for use later */
diff --git a/ldso/ldso/m68k/dl-syscalls.h b/ldso/ldso/m68k/dl-syscalls.h
index 1fb2cccd2..ada694b97 100644
--- a/ldso/ldso/m68k/dl-syscalls.h
+++ b/ldso/ldso/m68k/dl-syscalls.h
@@ -18,6 +18,9 @@
#define __NR_stat 106
#define __NR_mprotect 125
+/* We can't use the real errno in ldso, since it has not yet
+ * been dynamicly linked in yet. */
+extern int _dl_errno;
/* Here are the macros which define how this platform makes
* system calls. This particular variant does _not_ set
@@ -31,8 +34,8 @@ do { \
if ((unsigned long)(res) >= (unsigned long)(-125)) { \
/* avoid using res which is declared to be in register d0; \
errno might expand to a function call and clobber it. */ \
- /* int __err = -(res); \
- errno = __err; */ \
+ int __err = -(res); \
+ _dl_errno = __err; \
res = -1; \
} \
return (type) (res); \
@@ -48,8 +51,8 @@ type name(void) \
: "=g" (__res) \
: "i" (__NR_##name) \
: "cc", "%d0"); \
- if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
- /* errno = -__res; */ \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ _dl_errno = -__res; \
__res = -1; \
} \
return (type)__res; \
@@ -67,8 +70,8 @@ type name(atype a) \
: "i" (__NR_##name), \
"g" ((long)a) \
: "cc", "%d0", "%d1"); \
- if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
- /* errno = -__res; */ \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ _dl_errno = -__res; \
__res = -1; \
} \
return (type)__res; \
@@ -88,8 +91,8 @@ type name(atype a, btype b) \
"a" ((long)a), \
"g" ((long)b) \
: "cc", "%d0", "%d1", "%d2"); \
- if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
- /* errno = -__res; */ \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ _dl_errno = -__res; \
__res = -1; \
} \
return (type)__res; \
@@ -111,8 +114,8 @@ type name(atype a, btype b, ctype c) \
"a" ((long)b), \
"g" ((long)c) \
: "cc", "%d0", "%d1", "%d2", "%d3"); \
- if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
- /* errno = -__res; */ \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ _dl_errno = -__res; \
__res = -1; \
} \
return (type)__res; \
@@ -137,8 +140,8 @@ type name(atype a, btype b, ctype c, dtype d) \
"g" ((long)d) \
: "cc", "%d0", "%d1", "%d2", "%d3", \
"%d4"); \
- if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
- /* errno = -__res; */ \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ _dl_errno = -__res; \
__res = -1; \
} \
return (type)__res; \
@@ -165,8 +168,8 @@ type name(atype a, btype b, ctype c, dtype d, etype e) \
"g" ((long)e) \
: "cc", "%d0", "%d1", "%d2", "%d3", \
"%d4", "%d5"); \
- if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
- /* errno = -__res; */ \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ _dl_errno = -__res; \
__res = -1; \
} \
return (type)__res; \
diff --git a/ldso/ldso/mips/dl-syscalls.h b/ldso/ldso/mips/dl-syscalls.h
index e4a1ff9c4..f0f4baed8 100644
--- a/ldso/ldso/mips/dl-syscalls.h
+++ b/ldso/ldso/mips/dl-syscalls.h
@@ -1,7 +1,6 @@
-/* Define the __set_errno macro as nothing so that we don't bother
- * setting errno, which is important since we make system calls
- * before the errno symbol is dynamicly linked. */
-
-#define __set_errno(X) {(void)(X);}
+/* We can't use the real errno in ldso, since it has not yet
+ * been dynamicly linked in yet. */
+extern int _dl_errno;
+#define __set_errno(X) {(_dl_errno) = (X);}
#include "sys/syscall.h"
diff --git a/ldso/ldso/powerpc/dl-syscalls.h b/ldso/ldso/powerpc/dl-syscalls.h
index 3e561d661..8b8c3b9ef 100644
--- a/ldso/ldso/powerpc/dl-syscalls.h
+++ b/ldso/ldso/powerpc/dl-syscalls.h
@@ -19,6 +19,11 @@
#define __NR_stat 106
#define __NR_mprotect 125
+
+/* We can't use the real errno in ldso, since it has not yet
+ * been dynamicly linked in yet. */
+extern int _dl_errno;
+
/* Here are the macros which define how this platform makes
* system calls. This particular variant does _not_ set
* errno (note how it is disabled in __syscall_return) since
@@ -27,7 +32,7 @@
#undef __syscall_return
#define __syscall_return(type) \
- return (__sc_err & 0x10000000 ? /*errno = __sc_ret,*/ __sc_ret = -1 : 0), \
+ return (__sc_err & 0x10000000 ? _dl_errno = __sc_ret, __sc_ret = -1 : 0), \
(type) __sc_ret
#undef __syscall_clobbers
diff --git a/ldso/ldso/sh/dl-syscalls.h b/ldso/ldso/sh/dl-syscalls.h
index e4a1ff9c4..f0f4baed8 100644
--- a/ldso/ldso/sh/dl-syscalls.h
+++ b/ldso/ldso/sh/dl-syscalls.h
@@ -1,7 +1,6 @@
-/* Define the __set_errno macro as nothing so that we don't bother
- * setting errno, which is important since we make system calls
- * before the errno symbol is dynamicly linked. */
-
-#define __set_errno(X) {(void)(X);}
+/* We can't use the real errno in ldso, since it has not yet
+ * been dynamicly linked in yet. */
+extern int _dl_errno;
+#define __set_errno(X) {(_dl_errno) = (X);}
#include "sys/syscall.h"
diff --git a/ldso/ldso/sh64/dl-syscalls.h b/ldso/ldso/sh64/dl-syscalls.h
index 34da5d630..f0f4baed8 100644
--- a/ldso/ldso/sh64/dl-syscalls.h
+++ b/ldso/ldso/sh64/dl-syscalls.h
@@ -1,9 +1,6 @@
-/* Define the __set_errno macro as nothing so that we don't bother
- * setting errno, which is important since we make system calls
- * before the errno symbol is dynamicly linked. */
-
-#include <errno.h>
-#undef __set_errno
-#define __set_errno(X) {(void)(X);}
+/* We can't use the real errno in ldso, since it has not yet
+ * been dynamicly linked in yet. */
+extern int _dl_errno;
+#define __set_errno(X) {(_dl_errno) = (X);}
#include "sys/syscall.h"
diff --git a/ldso/ldso/sparc/dl-syscalls.h b/ldso/ldso/sparc/dl-syscalls.h
index 4222b2468..218e8a289 100644
--- a/ldso/ldso/sparc/dl-syscalls.h
+++ b/ldso/ldso/sparc/dl-syscalls.h
@@ -19,6 +19,10 @@
#define __NR_stat 38
#define __NR_mprotect 74
+/* We can't use the real errno in ldso, since it has not yet
+ * been dynamicly linked in yet. */
+extern int _dl_errno;
+
/* Here are the macros which define how this platform makes
* system calls. This particular variant does _not_ set
* errno (note how it is disabled in __syscall_return) since
@@ -40,7 +44,7 @@ __asm__ __volatile__ ("t 0x10\n\t" \
: "o0", "cc"); \
if (__res < -255 || __res >= 0) \
return (type) __res; \
-/*errno = -__res; */\
+_dl_errno = -__res; \
return -1; \
}
@@ -60,7 +64,7 @@ __asm__ __volatile__ ("t 0x10\n\t" \
: "cc"); \
if (__res < -255 || __res >= 0) \
return (type) __res; \
-/*errno = -__res;*/ \
+_dl_errno = -__res; \
return -1; \
}
@@ -81,7 +85,7 @@ __asm__ __volatile__ ("t 0x10\n\t" \
: "cc"); \
if (__res < -255 || __res >= 0) \
return (type) __res; \
-/*errno = -__res;*/ \
+_dl_errno = -__res; \
return -1; \
}
@@ -103,7 +107,7 @@ __asm__ __volatile__ ("t 0x10\n\t" \
: "cc"); \
if (__res < -255 || __res>=0) \
return (type) __res; \
-/*errno = -__res;*/ \
+_dl_errno = -__res; \
return -1; \
}
@@ -126,7 +130,7 @@ __asm__ __volatile__ ("t 0x10\n\t" \
: "cc"); \
if (__res < -255 || __res>=0) \
return (type) __res; \
-/*errno = -__res;*/ \
+_dl_errno = -__res; \
return -1; \
}
@@ -151,6 +155,6 @@ __asm__ __volatile__ ("t 0x10\n\t" \
: "cc"); \
if (__res < -255 || __res>=0) \
return (type) __res; \
-/*errno = -__res; */\
+_dl_errno = -__res; \
return -1; \
}