]> sourceware.org Git - glibc.git/commitdiff
Wed Nov 22 12:37:39 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> cvs/libc-951123
authorRoland McGrath <roland@gnu.org>
Thu, 23 Nov 1995 04:53:06 +0000 (04:53 +0000)
committerRoland McGrath <roland@gnu.org>
Thu, 23 Nov 1995 04:53:06 +0000 (04:53 +0000)
* sysdeps/unix/sysv/linux/i386/sysdep.S (_errno): Define as alias
for errno.

* stdio-common/vfprintf.c [USE_IN_LIBIO] (vfprintf): Define as
alias for _IO_vfprintf.

* sysdeps/unix/sysv/linux/sockaddrcom.h: File removed.

* sysdeps/unix/sysv/linux/i386/init-first.c (init): Use
__fpu_control instead of ___fpu_control.
* sysdeps/unix/sysv/linux/i386/ieee_fpu.c
(___fpu_control): Renamed to __fpu_control.
* sysdeps/unix/sysv/linux/i386/fpu_control.h: Likewise.
* sysdeps/unix/sysv/linux/i386/fpu_control.c: Likewise.

* elf/dl-minimal.c: New file.
* elf/Makefile (rtld-routines): Add dl-minimal.
* elf/rtld.c (__dgettext, __assert_fail, __assert_perror_fail):
Functions moved to dl-minimal.c.
* sysdeps/mach/hurd/dl-sysdep.c (malloc, free, realloc,
sigjmp_save, longjmp): Likewise.

* sysdeps/unix/sysv/linux/i386/brk.S (__curbrk): Always initialize
to &_end, regardless of PIC.

* stdio-common/vfscanf.c (__vfscanf): Fix arg name in defn.

14 files changed:
ChangeLog
elf/Makefile
elf/dl-minimal.c [new file with mode: 0644]
elf/rtld.c
stdio-common/vfprintf.c
stdio-common/vfscanf.c
sysdeps/mach/hurd/dl-sysdep.c
sysdeps/unix/sysv/linux/i386/brk.S
sysdeps/unix/sysv/linux/i386/fpu_control.c
sysdeps/unix/sysv/linux/i386/fpu_control.h
sysdeps/unix/sysv/linux/i386/ieee_fpu.c
sysdeps/unix/sysv/linux/i386/init-first.c
sysdeps/unix/sysv/linux/i386/sysdep.S
sysdeps/unix/sysv/linux/sockaddrcom.h [deleted file]

index f7e5ef69ce802d8da91d5eeb6c9de6fa772b6eb7..6ef1a87a763b44a063394dbb0f55d46fb4fb205b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+Wed Nov 22 12:37:39 1995  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
+
+       * sysdeps/unix/sysv/linux/i386/sysdep.S (_errno): Define as alias
+       for errno.
+
+       * stdio-common/vfprintf.c [USE_IN_LIBIO] (vfprintf): Define as
+       alias for _IO_vfprintf.
+
+       * sysdeps/unix/sysv/linux/sockaddrcom.h: File removed.
+
+       * sysdeps/unix/sysv/linux/i386/init-first.c (init): Use
+       __fpu_control instead of ___fpu_control.
+       * sysdeps/unix/sysv/linux/i386/ieee_fpu.c
+       (___fpu_control): Renamed to __fpu_control.
+       * sysdeps/unix/sysv/linux/i386/fpu_control.h: Likewise.
+       * sysdeps/unix/sysv/linux/i386/fpu_control.c: Likewise.
+
+       * elf/dl-minimal.c: New file.
+       * elf/Makefile (rtld-routines): Add dl-minimal.
+       * elf/rtld.c (__dgettext, __assert_fail, __assert_perror_fail):
+       Functions moved to dl-minimal.c.
+       * sysdeps/mach/hurd/dl-sysdep.c (malloc, free, realloc,
+       sigjmp_save, longjmp): Likewise.
+
+       * sysdeps/unix/sysv/linux/i386/brk.S (__curbrk): Always initialize
+       to &_end, regardless of PIC.
+
+       * stdio-common/vfscanf.c (__vfscanf): Fix arg name in defn.
+
 Tue Nov 21 14:12:13 1995  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
 
        * malloc/malloc.c (align): Don't check contiguity and call abort.
index 4a1adb8b5962ff4b0e7cadc8911083f40e46dc5c..16a6cca2fe8c300125649d65857e0489e71f19e7 100644 (file)
@@ -28,7 +28,7 @@ libelf-routines       := elf_hash
 libdl-routines := dlopen dlclose dlsym dlerror
 libdl-inhibit-o        = $(filter-out .so,$(object-suffixes)) # Build only shared.
 
-rtld-routines  := rtld $(addprefix dl-,load lookup object reloc        \
+rtld-routines  := rtld $(addprefix dl-,minimal load lookup object reloc \
                                        runtime sysdep error init fini)
 distribute     = $(rtld-routines:=.c) dynamic-link.h do-rel.h \
                  soinit.c sofini.c ldd.sh.in linux-compat.c
diff --git a/elf/dl-minimal.c b/elf/dl-minimal.c
new file mode 100644 (file)
index 0000000..332f21e
--- /dev/null
@@ -0,0 +1,153 @@
+/* Minimal replacements for basic facilities used in the dynamic linker.
+Copyright (C) 1995 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <unistd.h>
+#include <assert.h>
+#include <string.h>
+#include <link.h>
+#include "../stdio-common/_itoa.h"
+
+/* Minimal `malloc' allocator for use while loading shared libraries.
+   Only small blocks are allocated, and none are ever freed.  */
+
+static void *alloc_ptr, *alloc_end, *alloc_last_block;
+
+void *
+malloc (size_t n)
+{
+  extern int _dl_zerofd;
+  static size_t pagesize;
+
+  if (pagesize == 0)
+    pagesize = __getpagesize ();
+
+  if (_dl_zerofd == -1)
+    _dl_zerofd = _dl_sysdep_open_zero_fill ();
+
+  if (alloc_end == 0)
+    {
+      /* Consume any unused space in the last page of our data segment.  */
+      extern int _end;
+      alloc_ptr = &_end;
+      alloc_end = (void *) 0 + (((alloc_ptr - (void *) 0) + pagesize - 1)
+                               & ~(pagesize - 1));
+    }
+
+  /* Make sure the allocation pointer is ideally aligned.  */
+  alloc_ptr = (void *) 0 + (((alloc_ptr - (void *) 0) + sizeof (double) - 1)
+                           & ~(sizeof (double) - 1));
+
+  if (alloc_ptr + n >= alloc_end)
+    {
+      /* Insufficient space left; allocate another page.  */
+      caddr_t page;
+      assert (n <= pagesize);
+      page = mmap (0, pagesize, PROT_READ|PROT_WRITE, MAP_ANON, _dl_zerofd, 0);
+      assert (page != (caddr_t) -1);
+      if (page != alloc_end)
+       alloc_ptr = page;
+      alloc_end = page + pagesize;
+    }
+
+  alloc_last_block = (void *) alloc_ptr;
+  alloc_ptr += n;
+  return alloc_last_block;
+}
+weak_symbol (malloc)
+
+/* This will rarely be called.  */
+void
+free (void *ptr)
+{
+  /* We can free only the last block allocated.  */
+  if (ptr == alloc_last_block)
+    alloc_ptr = alloc_last_block;
+}
+weak_symbol (free)
+
+/* This is never called.  */
+void *
+realloc (void *ptr, size_t n)
+{ ptr += n; abort (); }
+weak_symbol (realloc)
+\f
+/* Avoid signal frobnication in setjmp/longjmp.  Keeps things smaller.  */
+
+#include <setjmp.h>
+
+int __sigjmp_save (sigjmp_buf env, int savemask)
+{ env[0].__mask_was_saved = savemask; return 0; }
+weak_symbol (__sigjmp_save)
+
+void
+longjmp (jmp_buf env, int val) { __longjmp (env[0].__jmpbuf, val); }
+weak_symbol (longjmp)
+
+\f
+/* Define our own stub for the localization function used by strerror.
+   English-only in the dynamic linker keeps it smaller.  */
+
+char *
+__dgettext (const char *domainname, const char *msgid)
+{
+  assert (domainname == _libc_intl_domainname);
+  return (char *) msgid;
+}
+weak_symbol (__dgettext)
+weak_alias (__dgettext, dgettext)
+\f
+#ifndef NDEBUG
+
+/* Define (weakly) our own assert failure function which doesn't use stdio.
+   If we are linked into the user program (-ldl), the normal __assert_fail
+   defn can override this one.  */
+
+void
+__assert_fail (const char *assertion,
+              const char *file, unsigned int line, const char *function)
+{
+  char buf[64];
+  buf[sizeof buf - 1] = '\0';
+  _dl_sysdep_fatal ("BUG IN DYNAMIC LINKER ld.so: ",
+                   file, ": ", _itoa (line, buf + sizeof buf - 1, 10, 0),
+                   ": ", function ?: "", function ? ": " : "",
+                   "Assertion `", assertion, "' failed!\n",
+                   NULL);
+
+}
+weak_symbol (__assert_fail)
+
+void
+__assert_perror_fail (int errnum,
+                     const char *file, unsigned int line,
+                     const char *function)
+{
+  char buf[64];
+  buf[sizeof buf - 1] = '\0';
+  _dl_sysdep_fatal ("BUG IN DYNAMIC LINKER ld.so: ",
+                   file, ": ", _itoa (line, buf + sizeof buf - 1, 10, 0),
+                   ": ", function ?: "", function ? ": " : "",
+                   "Unexpected error: ", strerror (errnum), "\n", NULL);
+
+}
+weak_symbol (__assert_perror_fail)
+
+#endif
index cf9517d52749cea28a2ff1c1ed024fdc3ed1a20b..62d6488767efbe41548a17672e8f771cfc0c3f2e 100644 (file)
@@ -381,53 +381,3 @@ void
 _dl_r_debug_state (void)
 {
 }
-\f
-/* Define our own stub for the localization function used by strerror.
-   English-only in the dynamic linker keeps it smaller.  */
-
-char *
-__dgettext (const char *domainname, const char *msgid)
-{
-  assert (domainname == _libc_intl_domainname);
-  return (char *) msgid;
-}
-weak_symbol (__dgettext)
-weak_alias (__dgettext, dgettext)
-
-#ifndef NDEBUG
-
-/* Define (weakly) our own assert failure function which doesn't use stdio.
-   If we are linked into the user program (-ldl), the normal __assert_fail
-   defn can override this one.  */
-
-void
-__assert_fail (const char *assertion,
-              const char *file, unsigned int line, const char *function)
-{
-  char buf[64];
-  buf[sizeof buf - 1] = '\0';
-  _dl_sysdep_fatal ("BUG IN DYNAMIC LINKER ld.so: ",
-                   file, ": ", _itoa (line, buf + sizeof buf - 1, 10, 0),
-                   ": ", function ?: "", function ? ": " : "",
-                   "Assertion `", assertion, "' failed!\n",
-                   NULL);
-
-}
-weak_symbol (__assert_fail)
-
-void
-__assert_perror_fail (int errnum,
-                     const char *file, unsigned int line,
-                     const char *function)
-{
-  char buf[64];
-  buf[sizeof buf - 1] = '\0';
-  _dl_sysdep_fatal ("BUG IN DYNAMIC LINKER ld.so: ",
-                   file, ": ", _itoa (line, buf + sizeof buf - 1, 10, 0),
-                   ": ", function ?: "", function ? ": " : "",
-                   "Unexpected error: ", strerror (errnum), "\n", NULL);
-
-}
-weak_symbol (__assert_perror_fail)
-
-#endif
index 9e855ded562ddecb0295c01357a5350fc311343d..c73661973add631f1d004957ecdc16682f05175a 100644 (file)
@@ -617,6 +617,11 @@ vfprintf (s, format, ap)
   return done;
 }
 
+#ifdef USE_IN_LIBIO
+#undef vfprintf
+strong_alias (_IO_vfprintf, vfprintf)
+#endif
+
 
 /* Handle an unknown format specifier.  This prints out a canonicalized
    representation of the format spec itself.  */
index a3c058495e2a10efc6e5eff6ff4de555ca01a96a..a0bb63281c48addf2d13ffb5e4689f8bb61a126f 100644 (file)
@@ -98,10 +98,7 @@ _IO_vfscanf (s, format, argptr, errp)
      int *errp;
 #else
 int
-__vfscanf (s, format, arg)
-     FILE *s;
-     const char *format;
-     va_list argptr;
+__vfscanf (FILE *s, const char *format, va_list argptr)
 #endif
 {
   va_list arg = (va_list) argptr;
index f8997fe02556c242153d533f6bd8141833d0cf47..a2ffcd2e8cee53830943e195debc9e87fca16939 100644 (file)
@@ -535,62 +535,6 @@ weak_symbol (open)
 weak_symbol (close)
 weak_symbol (mmap)
 \f
-/* Minimal `malloc' allocator for use while loading shared libraries.
-   Only small blocks are allocated, and none are ever freed.  */
-
-void *
-malloc (size_t n)
-{
-  static vm_address_t ptr, end;
-  void *block;
-
-  if (end == 0)
-    {
-      /* Consume any unused space in the last page of our data segment.  */
-      extern char _end;
-      ptr = (vm_address_t) &_end;
-      end = round_page (ptr);
-    }
-
-  /* Make sure the allocation pointer is ideally aligned.  */
-  ptr += sizeof (double) - 1;
-  ptr &= ~(sizeof (double) - 1);
-
-  if (ptr + n >= end)
-    {
-      /* Insufficient space left; allocate another page.  */
-      vm_address_t page;
-      assert (n <= __vm_page_size);
-      __vm_allocate (__mach_task_self (), &page, __vm_page_size, 1);
-      if (page != end)
-       ptr = page;
-      end = page + __vm_page_size;
-    }
-
-  block = (void *) ptr;
-  ptr += n;
-  return block;
-}
-weak_symbol (malloc)
-
-/* This should never be called.  */
-void *realloc (void *ptr, size_t n) { ptr += n; abort (); }
-weak_symbol (realloc)
-
-/* This will rarely be called.  */
-void free (void *ptr) { ptr = ptr; }
-weak_symbol (free)
-\f
-/* Avoid signal frobnication in setjmp/longjmp.  */
-
-int __sigjmp_save (sigjmp_buf env, int savemask)
-{ env[0].__mask_was_saved = savemask; return 0; }
-weak_symbol (__sigjmp_save)
-
-void
-longjmp (jmp_buf env, int val) { __longjmp (env[0].__jmpbuf, val); }
-weak_symbol (longjmp)
-
 
 /* This function is called by interruptible RPC stubs.  For initial
    dynamic linking, just use the normal mach_msg.  Since this defn is
index 754ec5ef09e2475fbd29dd1bd9d6c9a27813a180..e54e311f236287d038f1b88d15c6e96402492a5c 100644 (file)
@@ -21,15 +21,7 @@ Cambridge, MA 02139, USA.  */
 .data
 .globl C_SYMBOL_NAME(__curbrk)
 C_LABEL(__curbrk)
-#ifdef PIC
-       .long 0
-#else
-# ifdef HAVE_GNU_LD
        .long C_SYMBOL_NAME(_end)
-# else
-       .long C_SYMBOL_NAME(end)
-# endif
-#endif
 
 .text
 
index 79933b90eb6c6cc285182b41d3d5481e018ac7d5..b6840d0b176036ddfc7193622eb22b678037a9a8 100644 (file)
@@ -17,4 +17,4 @@ 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.  */
 
-unsigned short ___fpu_control = 0;
+unsigned short __fpu_control = 0;
index 470e9608538459cae432d7193d106f7bd25b3c6e..8cf429264341c0d1c4c331eb5fad73d92731d1ae 100644 (file)
@@ -21,7 +21,7 @@ Boston, MA 02111-1307, USA.  */
 #define _FPU_CONTROL_H
 
 /* Here is the dirty part. Settup up your 387 through the control word
- * (cw) register. 
+ * (cw) register.
  *
  *     15-13    12  11-10  9-8     7-6     5    4    3    2    1    0
  * | reserved | IC | RC  | PC | reserved | PM | UM | OM | ZM | DM | IM
@@ -32,7 +32,7 @@ Boston, MA 02111-1307, USA.  */
  * OM: Overflow mask
  * UM: Underflow mask
  * PM: Precision (inexact result) mask
- * 
+ *
  * Mask bit is 1 means no interrupt.
  *
  * PC: Precision control
@@ -55,7 +55,7 @@ Boston, MA 02111-1307, USA.  */
 #include <features.h>
 
 /* masking of interrupts */
-#define _FPU_MASK_IM  0x01  
+#define _FPU_MASK_IM  0x01
 #define _FPU_MASK_DM  0x02
 #define _FPU_MASK_ZM  0x04
 #define _FPU_MASK_OM  0x08
@@ -82,13 +82,13 @@ Boston, MA 02111-1307, USA.  */
      - extended precision
      - rounding to nearest
      - exceptions on overflow, zero divide and NaN */
-#define _FPU_DEFAULT  0x1372 
+#define _FPU_DEFAULT  0x1372
 
 /* IEEE:  same as above, but exceptions */
 #define _FPU_IEEE     0x137f
 
 /* private namespace. It should only be used in init-first.o. */
-extern unsigned short ___fpu_control;
+extern unsigned short __fpu_control;
 
 __BEGIN_DECLS
 
index 4a0bf31e7c205e47b0bce557f33d86da55483cd0..41511547b20d44ccc6f4f8899d7fdae79afd6151 100644 (file)
@@ -19,4 +19,4 @@ Boston, MA 02111-1307, USA.  */
 
 #include <fpu_control.h>
 
-unsigned short ___fpu_control = _FPU_IEEE;
+unsigned short __fpu_control = _FPU_IEEE;
index 84b5ff9f2c9613321140e41ae27ac08951812b18..9ee3f77ef547952821e4ad4a50394730436f4ac6 100644 (file)
@@ -44,7 +44,7 @@ init (int *data)
        : : "a" (SYS_ify (personality)));
 
   /* Set the FPU control word to the proper default value.  */
-  __setfpucw (___fpu_control);
+  __setfpucw (__fpu_control);
 
   __environ = envp;
   __libc_init (argc, argv, envp);
index 0f05c84808ef1f34367d8678ff04aa101b709747..42f4854797d6e883ae7b9f58262db7080eb39cc1 100644 (file)
@@ -24,6 +24,7 @@ Cambridge, MA 02139, USA.  */
 
    ...and this place is here.  */
 .comm errno,4,4
+_errno = errno /* This name is expected by hj libc.so.5 startup code.  */
 
 /* The following code is not used at all in the shared library.
    The PIC system call stubs set errno themselves.  */
diff --git a/sysdeps/unix/sysv/linux/sockaddrcom.h b/sysdeps/unix/sysv/linux/sockaddrcom.h
deleted file mode 100644 (file)
index 768d05b..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Definition of `struct sockaddr_*' common members.  Generic/4.2 BSD version.
-Copyright (C) 1995 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., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#ifndef _SOCKADDRCOM_H
-#define _SOCKADDRCOM_H 1
-
-/* This prevents including the file <linux/socket.h>.  */
-#define _LINUX_SOCKET_H
-#define _LINUX_TYPES_H
-
-/* This macro is used to declare the initial common members
-   of the data types used for socket addresses, `struct sockaddr',
-   `struct sockaddr_in', `struct sockaddr_un', etc.  */
-
-#define        __SOCKADDR_COMMON(sa_prefix) \
-  unsigned short int sa_prefix##family
-
-#define __SOCKADDR_COMMON_SIZE (sizeof (unsigned short int))
-
-
-#endif /* sockaddrcom.h */
This page took 0.065466 seconds and 5 git commands to generate.