summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-07-26 02:33:30 +0000
committerUlrich Drepper <drepper@redhat.com>1997-07-26 02:33:30 +0000
commit0a54e4010fe0085cd36deaff9442a7e88de3270d (patch)
tree050a1a47e17e5f1baa26a244524863884d8dc630 /sysdeps
parent1522c3682ccf373e9d393ca73350be284fcf773b (diff)
downloadglibc-0a54e4010fe0085cd36deaff9442a7e88de3270d.tar.gz
glibc-0a54e4010fe0085cd36deaff9442a7e88de3270d.tar.xz
glibc-0a54e4010fe0085cd36deaff9442a7e88de3270d.zip
1997-07-26 04:14  Ulrich Drepper  <drepper@cygnus.com>

	* elf/Makefile (distribute): Add genrtldtbl.awk.
	(before-compile): Add rtldtbl.h.
	(GAWK): New variable.
	(generated): Add trusted-dirs.h and rtldtbl.h.
	($(objpfx)rtldtbl.h): New rule.  File is needed by dl-load.c.
	* elf/dl-load.c: Rewrite.  Now use cache and look for shared
	objects in machine dependent directories.
	* elf/dl-object.c (_dl_new_object): Initialize l_rpath_dirs member.
	* elf/dl-support.c: Rename function to non_dynamic_init and add
	initialization for _dl_platform, _dl_platformlen, _dl_pagesize
	and call to initializer for search path.
	* elf/elf.h: Add AT_PLATFORM and AT_HWCAP.
	* elf/genrtldtbl.awk: New file.
	* elf/link.h: Add type definitions and declarations for search
	path cache.
	* elf/rtld.c: Add definitions of variables used for search path cache.
	* sysdeps/generic/dl-sysdep.c: Let auxiliary vector initialize
	_dl_platform.  Initialize _dl_pagesize early and use this value.
	* sysdeps/i386/dl-machine.h: Add code for _dl_platform handling.
	* sysdeps/mach/hurd/dl-sysdep.c: Initialize _dl_pagesize.
	* sysdeps/unix/sysv/linux/dl-sysdep.c: Use _dl_pagesize instead
	of calling getpagesize.

	* elf/dl-error.c (_dl_signal_error): Make message nicer.

	* nss/libnss_files.map: Fix typo.
	Reported by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>.

	* sysdeps/generic/strsep.c: Optimize case where separator set contains
	only one character.

	* sysdeps/libm-ieee754/s_ccosh.c: Correct sign of result for real
	== +-Inf.
	* sysdeps/libm-ieee754/s_ccoshf.c: Likewise.
	* sysdeps/libm-ieee754/s_ccoshl.c: Likewise.

1997-07-25 09:15  H.J. Lu  <hjl@gnu.ai.mit.edu>

	* sysdeps/sparc/udiv_qrnnd.S: Check PIC instead of __PIC__.
	* sysdeps/unix/sysv/linux/sparc/__sigtrampoline.S: Likewise.
	* sysdeps/unix/mips/sysdep.S: Likewise.
	* sysdeps/unix/sysv/linux/mips/clone.S: Likewise.

	* sysdeps/mips/bsd-_setjmp.S: Remove __PIC__ comment.
	* sysdeps/mips/bsd-setjmp.S: Likewise.

	* sysdeps/mips/dl-machine.h: Remove extra stuff.
	* sysdeps/mips/mips64/dl-machine.h: Likewise.

1997-07-25 18:55  Philip Blundell  <Philip.Blundell@pobox.com>

	* sysdeps/standalone/arm/sysdep.c: New file.

1997-07-25 13:25  Philip Blundell  <Philip.Blundell@pobox.com>

	* aout/Makefile: New file.
	* Makeconfig (binfmt-subdir): Assume a.out when not ELF.

	* sysdeps/generic/machine-gmon.h: Add warning about limitations of
	__builtin_return_address().
	* sysdeps/arm/machine-gmon.h: New file, use assembly to avoid
	above problem.

1997-07-25 16:24  H.J. Lu  <hjl@gnu.ai.mit.edu>

	* elf/dl-deps.c (_dl_map_object_deps): Fix a typo.

1997-07-22  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* math/libm-test.c (ccos_test, ccosh_test): Fix sign in some
	tests.

1997-07-24  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sunrpc/clnt_udp.c (clntudp_call): Rename cu_wait from timeout to
	not shadow the variable in the outer scope.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/arm/machine-gmon.h55
-rw-r--r--sysdeps/generic/dl-sysdep.c37
-rw-r--r--sysdeps/generic/machine-gmon.h4
-rw-r--r--sysdeps/generic/strsep.c23
-rw-r--r--sysdeps/i386/dl-machine.h21
-rw-r--r--sysdeps/libm-ieee754/s_ccosh.c7
-rw-r--r--sysdeps/libm-ieee754/s_ccoshf.c7
-rw-r--r--sysdeps/libm-ieee754/s_ccoshl.c7
-rw-r--r--sysdeps/mach/hurd/dl-sysdep.c5
-rw-r--r--sysdeps/mips/bsd-_setjmp.S1
-rw-r--r--sysdeps/mips/bsd-setjmp.S1
-rw-r--r--sysdeps/mips/dl-machine.h10
-rw-r--r--sysdeps/mips/mips64/dl-machine.h10
-rw-r--r--sysdeps/sparc/udiv_qrnnd.S4
-rw-r--r--sysdeps/standalone/arm/bits/errno.h51
-rw-r--r--sysdeps/standalone/arm/sysdep.c32
-rw-r--r--sysdeps/unix/mips/sysdep.S2
-rw-r--r--sysdeps/unix/sysv/linux/dl-sysdep.c16
-rw-r--r--sysdeps/unix/sysv/linux/mips/clone.S2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/__sigtrampoline.S4
20 files changed, 210 insertions, 89 deletions
diff --git a/sysdeps/arm/machine-gmon.h b/sysdeps/arm/machine-gmon.h
new file mode 100644
index 0000000000..27643df884
--- /dev/null
+++ b/sysdeps/arm/machine-gmon.h
@@ -0,0 +1,55 @@
+/* Machine-dependent definitions for profiling support.  ARM version.
+   Copyright (C) 1996, 1997 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* GCC for the ARM cannot compile __builtin_return_address(N) for N != 0, 
+   so we must use an assembly stub.  */
+
+#include <sysdep.h>
+#ifndef NO_UNDERSCORES
+/* The asm symbols for C functions are `_function'.
+   The canonical name for the counter function is `mcount', no _.  */
+void _mcount (void) asm ("mcount");
+#else
+/* The canonical name for the function is `_mcount' in both C and asm,
+   but some old asm code might assume it's `mcount'.  */
+void _mcount (void);
+weak_alias (_mcount, mcount)
+#endif
+
+static void mcount_internal (u_long frompc, u_long selfpc);
+
+#define _MCOUNT_DECL(frompc, selfpc) \
+static void mcount_internal (u_long frompc, u_long selfpc)
+
+#define MCOUNT \
+void _mcount (void)							      \
+{									      \
+  register unsigned long int frompc, selfpc;				      \
+  __asm__("movs fp, fp; "						      \
+          "moveq %0, $0; "						      \
+	  "ldrne %0, [fp, $-4]; "					      \
+	  "ldrne %1, [fp, $-12]; "					      \
+	  "movnes %1, %1; "						      \
+	  "ldrne %1, [%1, $-4]; "					      \
+	  : "=g" (selfpc), "=g" (frompc)				      \
+	  : : "cc"							      \
+	  );								      \
+  if (selfpc)								      \
+    mcount_internal(frompc, selfpc);					      \
+}
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index e18f0b89a4..4f97f8547b 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -26,11 +26,14 @@
 #include <link.h>
 #include <unistd.h>
 
+#include <dl-machine.h>
 
 extern int _dl_argc;
 extern char **_dl_argv;
 extern char **_environ;
 extern size_t _dl_pagesize;
+extern const char *_dl_platform;
+extern size_t _dl_platformlen;
 extern void _end;
 extern void ENTRY_POINT (void);
 
@@ -57,6 +60,7 @@ _dl_sysdep_start (void **start_argptr,
   _dl_argc = *(long *) start_argptr;
   _dl_argv = (char **) start_argptr + 1;
   _environ = &_dl_argv[_dl_argc + 1];
+  _dl_platform = NULL; /* Default to nothing known about the platform.  */
   start_argptr = (void **) _environ;
   while (*start_argptr)
     ++start_argptr;
@@ -93,6 +97,12 @@ _dl_sysdep_start (void **start_argptr,
       case AT_EGID:
 	egid = av->a_un.a_val;
 	break;
+      case AT_PLATFORM:
+	_dl_platform = av->a_un.a_ptr;
+	break;
+      case AT_HWCAP:
+	/* Well, what shall we use?  A string or an integer with bits?  */
+	break;
       }
 
   /* Linux doesn't provide us with any of these values on the stack
@@ -107,21 +117,28 @@ _dl_sysdep_start (void **start_argptr,
 
   __libc_enable_secure = uid != euid || gid != egid;
 
+  if (_dl_pagesize == 0)
+    _dl_pagesize = __getpagesize ();
+
 #ifdef DL_SYSDEP_INIT
   DL_SYSDEP_INIT;
 #endif
 
+#ifdef DL_PLATFORM_INIT
+  DL_PLATFORM_INIT;
+#endif
+
+  /* Determine the length of the platform name.  */
+  if (_dl_platform != NULL)
+    _dl_platformlen = strlen (_dl_platform);
+
   if (__sbrk (0) == &_end)
-    {
-      /* The dynamic linker was run as a program, and so the initial break
-	 starts just after our bss, at &_end.  The malloc in dl-minimal.c
-	 will consume the rest of this page, so tell the kernel to move the
-	 break up that far.  When the user program examines its break, it
-	 will see this new value and not clobber our data.  */
-      size_t pg = __getpagesize ();
-
-      __sbrk (pg - ((&_end - (void *) 0) & (pg - 1)));
-    }
+    /* The dynamic linker was run as a program, and so the initial break
+       starts just after our bss, at &_end.  The malloc in dl-minimal.c
+       will consume the rest of this page, so tell the kernel to move the
+       break up that far.  When the user program examines its break, it
+       will see this new value and not clobber our data.  */
+    __sbrk (_dl_pagesize - ((&_end - (void *) 0) & (_dl_pagesize - 1)));
 
   (*dl_main) (phdr, phnum, &user_entry);
   return user_entry;
diff --git a/sysdeps/generic/machine-gmon.h b/sysdeps/generic/machine-gmon.h
index c4a2168322..3b63707eaf 100644
--- a/sysdeps/generic/machine-gmon.h
+++ b/sysdeps/generic/machine-gmon.h
@@ -22,6 +22,10 @@
      void *__builtin_return_address (unsigned int N)
    returns the return address of the frame N frames up.  */
 
+/* Be warned that GCC cannot usefully compile __builtin_return_address(N) 
+   for N != 0 on all machines.  In this case, you may have to write
+   your own version of _mcount().  */
+
 #if __GNUC__ < 2
  #error "This file uses __builtin_return_address, a GCC 2 extension."
 #endif
diff --git a/sysdeps/generic/strsep.c b/sysdeps/generic/strsep.c
index d17e53a772..b2c7e90c39 100644
--- a/sysdeps/generic/strsep.c
+++ b/sysdeps/generic/strsep.c
@@ -27,8 +27,27 @@ __strsep (char **stringp, const char *delim)
   if (! begin || *begin == '\0')
     return NULL;
 
-  /* Find the end of the token.  */
-  end = strpbrk (begin, delim);
+  /* A frequent case is when the delimiter string contains only one
+     character.  Here we don't need to call the expensive `strpbrk'
+     function and instead work using `strchr'.  */
+  if (delim[0] == '\0' || delim[1] == '\0')
+    {
+      char ch = delim[0];
+
+      if (ch == '\0')
+	end = NULL;
+      else
+	{
+	  while (*begin == ch)
+	    ++begin;
+
+	  end = strchr (begin, delim[0]);
+	}
+    }
+  else
+    /* Find the end of the token.  */
+    end = strpbrk (begin, delim);
+
   if (end)
     {
       /* Terminate the token and set *STRINGP past NUL character.  */
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 0388cbe510..d6fc038411 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -44,7 +44,7 @@ elf_machine_matches_host (Elf32_Half e_machine)
 /* Return the link-time address of _DYNAMIC.  Conveniently, this is the
    first element of the GOT.  This must be inlined in a function which
    uses global data.  */
-static inline Elf32_Addr
+static inline Elf32_Addr __attribute__ ((unused))
 elf_machine_dynamic (void)
 {
   register Elf32_Addr *got asm ("%ebx");
@@ -86,7 +86,7 @@ static ElfW(Addr) fixup (struct link_map *l, ElfW(Word) reloc_offset)
 /* Set up the loaded object described by L so its unrelocated PLT
    entries will jump to the on-demand fixup code in dl-runtime.c.  */
 
-static inline int
+static inline int __attribute__ ((unused))
 elf_machine_runtime_setup (struct link_map *l, int lazy)
 {
   Elf32_Addr *got;
@@ -233,6 +233,23 @@ _dl_start_user:\n\
 /* The i386 never uses Elf32_Rela relocations.  */
 #define ELF_MACHINE_NO_RELA 1
 
+/* We define an initialization functions.  This is called very early in
+   _dl_sysdep_start.  */
+#define DL_PLATFORM_INIT dl_platform_init ()
+
+extern const char *_dl_platform;
+
+static inline void __attribute__ ((unused))
+dl_platform_init (void)
+{
+  if (_dl_platform == NULL)
+    /* We default to i386 since all instructions understood by the i386
+       are also understood by later processors.  */
+    _dl_platform = "i386";
+  else if (*_dl_platform == '\0')
+    _dl_platform = NULL;
+}
+
 #endif /* !dl_machine_h */
 
 #ifdef RESOLVE
diff --git a/sysdeps/libm-ieee754/s_ccosh.c b/sysdeps/libm-ieee754/s_ccosh.c
index 1e92f03771..394101f23a 100644
--- a/sysdeps/libm-ieee754/s_ccosh.c
+++ b/sysdeps/libm-ieee754/s_ccosh.c
@@ -32,8 +32,6 @@ __ccosh (__complex__ double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  __real__ x = fabs (__real__ x);
-
   if (rcls >= FP_ZERO)
     {
       /* Real part is finite.  */
@@ -67,7 +65,7 @@ __ccosh (__complex__ double x)
 	{
 	  /* Imaginary part is 0.0.  */
 	  __real__ retval = HUGE_VAL;
-	  __imag__ retval = __imag__ x;
+	  __imag__ retval = __imag__ x * __copysign (1.0, __real__ x);
 	}
       else if (icls > FP_ZERO)
 	{
@@ -77,7 +75,8 @@ __ccosh (__complex__ double x)
 	  __sincos (__imag__ x, &sinix, &cosix);
 
 	  __real__ retval = __copysign (HUGE_VAL, cosix);
-	  __imag__ retval = __copysign (HUGE_VAL, sinix);
+	  __imag__ retval = (__copysign (HUGE_VAL, sinix)
+			     * __copysign (1.0, __real__ x));
 	}
       else
 	{
diff --git a/sysdeps/libm-ieee754/s_ccoshf.c b/sysdeps/libm-ieee754/s_ccoshf.c
index 573a63367b..a8043fdd39 100644
--- a/sysdeps/libm-ieee754/s_ccoshf.c
+++ b/sysdeps/libm-ieee754/s_ccoshf.c
@@ -32,8 +32,6 @@ __ccoshf (__complex__ float x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  __real__ x = fabsf (__real__ x);
-
   if (rcls >= FP_ZERO)
     {
       /* Real part is finite.  */
@@ -67,7 +65,7 @@ __ccoshf (__complex__ float x)
 	{
 	  /* Imaginary part is 0.0.  */
 	  __real__ retval = HUGE_VALF;
-	  __imag__ retval = __imag__ x;
+	  __imag__ retval = __imag__ x * __copysignf (1.0, __real__ x);
 	}
       else if (icls > FP_ZERO)
 	{
@@ -77,7 +75,8 @@ __ccoshf (__complex__ float x)
 	  __sincosf (__imag__ x, &sinix, &cosix);
 
 	  __real__ retval = __copysignf (HUGE_VALF, cosix);
-	  __imag__ retval = __copysignf (HUGE_VALF, sinix);
+	  __imag__ retval = (__copysignf (HUGE_VALF, sinix)
+			     * __copysignf (1.0, __real__ x));
 	}
       else
 	{
diff --git a/sysdeps/libm-ieee754/s_ccoshl.c b/sysdeps/libm-ieee754/s_ccoshl.c
index feb1351917..9301a9e10d 100644
--- a/sysdeps/libm-ieee754/s_ccoshl.c
+++ b/sysdeps/libm-ieee754/s_ccoshl.c
@@ -32,8 +32,6 @@ __ccoshl (__complex__ long double x)
   int rcls = fpclassify (__real__ x);
   int icls = fpclassify (__imag__ x);
 
-  __real__ x = fabsl (__real__ x);
-
   if (rcls >= FP_ZERO)
     {
       /* Real part is finite.  */
@@ -67,7 +65,7 @@ __ccoshl (__complex__ long double x)
 	{
 	  /* Imaginary part is 0.0.  */
 	  __real__ retval = HUGE_VALL;
-	  __imag__ retval = __imag__ x;
+	  __imag__ retval = __imag__ x * __copysignl (1.0, __real__ x);
 	}
       else if (icls > FP_ZERO)
 	{
@@ -77,7 +75,8 @@ __ccoshl (__complex__ long double x)
 	  __sincosl (__imag__ x, &sinix, &cosix);
 
 	  __real__ retval = __copysignl (HUGE_VALL, cosix);
-	  __imag__ retval = __copysignl (HUGE_VALL, sinix);
+	  __imag__ retval = (__copysignl (HUGE_VALL, sinix)
+			     * __copysignl (1.0, __real__ x));
 	}
       else
 	{
diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c
index 68c4cb3103..69dd55ad39 100644
--- a/sysdeps/mach/hurd/dl-sysdep.c
+++ b/sysdeps/mach/hurd/dl-sysdep.c
@@ -29,7 +29,7 @@
 #include <mach/mig_support.h>
 #include "hurdstartup.h"
 #include <mach/host_info.h>
-#include "../stdio-common/_itoa.h"
+#include <stdio-common/_itoa.h>
 #include <hurd/auth.h>
 #include <hurd/term.h>
 #include <stdarg.h>
@@ -188,6 +188,9 @@ unfmh();			/* XXX */
   /* Set up so we can do RPCs.  */
   __mach_init ();
 
+  /* Initialize frequently used global variable.  */
+  _dl_pagesize = __getpagesize ();
+
 fmh();				/* XXX */
 
   /* See hurd/hurdstartup.c; this deals with getting information
diff --git a/sysdeps/mips/bsd-_setjmp.S b/sysdeps/mips/bsd-_setjmp.S
index 819a7018c4..6d841fc237 100644
--- a/sysdeps/mips/bsd-_setjmp.S
+++ b/sysdeps/mips/bsd-_setjmp.S
@@ -23,7 +23,6 @@
 
 #include <sysdep.h>
 
-/* XXX Must this be __PIC__ ? --drepper */
 #ifdef PIC
 	.option pic2
 #endif
diff --git a/sysdeps/mips/bsd-setjmp.S b/sysdeps/mips/bsd-setjmp.S
index f220404c2c..000aee436a 100644
--- a/sysdeps/mips/bsd-setjmp.S
+++ b/sysdeps/mips/bsd-setjmp.S
@@ -23,7 +23,6 @@
 
 #include <sysdep.h>
 
-/* XXX Must this be __PIC__ ? --drepper */
 #ifdef PIC
 	.option pic2
 #endif
diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h
index 7456ae0b7a..fce7cffb4a 100644
--- a/sysdeps/mips/dl-machine.h
+++ b/sysdeps/mips/dl-machine.h
@@ -96,16 +96,6 @@ elf_machine_matches_host (ElfW(Half) e_machine)
     }
 }
 
-/* Return the link-time address of _DYNAMIC.  Conveniently, this is the
-+   first element of the GOT.  This must be inlined in a function which
-+   uses global data.  */
-+static inline ElfW(Addr)
-+elf_machine_dynamic (void)
-+{
-+  register ElfW(Addr) gp asm ("$28");
-+  return * (ElfW(Addr) *) (gp - 0x7ff0);
-+}
-+
 static inline ElfW(Addr) *
 elf_mips_got_from_gpreg (ElfW(Addr) gpreg)
 {
diff --git a/sysdeps/mips/mips64/dl-machine.h b/sysdeps/mips/mips64/dl-machine.h
index 3277b109d9..a20835af35 100644
--- a/sysdeps/mips/mips64/dl-machine.h
+++ b/sysdeps/mips/mips64/dl-machine.h
@@ -96,16 +96,6 @@ elf_machine_matches_host (ElfW(Half) e_machine)
     }
 }
 
-/* Return the link-time address of _DYNAMIC.  Conveniently, this is the
-+   first element of the GOT.  This must be inlined in a function which
-+   uses global data.  */
-+static inline ElfW(Addr)
-+elf_machine_dynamic (void)
-+{
-+  register ElfW(Addr) gp asm ("$28");
-+  return * (ElfW(Addr) *) (gp - 0x7ff0);
-+}
-+
 static inline ElfW(Addr) *
 elf_mips_got_from_gpreg (ElfW(Addr) gpreg)
 {
diff --git a/sysdeps/sparc/udiv_qrnnd.S b/sysdeps/sparc/udiv_qrnnd.S
index 74b932d34b..437d66e9ea 100644
--- a/sysdeps/sparc/udiv_qrnnd.S
+++ b/sysdeps/sparc/udiv_qrnnd.S
@@ -44,7 +44,7 @@ ENTRY(__udiv_qrnnd)
 	!#PROLOGUE# 1
 	st	%i1,[%fp-8]
 	ld	[%fp-8],%f10
-#ifdef __PIC__
+#ifdef PIC
 ._XL11:
 	call	._XL1
 	fitod	%f10,%f4
@@ -78,7 +78,7 @@ L249:
 	faddd	%f4,%f8,%f4
 L250:
 	fdivd	%f2,%f4,%f2
-#ifdef __PIC__
+#ifdef PIC
 ._XL22:
 	call	._XL2
 	nop
diff --git a/sysdeps/standalone/arm/bits/errno.h b/sysdeps/standalone/arm/bits/errno.h
index 49a4998cf8..362b43dacf 100644
--- a/sysdeps/standalone/arm/bits/errno.h
+++ b/sysdeps/standalone/arm/bits/errno.h
@@ -19,35 +19,36 @@
 /* This file defines the `errno' constants for standalone ARM machines.
    These constants are essentially arbitrary.  */
 
-#if !defined(__Emath_defined) && (defined(_ERRNO_H) || defined(__need_Emath))
-#undef	__need_Emath
-#define	__Emath_defined	1
+#if !defined __Emath_defined && (defined _ERRNO_H || defined __need_Emath)
+# undef	__need_Emath
+# define __Emath_defined	1
 
-#define	EDOM		1
-#define	ERANGE		2
+# define EDOM		1
+# define ERANGE		2
 #endif
 
 #ifdef	_ERRNO_H
-#define	ENOSYS		3
-#define	EINVAL		4
-#define	ESPIPE		5
-#define	EBADF		6
-#define	ENOMEM		7
-#define	EACCES		8
-#define ENFILE		9
-#define EMFILE		10
-#define	ENAMETOOLONG	11	/* File name too long */
-#define	ELOOP		12	/* Too many symbolic links encountered */
-#define ENOMSG          13      /* No message of desired type */
-#define	E2BIG		14	/* Arg list too long */
-#define EINTR		15
-#define EILSEQ		16
-#define ENOEXEC		17
-#define ENOENT		18
-#define EPROTOTYPE	19
-#define ESRCH		20
-#define EPERM		21
-#define ENOTDIR         22
+# define ENOSYS		3
+# define EINVAL		4
+# define ESPIPE		5
+# define EBADF		6
+# define ENOMEM		7
+# define EACCES		8
+# define ENFILE		9
+# define EMFILE		10
+# define ENAMETOOLONG	11	/* File name too long */
+# define ELOOP		12	/* Too many symbolic links encountered */
+# define ENOMSG          13      /* No message of desired type */
+# define E2BIG		14	/* Arg list too long */
+# define EINTR		15
+# define EILSEQ		16
+# define ENOEXEC		17
+# define ENOENT		18
+# define EPROTOTYPE	19
+# define ESRCH		20
+# define EPERM		21
+# define ENOTDIR         22
+# define ESTALE          23
 #endif
 
 #define __set_errno(val) errno = (val)
diff --git a/sysdeps/standalone/arm/sysdep.c b/sysdeps/standalone/arm/sysdep.c
new file mode 100644
index 0000000000..d2564204ea
--- /dev/null
+++ b/sysdeps/standalone/arm/sysdep.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 1995, 1996, 1997 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 Library General Public License as
+   published by the Free Software Foundation; either version 2 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <sysdep.h>
+
+/* errno has to be defined somewhere, and it might as well be here.  */
+int errno = 0;
+
+/* The same goes for these magic signal functions.  This is a standalone
+   environment so we do nothing.  */
+void _sig_dfl(int sig)
+{
+}
+
+void _sig_ign(int sig)
+{
+}
diff --git a/sysdeps/unix/mips/sysdep.S b/sysdeps/unix/mips/sysdep.S
index ac8335fe5b..4275d664ec 100644
--- a/sysdeps/unix/mips/sysdep.S
+++ b/sysdeps/unix/mips/sysdep.S
@@ -29,7 +29,7 @@
 	.set noreorder
 
 ENTRY(__syscall_error)
-#ifdef __PIC__
+#ifdef PIC
 	.set	noat
 	move	$1, $31
 	bltzal	$0, 0f
diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c
index a1abbdcae0..18b989cc74 100644
--- a/sysdeps/unix/sysv/linux/dl-sysdep.c
+++ b/sysdeps/unix/sysv/linux/dl-sysdep.c
@@ -27,18 +27,16 @@
 static inline void
 frob_brk (void)
 {
+  extern size_t _dl_pagesize;
   extern void _end;
   __brk (0);			/* Initialize the break.  */
   if (__sbrk (0) == &_end)
-    {
-      /* The dynamic linker was run as a program, and so the initial break
-	 starts just after our bss, at &_end.  The malloc in dl-minimal.c
-	 will consume the rest of this page, so tell the kernel to move the
-	 break up that far.  When the user program examines its break, it
-	 will see this new value and not clobber our data.  */
-      size_t pg = __getpagesize ();
-      __sbrk (pg - ((&_end - (void *) 0) & pg));
-    }
+    /* The dynamic linker was run as a program, and so the initial break
+       starts just after our bss, at &_end.  The malloc in dl-minimal.c
+       will consume the rest of this page, so tell the kernel to move the
+       break up that far.  When the user program examines its break, it
+       will see this new value and not clobber our data.  */
+    __sbrk (_dl_pagesize - ((&_end - (void *) 0) & _dl_pagesize));
 }
 
 #include <sysdeps/generic/dl-sysdep.c>
diff --git a/sysdeps/unix/sysv/linux/mips/clone.S b/sysdeps/unix/sysv/linux/mips/clone.S
index 357f70e47f..4d6408dc97 100644
--- a/sysdeps/unix/sysv/linux/mips/clone.S
+++ b/sysdeps/unix/sysv/linux/mips/clone.S
@@ -37,7 +37,7 @@
 
 	.text
 NESTED(__clone,4*SZREG,sp)
-#ifdef __PIC__
+#ifdef PIC
 	.set		noreorder
 	.cpload		$25
 	.set		reorder
diff --git a/sysdeps/unix/sysv/linux/sparc/__sigtrampoline.S b/sysdeps/unix/sysv/linux/sparc/__sigtrampoline.S
index 2dd13062fc..a639511f3e 100644
--- a/sysdeps/unix/sysv/linux/sparc/__sigtrampoline.S
+++ b/sysdeps/unix/sysv/linux/sparc/__sigtrampoline.S
@@ -72,7 +72,7 @@ ENTRY(____sparc_signal_trampoline)
 	or	%g0,%g0,%g1     /*Call sys_setup */
 	t	0x10
 1:
-#ifdef __PIC__
+#ifdef PIC
 	/* Save return address */
 	mov	%o7,%o4
 ___sxx:
@@ -89,7 +89,7 @@ ___syy:
 #endif
 	sethi	%hi(C_SYMBOL_NAME(____sig_table)),%o5
 	or	%o5,%lo(C_SYMBOL_NAME(____sig_table)),%o5
-#ifdef __PIC__
+#ifdef PIC
 	add	%o5,%o4,%o4
 	ld	[%o4],%o5
 #endif