This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

glibc: Hurd dynamic linker fixes


Hi all,

I got the dynamic linker in the current (980703) snapshot of glibc
running under the Hurd.  The basic functionality is working, including
the debugging options via the LD_DEBUG environment variable.  Sending
the output to a arbitrary file via the LD_DEBUG_OUTPUT environment
variable does not work yet.  Some other bugs surely remain.

You will need the patch to {libio,stdio-common,stdio}/Versions I sent
earlier to libc-hacker and another patch for a special RPC stub for
io_write that I'll send seperately to be able to compile the thing.
And even then it will fail to link the sprof program.  But the dynamic
linker and shared libraries should be 

Mark

PS Uli, this is a rather big patch because I renamed
_dl_sysdep_{message,error,fatal,output} to
_dl_{message,error,fatal,output}, since they are no longer OS
specific.  If you have problems with this renaming please tell me so I
can generate a patch that doesn't do that.


1998-07-05  Mark Kettenis  <kettenis@phys.uva.nl>

	* sysdeps/mach/hurd/RPC_dl_io_write.c: New file.
	* sysdeps/mach/hurd/Makefile: Make $(objpxf)librtld.os depend on
	$(objpfx)RPC_dl_io_write.os.

	* elf/ldsodefs.h: Privide prototype for _dl_map_object_from_fd.
	* elf/rtld.c: Remove prototype for _dl_sysdep_read_whole_file.
	* sysdes/generic/dl-cache.c: Likewise.

	* elf/init-first.c [!PIC]: Conditionally define
	__hurd_threadvar_max, __hurd_threadvar_stack_offset,
	__hurd_threadvar_stack_mask.

	* elf/dl-misc.c: Do not include fcntl.h and sys/stat.h.
	(_dl_sysdep_open_zero_fill, _dl_sysdep_read_whole_file): Move to ...
	* sysdeps/generic/dl-sysdep.c: ... here.

	* hurd/hurdstartup.c: Move defenition of _hurd_init_dtable and
	_hurd_init_dtablesize ...
	* sysdeps/mach/hurd/dl-sysdep.c: ... to here ..
	* sysdeps/mach/hurd/i386/init-first.c [!PIC]: ... and here.

	* elf/ldsodefs.h (_dl_sysdep_output, _dl_sysdep_message,
	_dl_sysdep_error, _dl_sysdep_fatal): Rename to _dl_output,
	_dl_message, _dl_error and _dl_fatal.  All callers changed.
	* elf/Versions: Replace _dl_sysdep_output with _dl_output.

	* elf/dl-misc (_dl_output, _dl_debug_message): Call
	_dl_sysdep_write instead of __libc_write.
	* elf/ldsodefs.h: Provide prototype for _dl_sysdep_write.
	* sysdeps/generic/dl-sysdep.c (_dl_sysdep_write): New function.
	Wrapper around __libc_write.
	* sysdeps/mach/hurd/dl-sysdep.c (_dl_sysdep_write): New function.

	* libio/Versions: Move symbols whose source lives in
	stdio-common to ... 
	* stdio-common/Versions: ... here.
	* stdio/Versions: Add missing symbols.
	
1998-07-04  Mark Kettenis  <kettenis@phys.uva.nl>

	* elf/rtld.c (process_dl_debug): Add missing continue.

1998-06-23  Mark Kettenis  <kettenis@phys.uva.nl>
	* sysdeps/mach/hurd/dl-sysdep.c: Include <entry.h>.  Replace
	references to symbol start with macro ENTRY_POINT.
	(__hurd_sigthread_stack_base, __hurd_sigthread_stack_end,
	__hurd_sigthread_variables): Define to prevent inclusion of Hurd
	signal handling code.
	(_dl_sysdep_start): If the entry point passed by the
	__exec_startup_get_info RPC is the entry point of the dynamic
	linker itself, correct it for the load address of the dynamic
	linker.
	(__libc_read): New function.  Provide minimal functionality for
	use while loading shared libraries.
	(abort): Likewise.
	(__xstat): Likewise.
	(__getpid): Likewise.
	(__fxstat): New function.  Stub for use when loading shared
	libraries.
	(__lseek): Likewise.
	(__libc_write): Likewise.
	(_dl_sysdep_output): Removed.

1998-06-20  Mark Kettenis  <kettenis@phys.uva.nl>

	* sysdeps/mach/hurd/dl-sysdep.c: Define __libc_stack_end. 

1998-05-30  Mark Kettenis  <kettenis@phys.uva.nl>

	* elf/rtld.c (_dl_skip_args): Make global, since the Hurd specific
	startup code needs it.

	* sysdeps/mach/hurd/dl-sysdep.c (_dl_hwcap_mask): New variable.
	(_dl_show_auxv): Mark internal.
	(_dl_next_ld_env_entry, _dl_important_hwcaps): New functions.

1998-05-29  Mark Kettenis  <kettenis@phys.uva.nl>

	* sysdeps/mach/hurd/dl-sysdep.c: (_dl_sysdep_start): Call
        _dl_map_object_from_fd with additional	parameters set to 
        &_dl_rtld_map and lt_library.
	(_dl_sysdep_start): Complete prototype for _start.
	Remove _dl_sysdep_fatal, _dl_sysdep_error and _dl_sysdep_message.
	Add _dl_sysdep_output. 


Index: sysdeps/mach/hurd/dl-sysdep.c
--- 0.28/sysdeps/mach/hurd/dl-sysdep.c Fri, 29 May 1998 21:43:47 +0200 kettenis (libc/5_dl-sysdep. 1.1 640)
+++ local.47(w)/sysdeps/mach/hurd/dl-sysdep.c Sun, 05 Jul 1998 17:27:22 +0200 kettenis (libc/5_dl-sysdep. 1.8 640)
@@ -37,25 +37,38 @@
 #include <ctype.h>
 #include <sys/stat.h>
 
-#include "dl-machine.h"
+#include <entry.h>
+#include <dl-machine.h>
+#include <dl-procinfo.h>
 
 extern void __mach_init (void);
 
 extern int _dl_argc;
 extern char **_dl_argv;
 extern char **_environ;
+extern void ENTRY_POINT (void);
 
-uid_t __libc_uid;
 int __libc_enable_secure;
 
+/* This variable containts the lowest stack address ever used.  */
+void *__libc_stack_end;
+unsigned long int _dl_hwcap_mask = HWCAP_IMPORTANT;
+
 struct hurd_startup_data *_dl_hurd_data;
 
+unsigned long int __hurd_sigthread_stack_base;
+unsigned long int __hurd_sigthread_stack_end;
+unsigned long int *__hurd_sigthread_variables;
+
 unsigned int __hurd_threadvar_max = _HURD_THREADVAR_MAX;
 static unsigned long int threadvars[_HURD_THREADVAR_MAX];
 unsigned long int __hurd_threadvar_stack_offset
   = (unsigned long int) &threadvars;
 unsigned long int __hurd_threadvar_stack_mask;
 
+mach_port_t *_hurd_init_dtable;
+mach_msg_type_number_t _hurd_init_dtablesize;
+
 /* XXX loser kludge for vm_map kernel bug */
 static vm_address_t fmha;
 static vm_size_t fmhs;
@@ -86,8 +99,6 @@
 		  void (*dl_main) (const Elf32_Phdr *phdr, Elf32_Word phent,
 				   Elf32_Addr *user_entry))
 {
-  extern void _start ();
-
   void go (int *argdata)
     {
       extern unsigned int _dl_skip_args; /* rtld.c */
@@ -103,21 +114,26 @@
 	{
 	  static struct hurd_startup_data nodata;
 	  _dl_hurd_data = &nodata;
-	  nodata.user_entry = (vm_address_t) &_start;
+	  nodata.user_entry = (vm_address_t) &ENTRY_POINT;
 	}
       else
 	_dl_hurd_data = (void *) p;
 
-      __libc_uid = __getuid ();
       __libc_enable_secure = _dl_hurd_data->flags & EXEC_SECURE;
 
       if (_dl_hurd_data->flags & EXEC_STACK_ARGS &&
 	  _dl_hurd_data->user_entry == 0)
-	_dl_hurd_data->user_entry = (vm_address_t) &_start;
+	_dl_hurd_data->user_entry = (vm_address_t) &ENTRY_POINT;
 
+      /* If we were invoked directly, the entry point should be
+         corrected for the load address.  */
+      if (_dl_hurd_data->user_entry ==
+	  (vm_address_t) (&ENTRY_POINT - _dl_rtld_map.l_addr))
+	_dl_hurd_data->user_entry = (vm_address_t) &ENTRY_POINT;
+	  
 unfmh();			/* XXX */
 
-      if (_dl_hurd_data->user_entry == (vm_address_t) &_start)
+      if (_dl_hurd_data->user_entry == (vm_address_t) &ENTRY_POINT)
 	/* We were invoked as a command, not as the program interpreter.
 	   The generic ld.so code supports this: it will parse the args
 	   as "ld.so PROGRAM [ARGS...]".  For booting the Hurd, we
@@ -140,7 +156,7 @@
 
 	    memobjname = strchr (p, '=');
 	    if (! memobjname)
-	      _dl_sysdep_fatal ("Bogus library spec: ", p, "\n", NULL);
+	      _dl_fatal ("Bogus library spec: ", p, "\n", NULL);
 	    *memobjname++ = '\0';
 	    memobj = 0;
 	    while (*memobjname != '\0')
@@ -155,7 +171,8 @@
 
 	    lastslash = strrchr (p, '/');
 	    l = _dl_map_object_from_fd (lastslash ? lastslash + 1 : p,
-					memobj, strdup (p));
+					memobj, strdup (p),
+					&_dl_rtld_map, lt_library);
 
 	    /* Squirrel away the memory object port where it
 	       can be retrieved by the program later.  */
@@ -214,7 +231,9 @@
   __mig_dealloc_reply_port (MACH_PORT_NULL);
   __mach_port_deallocate (__mach_task_self (), __mach_task_self_);
 }
+
 
+
 /* Minimal open/close/mmap implementation sufficient for initial loading of
    shared libraries.  These are weak definitions so that when the
    dynamic linker re-relocates itself to be user-visible (for -ldl),
@@ -473,6 +492,40 @@
   return 0;
 }
 
+/* Read NBYTES into BUF from FD.  Return the number read or -1.  Since
+   FD is not a real file descroptor, but a memory object port we use
+   mapped memory to read the contents of the file.  */
+ssize_t weak_function
+__libc_read (int fd, void *buf, size_t nbytes)
+{
+  vm_address_t mapaddr;
+  error_t err;
+
+  mapaddr = (vm_address_t) 0;
+  err = __vm_map (__mach_task_self (), &mapaddr, (vm_size_t) nbytes,
+		  (vm_address_t) 0, 1, (mach_port_t) fd, (vm_offset_t) 0,
+		  1, VM_PROT_READ, VM_PROT_ALL, VM_INHERIT_NONE);
+  if (err)
+    return -1;
+
+  memcpy (buf, (void *) mapaddr, nbytes);
+  __vm_deallocate (__mach_task_self (), mapaddr, nbytes);
+  
+  return nbytes;
+}
+
+/* We cannot open files for writing.  For writing to standard
+   input/output/error, use _dl_sysdep_write.  */
+ssize_t weak_function
+__libc_write (int fd, void *buf, size_t nbytes)
+{
+  _dl_error ("\
+The function `__libc_write' is not available during initial loading of\n\
+shared libraries.\n",
+		    NULL);
+  return -1;
+}
+
 __ptr_t weak_function
 __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
 {
@@ -516,20 +569,12 @@
   return err ? (__ptr_t) __hurd_fail (err) : (__ptr_t) mapaddr;
 }
 
-void weak_function
-_exit (int status)
-{
-  __proc_mark_exit (_dl_hurd_data->portarray[INIT_PORT_PROC],
-		    W_EXITCODE (status, 0), 0);
-  while (__task_terminate (__mach_task_self ()))
-    __mach_task_self_ = (__mach_task_self) ();
-}
 
+
 /* Read the whole contents of FILE into new mmap'd space with given
-   protections.  The size of the file is returned in SIZE.  */
+   protections.  The size of the file is returned in SIZEP.  */
 void *
-weak_function
-_dl_sysdep_read_whole_file (const char *file, size_t *size, int prot)
+_dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot)
 {
   struct stat stat;
   mach_port_t memobj_rd;
@@ -543,7 +588,7 @@
       if (contents == (void *)-1)
 	contents = 0;
       else
-	*size = stat.st_size;
+	*sizep = stat.st_size;
 
       __mach_port_deallocate (__mach_task_self (), memobj_rd);
     }
@@ -555,7 +600,145 @@
 
   return contents;
 }
+
+
+/* Write NBYTES from BUF to FD.  */
+ssize_t weak_function
+_dl_sysdep_write (int fd, const void *buf, size_t nbytes)
+{
+  static spin_lock_t lock = SPIN_LOCK_INITIALIZER;
+  ssize_t result = -1;
+
+  /* We should not be called recursively.  If that happens it is
+     almost certainly because we're printing a lookup debug message
+     for one of the symbols that we use ourselves.  */
+  /* FIXME: Does this work for multithreaded programs?.  */
+  if (spin_try_lock (&lock))
+    {
+      if (_hurd_init_dtable)
+	{
+	  mach_msg_type_number_t nwrote;
+	  error_t err;
+	  
+	  err = __io_write (_hurd_init_dtable[fd], buf, nbytes, -1, &nwrote);
+	  if (! err)
+	    result = nwrote;
+	}
+      else
+	result = __libc_write (fd, buf, nbytes);
+
+      spin_unlock (&lock);
+    }
+  
+  return result;
+}
+
 
+
+void weak_function
+_exit (int status)
+{
+  __proc_mark_exit (_dl_hurd_data->portarray[INIT_PORT_PROC],
+		    W_EXITCODE (status, 0), 0);
+  while (__task_terminate (__mach_task_self ()))
+    __mach_task_self_ = (__mach_task_self) ();
+}
+
+/* Try to get a machine dependent instruction which will make the
+   program crash.  This is used in case everything else fails.  */
+#include <abort-instr.h>
+#ifndef ABORT_INSTRUCTION
+/* No such instruction is available.  */
+# define ABORT_INSTRUCTION
+#endif
+
+/* We must avoid to run in circles.  Therefore we remember how far we
+   already got.  */
+static int stage;
+
+/* Cause an abnormal program termination.  */
+void weak_function
+abort (void)
+{
+  /* We want to avoid stages 0-5 in this minimal implementation.  */
+  if (stage == 0)
+    stage = 6;
+
+  /* Now try to abort using the system specific command.  */
+  if (stage == 6)
+    {
+      ++stage;
+      ABORT_INSTRUCTION;
+    }
+
+  /* If we can't signal ourselves and the abort instruction failed, exit.  */
+  if (stage == 7)
+    {
+      ++stage;
+      _exit (127);
+    }
+
+  /* If even this fails try to use the provided instruction to crash
+     or otherwise make sure we never return.  */
+  while (1)
+    /* Try for ever and ever.  */
+    ABORT_INSTRUCTION;
+}
+
+int weak_function
+__xstat (int vers, const char *file, struct stat *buf)
+{
+  mach_port_t memobj_stat;
+  
+  assert (vers == _STAT_VER);
+
+  if (open_file (file, 0, &memobj_stat, buf))
+    return -1;
+
+  if (memobj_stat != MACH_PORT_NULL)
+    __mach_port_deallocate (__mach_task_self (), memobj_stat);
+
+  return 0;
+}
+
+pid_t weak_function
+__getpid ()
+{
+  pid_t pid, ppid;
+  int orphaned;
+  
+  if (__proc_getpids (_dl_hurd_data->portarray[INIT_PORT_PROC],
+		      &pid, &ppid, &orphaned))
+    return -1;
+
+  return pid;
+}
+
+int weak_function
+__fxstat (int vers, int fd, struct stat *buf)
+{
+  _dl_error ("\
+The function `__fxstat' is not available during initial loading of shared\n\
+libraries.\n",
+		    NULL);
+  return -1;
+}
+
+/* Since FD is not a real file descriptor, but a memory object port
+   we, files are not seekable.  */
+off_t weak_function
+__lseek (fd, offset, whence)
+     int fd;
+     off_t offset;
+     int whence;
+{
+  _dl_error ("\
+The function `__lseek' is not available during initial loading of shared\n\
+libraries.\n",
+		    NULL);
+  return (off_t) -1;
+}
+
 /* This function is called by interruptible RPC stubs.  For initial
    dynamic linking, just use the normal mach_msg.  Since this defn is
    weak, the real defn in libc.so will override it if we are linked into
@@ -576,77 +759,208 @@
 
 
 void
+internal_function
 _dl_show_auxv (void)
 {
   /* There is nothing to print.  Hurd has no auxiliary vector.  */
 }
 
-void weak_function
-_dl_sysdep_fatal (const char *msg, ...)
-{
-  va_list ap;
+/* Walk through the environment of the process and return all entries
+   starting with `LD_'.  */
+/* FIXME: identical to the function in `sysdeps/generic/dl-sysdep.c'.
+   Should probably be moved to one of the files in `elf/'.  */
+char *
+internal_function
+_dl_next_ld_env_entry (char ***position)
+{
+  char **current = *position;
+  char *result = NULL;
+
+  if (current == NULL)
+    /* We start over.  */
+    current = _environ;
 
-  va_start (ap, msg);
-  do
+  while (result == NULL && *current != NULL)
     {
-      size_t len = strlen (msg);
-      mach_msg_type_number_t nwrote;
-      do
-	{
-	  if (__io_write (_hurd_init_dtable[2], msg, len, -1, &nwrote))
-	    break;
-	  len -= nwrote;
-	  msg += nwrote;
-	} while (nwrote > 0);
-      msg = va_arg (ap, const char *);
-    } while (msg);
-  va_end (ap);
+      if ((*current)[0] == 'L' && (*current)[1] == 'D' && (*current)[2] == '_')
+	result = *current;
+
+      ++current;
+    }
+
+  /* Save current position for next visit.  */
+  *position = current;
 
-  _exit (127);
+  return result;
 }
 
+/* Return an array of useful/necessary hardware capability names.  */
+/* FIXME: identical to the function in `sysdeps/generic/dl-sysdep.c'.
+   Should probably be moved to one of the files in `elf/'.  */
+const struct r_strlenpair *
+internal_function
+_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz,
+		      size_t *max_capstrlen)
+{
+  /* Determine how many important bits are set.  */
+  unsigned long int masked = _dl_hwcap & _dl_hwcap_mask;
+  size_t cnt = platform != NULL;
+  size_t n, m;
+  size_t total;
+  struct r_strlenpair *temp;
+  struct r_strlenpair *result;
+  struct r_strlenpair *rp;
+  char *cp;
+
+  /* Count the number of bits set in the masked value.  */
+  for (n = 0; (~((1UL << n) - 1) & masked) != 0; ++n)
+    if ((masked & (1UL << n)) != 0)
+      ++cnt;
 
-void weak_function
-_dl_sysdep_error (const char *msg, ...)
-{
-  va_list ap;
+  if (cnt == 0)
+    {
+      /* If we have platform name and no important capability we only have
+	 the base directory to search.  */
+      result = (struct r_strlenpair *) malloc (sizeof (*result));
+      if (result == NULL)
+	{
+	no_memory:
+	  _dl_signal_error (ENOMEM, NULL, "cannot create capability list");
+	}
 
-  va_start (ap, msg);
-  do
+      result[0].str = (char *) result;	/* Does not really matter.  */
+      result[0].len = 0;
+
+      *sz = 1;
+      return result;
+    }
+
+  /* Create temporary data structure to generate result table.  */
+  temp = (struct r_strlenpair *) alloca (cnt * sizeof (*temp));
+  m = 0;
+  for (n = 0; masked != 0; ++n)
+    if ((masked & (1UL << n)) != 0)
+      {
+	temp[m].str = _dl_hwcap_string (n);
+	temp[m].len = strlen (temp[m].str);
+	masked ^= 1UL << n;
+	++m;
+      }
+  if (platform != NULL)
+    {
+      temp[m].str = platform;
+      temp[m].len = platform_len;
+      ++m;
+    }
+
+  /* Determine the total size of all strings together.  */
+  if (cnt == 1)
+    total = temp[0].len;
+  else
+    {
+      total = (1 << (cnt - 2)) * (temp[0].len + temp[cnt - 1].len + 2);
+      for (n = 1; n + 1 < cnt; ++n)
+	total += (1 << (cnt - 3)) * (temp[n].len + 1);
+    }
+
+  /* The result structure: we use a very compressed way to store the
+     various combinations of capability names.  */
+  *sz = 1 << cnt;
+  result = (struct r_strlenpair *) malloc (*sz * sizeof (*result) + total);
+  if (result == NULL)
+    goto no_memory;
+
+  if (cnt == 1)
+    {
+      result[0].str = (char *) (result + *sz);
+      result[0].len = temp[0].len + 1;
+      result[1].str = (char *) (result + *sz);
+      result[1].len = 0;
+      cp = __mempcpy ((char *) (result + *sz), temp[0].str, temp[0].len);
+      *cp = '/';
+      *sz = 2;
+      *max_capstrlen = result[0].len;
+
+      return result;
+    }
+
+  /* Fill in the information.  This follows the following scheme
+     (indeces from TEMP for four strings):
+	entry #0: 0, 1, 2, 3	binary: 1111
+	      #1: 0, 1, 3	        1101
+	      #2: 0, 2, 3	        1011
+	      #3: 0, 3		        1001
+     This allows to represent all possible combinations of capability
+     names in the string.  First generate the strings.  */
+  result[1].str = result[0].str = cp = (char *) (result + *sz);
+#define add(idx) \
+      cp = __mempcpy (__mempcpy (cp, temp[idx].str, temp[idx].len), "/", 1);
+  if (cnt == 2)
+    {
+      add (1);
+      add (0);
+    }
+  else
     {
-      size_t len = strlen (msg);
-      mach_msg_type_number_t nwrote;
+      n = 1 << cnt;
       do
 	{
-	  if (__io_write (_hurd_init_dtable[2], msg, len, -1, &nwrote))
-	    break;
-	  len -= nwrote;
-	  msg += nwrote;
-	} while (nwrote > 0);
-      msg = va_arg (ap, const char *);
-    } while (msg);
-  va_end (ap);
-}
+	  n -= 2;
 
+	  /* We always add the last string.  */
+	  add (cnt - 1);
 
-void weak_function
-_dl_sysdep_message (const char *msg, ...)
-{
-  va_list ap;
+	  /* Add the strings which have the bit set in N.  */
+	  for (m = cnt - 2; m > 0; --m)
+	    if ((n & (1 << m)) != 0)
+	      add (m);
+
+	  /* Always add the first string.  */
+	  add (0);
+	}
+      while (n != 0);
+    }
+#undef add
 
-  va_start (ap, msg);
+  /* Now we are ready to install the string pointers and length.  */
+  for (n = 0; n < (1 << cnt); ++n)
+    result[n].len = 0;
+  n = cnt;
   do
     {
-      size_t len = strlen (msg);
-      mach_msg_type_number_t nwrote;
-      do
-	{
-	  if (__io_write (_hurd_init_dtable[1], msg, len, -1, &nwrote))
-	    break;
-	  len -= nwrote;
-	  msg += nwrote;
-	} while (nwrote > 0);
-      msg = va_arg (ap, const char *);
-    } while (msg);
-  va_end (ap);
+      size_t mask = 1 << --n;
+
+      rp = result;
+      for (m = 1 << cnt; m > 0; ++rp)
+	if ((--m & mask) != 0)
+	  rp->len += temp[n].len + 1;
+    }
+  while (n != 0);
+
+  /* The first half of the strings all include the first string.  */
+  n = (1 << cnt) - 2;
+  rp = &result[2];
+  while (n != (1 << (cnt - 1)))
+    {
+      if ((n & 1) != 0)
+	rp[0].str = rp[-2].str + rp[-2].len;
+      else
+	rp[0].str = rp[-1].str;
+      ++rp;
+      --n;
+    }
+
+  /* The second have starts right after the first part of the string of
+     corresponding entry in the first half.  */
+  do
+    {
+      rp[0].str = rp[-(1 << (cnt - 1))].str + temp[cnt - 1].len + 1;
+      ++rp;
+    }
+  while (--n != 0);
+
+  /* The maximum string length.  */
+  *max_capstrlen = result[0].len;
+
+  return result;
 }
Index: sysdeps/generic/dl-sysdep.c
--- 0.28/sysdeps/generic/dl-sysdep.c Sat, 20 Jun 1998 12:42:04 +0200 kettenis (libc/7_dl-sysdep. 1.2 640)
+++ local.47(w)/sysdeps/generic/dl-sysdep.c Sat, 04 Jul 1998 16:11:25 +0200 kettenis (libc/7_dl-sysdep. 1.2 640)
@@ -171,6 +171,58 @@
 {
 }
 
+#ifndef MAP_ANON
+/* This is the only dl-sysdep.c function that is actually needed at run-time
+   by _dl_map_object.  */
+int
+_dl_sysdep_open_zero_fill (void)
+{
+  return __open ("/dev/zero", O_RDONLY);
+}
+#endif
+
+/* Read the whole contents of FILE into new mmap'd space with given
+   protections.  The size of the file is returned in *SIZEP.  */
+void *
+_dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot)
+{
+  void *result;
+  struct stat st;
+  int fd = __open (file, O_RDONLY);
+  if (fd < 0)
+    return NULL;
+  if (__fxstat (_STAT_VER, fd, &st) < 0
+      /* No need to map the file if it is empty.  */
+      || st.st_size == 0)
+    result = NULL;
+  else
+    {
+      /* Map a copy of the file contents.  */
+      result = __mmap (0, st.st_size, prot,
+#ifdef MAP_COPY
+                       MAP_COPY
+#else
+                       MAP_PRIVATE
+#endif
+#ifdef MAP_FILE
+                       | MAP_FILE
+#endif
+                       , fd, 0);
+      if (result == MAP_FAILED)
+        result = NULL;
+      else
+        *sizep = st.st_size;
+    }
+  __close (fd);
+  return result;
+}
+
+ssize_t
+_dl_sysdep_write (int fd, const void *buf, size_t nbytes)
+{
+  return __libc_write (fd, buf, nbytes);
+}
+
 void
 internal_function
 _dl_show_auxv (void)
@@ -185,69 +237,59 @@
     switch (av->a_type)
       {
       case AT_PHDR:
-	_dl_sysdep_message ("AT_PHDR:     0x",
-			    _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
-					16, 0),
-			    "\n", NULL);
+	_dl_message ("AT_PHDR:     0x",
+		     _itoa_word (av->a_un.a_val, buf + sizeof buf - 1, 16, 0),
+		     "\n", NULL);
 	break;
       case AT_PHNUM:
-	_dl_sysdep_message ("AT_PHNUM:    ",
-			    _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
-					10, 0),
-			    "\n", NULL);
+	_dl_message ("AT_PHNUM:    ",
+		     _itoa_word (av->a_un.a_val, buf + sizeof buf - 1, 10, 0),
+		     "\n", NULL);
 	break;
       case AT_PAGESZ:
-	_dl_sysdep_message ("AT_PAGESZ:   ",
-			    _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
-					10, 0),
-			    "\n", NULL);
+	_dl_message ("AT_PAGESZ:   ",
+		     _itoa_word (av->a_un.a_val, buf + sizeof buf - 1, 10, 0),
+		     "\n", NULL);
 	break;
       case AT_ENTRY:
-	_dl_sysdep_message ("AT_ENTRY:    0x",
-			    _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
-					16, 0),
+	_dl_message ("AT_ENTRY:    0x",
+		     _itoa_word (av->a_un.a_val, buf + sizeof buf - 1, 16, 0),
 			    "\n", NULL);
 	break;
       case AT_BASE:
-	_dl_sysdep_message ("AT_BASE:     0x",
-			    _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
-					16, 0),
-			    "\n", NULL);
+	_dl_message ("AT_BASE:     0x",
+		     _itoa_word (av->a_un.a_val, buf + sizeof buf - 1, 16, 0),
+		     "\n", NULL);
 	break;
       case AT_UID:
-	_dl_sysdep_message ("AT_UID:      ",
-			    _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
-					10, 0),
-			    "\n", NULL);
+	_dl_message ("AT_UID:      ",
+		     _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,10, 0),
+		     "\n", NULL);
 	break;
       case AT_GID:
-	_dl_sysdep_message ("AT_GID:      ",
-			    _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
-					10, 0),
-			    "\n", NULL);
+	_dl_message ("AT_GID:      ",
+		     _itoa_word (av->a_un.a_val, buf + sizeof buf - 1, 10, 0),
+		     "\n", NULL);
 	break;
       case AT_EUID:
-	_dl_sysdep_message ("AT_EUID:     ",
-			    _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
-					10, 0),
-			    "\n", NULL);
+	_dl_message ("AT_EUID:     ",
+		     _itoa_word (av->a_un.a_val, buf + sizeof buf - 1, 10, 0),
+		     "\n", NULL);
 	break;
       case AT_EGID:
-	_dl_sysdep_message ("AT_EGID:     ",
-			    _itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
-					10, 0),
-			    "\n", NULL);
+	_dl_message ("AT_EGID:     ",
+		     _itoa_word (av->a_un.a_val, buf + sizeof buf - 1, 10, 0),
+		     "\n", NULL);
 	break;
       case AT_PLATFORM:
-	_dl_sysdep_message ("AT_PLATFORM: ", av->a_un.a_ptr, "\n", NULL);
+	_dl_message ("AT_PLATFORM: ", av->a_un.a_ptr, "\n", NULL);
 	break;
       case AT_HWCAP:
 	_dl_hwcap = av->a_un.a_val;
 	if (_dl_procinfo (_dl_hwcap) < 0)
-	  _dl_sysdep_message ("AT_HWCAP:    ",
-			      _itoa_word (_dl_hwcap, buf + sizeof buf - 1,
-					  16, 0),
-			      "\n", NULL);
+	  _dl_message ("AT_HWCAP:    ",
+		       _itoa_word (_dl_hwcap, buf + sizeof buf - 1, 16, 0),
+		       "\n", NULL);
 	break;
       }
 }
Index: elf/dl-misc.c
--- 0.28/elf/dl-misc.c Tue, 30 Jun 1998 19:58:39 +0200 kettenis (libc/8_dl-misc.c 1.2 640)
+++ local.47(w)/elf/dl-misc.c Sat, 04 Jul 1998 17:21:11 +0200 kettenis (libc/8_dl-misc.c 1.2 640)
@@ -18,74 +18,24 @@
    Boston, MA 02111-1307, USA.  */
 
 #include <assert.h>
-#include <fcntl.h>
 #include <unistd.h>
 #include <stdarg.h>
 #include <string.h>
 #include <unistd.h>
 #include <sys/mman.h>
-#include <sys/stat.h>
+#include <elf/ldsodefs.h>
 #include <stdio-common/_itoa.h>
 
-/* We have prototype anywhere.  */
-extern ssize_t __libc_write __P ((int __fd, __const __ptr_t __buf,
-				  size_t __n));
-
-#ifndef MAP_ANON
-/* This is the only dl-sysdep.c function that is actually needed at run-time
-   by _dl_map_object.  */
-
-int
-_dl_sysdep_open_zero_fill (void)
-{
-  return __open ("/dev/zero", O_RDONLY);
-}
-#endif
-
-/* Read the whole contents of FILE into new mmap'd space with given
-   protections.  *SIZEP gets the size of the file.  */
-
-void *
-_dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot)
-{
-  void *result;
-  struct stat st;
-  int fd = __open (file, O_RDONLY);
-  if (fd < 0)
-    return NULL;
-  if (__fxstat (_STAT_VER, fd, &st) < 0
-      /* No need to map the file if it is empty.  */
-      || st.st_size == 0)
-    result = NULL;
-  else
-    {
-      /* Map a copy of the file contents.  */
-      result = __mmap (0, st.st_size, prot,
-#ifdef MAP_COPY
-                       MAP_COPY
-#else
-                       MAP_PRIVATE
-#endif
-#ifdef MAP_FILE
-                       | MAP_FILE
-#endif
-                       , fd, 0);
-      if (result == MAP_FAILED)
-        result = NULL;
-      else
-        *sizep = st.st_size;
-    }
-  __close (fd);
-  return result;
-}
-
 
 /* Descriptor to write debug messages to.  */
-int _dl_debug_fd = 2;
+int _dl_debug_fd = STDERR_FILENO;
 
 
+/* Write a message on the specified descriptor FD.  All arguments are
+   `const char *'; args until a null pointer are concatenated to form
+   the message to print.  */
 void
-_dl_sysdep_output (int fd, const char *msg, ...)
+_dl_output (int fd, const char *msg, ...)
 {
   va_list ap;
 
@@ -93,14 +43,17 @@
   do
     {
       size_t len = strlen (msg);
-      __libc_write (fd, msg, len);
+      _dl_sysdep_write (fd, msg, len);
       msg = va_arg (ap, const char *);
     }
   while (msg != NULL);
   va_end (ap);
 }
 
-
+/* Write a debug message to `_dl_debug_fd'.  All arguments are `const
+   char *'; args until a null pointer are concatenated to form the
+   message to print.  If NEW_LINE is nonzero it is assumed that the
+   message starts on a new line.*/
 void
 _dl_debug_message (int new_line, const char *msg, ...)
 {
@@ -132,19 +85,19 @@
 	      *--p = '0';
 	    buf[5] = ':';
 	    buf[6] = '\t';
-	    __libc_write (_dl_debug_fd, buf, 7);
+	    _dl_sysdep_write (_dl_debug_fd, buf, 7);
 	    new_line = 0;
 	  }
 
 	endp = msg + strcspn (msg, "\n");
 	if (*endp == '\0')
 	  {
-	    __libc_write (_dl_debug_fd, msg, endp - msg);
+	    _dl_sysdep_write (_dl_debug_fd, msg, endp - msg);
 	    msg = va_arg (ap, const char *);
 	  }
 	else
 	  {
-	    __libc_write (_dl_debug_fd, msg, endp - msg + 1);
+	    _dl_sysdep_write (_dl_debug_fd, msg, endp - msg + 1);
 	    msg = endp + 1;
 	    new_line = 1;
 	  }
Index: elf/rtld.c
--- 0.28/elf/rtld.c Fri, 03 Jul 1998 19:07:12 +0200 kettenis (libc/11_rtld.c 1.1.1.1.1.1.1.1 640)
+++ local.47(w)/elf/rtld.c Sat, 04 Jul 1998 16:41:50 +0200 kettenis (libc/11_rtld.c 1.1.1.1.1.1.1.2 640)
@@ -40,12 +40,6 @@
 						     ElfW(Addr) *user_entry));
 extern void _dl_sysdep_start_cleanup (void);
 
-/* System-dependent function to read a file's whole contents
-   in the most convenient manner available.  */
-extern void *_dl_sysdep_read_whole_file (const char *filename,
-					 size_t *filesize_ptr,
-					 int mmap_prot);
-
 /* Helper function to handle errors while resolving symbols.  */
 static void print_unresolved (int errcode, const char *objname,
 			      const char *errsting);
@@ -65,6 +59,7 @@
 
 int _dl_argc;
 char **_dl_argv;
+unsigned int _dl_skip_args;	/* Nonzero if we were run directly.  */
 const char *_dl_rpath;
 int _dl_verbose;
 const char *_dl_platform;
@@ -268,7 +263,6 @@
   return 0;
 }
 
-static unsigned int _dl_skip_args;	/* Nonzero if we were run directly.  */
 static const char *library_path;	/* The library search path.  */
 static const char *preloadlist;		/* The list preloaded objects.  */
 static int version_info;		/* Nonzero if information about
@@ -358,7 +352,7 @@
       /* If we have no further argument the program was called incorrectly.
 	 Grant the user some education.  */
       if (_dl_argc < 2)
-	_dl_sysdep_fatal ("\
+	_dl_fatal ("\
 Usage: ld.so [OPTION]... EXECUTABLE-FILE [ARGS-FOR-PROGRAM...]\n\
 You have invoked `ld.so', the helper program for shared library executables.\n\
 This program usually lives in the file `/lib/ld.so', and special directives\n\
@@ -417,7 +411,7 @@
 	 This will be what dlopen on "" returns.  */
       main_map = _dl_new_object ((char *) "", "", lt_executable);
       if (main_map == NULL)
-	_dl_sysdep_fatal ("cannot allocate memory for link map\n", NULL);
+	_dl_fatal ("cannot allocate memory for link map\n", NULL);
       main_map->l_phdr = phdr;
       main_map->l_phnum = phent;
       main_map->l_entry = *user_entry;
@@ -690,7 +684,7 @@
 	 functions we call below for output may no longer work properly
 	 after relocation.  */
       if (! _dl_loaded->l_info[DT_NEEDED])
-	_dl_sysdep_message ("\t", "statically linked\n", NULL);
+	_dl_message ("\t", "statically linked\n", NULL);
       else
 	{
 	  struct link_map *l;
@@ -698,8 +692,7 @@
 	  for (l = _dl_loaded->l_next; l; l = l->l_next)
 	    if (l->l_opencount == 0)
 	      /* The library was not found.  */
-	      _dl_sysdep_message ("\t", l->l_libname->name, " => not found\n",
-				  NULL);
+	      _dl_message ("\t", l->l_libname->name, " => not found\n", NULL);
 	    else
 	      {
 		char buf[20], *bp;
@@ -708,8 +701,8 @@
 		while ((size_t) (&buf[sizeof buf - 1] - bp)
 		       < sizeof l->l_addr * 2)
 		  *--bp = '0';
-		_dl_sysdep_message ("\t", l->l_libname->name, " => ",
-				    l->l_name, " (0x", bp, ")\n", NULL);
+		_dl_message ("\t", l->l_libname->name, " => ",
+			     l->l_name, " (0x", bp, ")\n", NULL);
 	      }
 	}
 
@@ -726,12 +719,12 @@
 	    bp = _itoa_word (ref->st_value, &buf[sizeof buf - 1], 16, 0);
 	    while ((size_t) (&buf[sizeof buf - 1] - bp) < sizeof loadbase * 2)
 	      *--bp = '0';
-	    _dl_sysdep_message (_dl_argv[i], " found at 0x", bp, NULL);
+	    _dl_message (_dl_argv[i], " found at 0x", bp, NULL);
 	    buf[sizeof buf - 1] = '\0';
 	    bp = _itoa_word (loadbase, &buf[sizeof buf - 1], 16, 0);
 	    while ((size_t) (&buf[sizeof buf - 1] - bp) < sizeof loadbase * 2)
 	      *--bp = '0';
-	    _dl_sysdep_message (" in object at 0x", bp, "\n", NULL);
+	    _dl_message (" in object at 0x", bp, "\n", NULL);
 	  }
       else
 	{
@@ -782,13 +775,13 @@
 
 		  if (first)
 		    {
-		      _dl_sysdep_message ("\n\tVersion information:\n", NULL);
+		      _dl_message ("\n\tVersion information:\n", NULL);
 		      first = 0;
 		    }
 
-		  _dl_sysdep_message ("\t", (map->l_name[0]
-					     ? map->l_name : _dl_argv[0]),
-				      ":\n", NULL);
+		  _dl_message ("\t", (map->l_name[0]
+				      ? map->l_name : _dl_argv[0]),
+			       ":\n", NULL);
 
 		  while (1)
 		    {
@@ -802,21 +795,16 @@
 			{
 			  const char *fname = NULL;
 
-			  _dl_sysdep_message ("\t\t",
-					      strtab + ent->vn_file,
-					      " (", strtab + aux->vna_name,
-					      ") ",
-					      (aux->vna_flags
-					       & VER_FLG_WEAK
-					       ? "[WEAK] " : ""),
-					      "=> ", NULL);
+			  _dl_message ("\t\t", strtab + ent->vn_file,
+				       " (", strtab + aux->vna_name, ") ",
+				       (aux->vna_flags & VER_FLG_WEAK
+					? "[WEAK] " : ""), "=> ", NULL);
 
 			  if (needed != NULL
 			      && match_version (strtab+aux->vna_name, needed))
 			    fname = needed->l_name;
 
-			  _dl_sysdep_message (fname ?: "not found", "\n",
-					      NULL);
+			  _dl_message (fname ?: "not found", "\n", NULL);
 
 			  if (aux->vna_next == 0)
 			    /* No more symbols.  */
@@ -934,7 +922,7 @@
 {
   if (objname[0] == '\0')
     objname = _dl_argv[0] ?: "<main program>";
-  _dl_sysdep_error (errstring, "	(", objname, ")\n", NULL);
+  _dl_error (errstring, "	(", objname, ")\n", NULL);
 }
 
 /* This is a little helper function for resolving symbols while
@@ -943,8 +931,8 @@
 print_missing_version (int errcode __attribute__ ((unused)),
 		       const char *objname, const char *errstring)
 {
-  _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>", ": ",
-		    objname, ": ", errstring, "\n", NULL);
+  _dl_error (_dl_argv[0] ?: "<program name unknown>", ": ",
+	     objname, ": ", errstring, "\n", NULL);
 }
 
 /* Nonzero if any of the debugging options is enabled.  */
@@ -981,13 +969,14 @@
 		  _dl_debug_bindings = 1;
 		  _dl_debug_versions = 1;
 		  any_debug = 1;
+		  continue;
 		}
 	      break;
 
 	    case 4:
 	      if (memcmp (dl_debug, "help", 4) == 0)
 		{
-		  _dl_sysdep_message ("\
+		  _dl_message ("\
 Valid options for the LD_DEBUG environment variable are:\n\
 \n\
   bindings  display information about symbol binding\n\
@@ -1066,8 +1055,8 @@
 	  {
 	    /* Display a warning and skip everything until next separator.  */
 	    char *startp = strndupa (dl_debug, len);
-	    _dl_sysdep_error ("warning: debug option `", startp,
-			      "' unknown; try LD_DEBUG=help\n", NULL);
+	    _dl_error ("warning: debug option `", startp,
+		       "' unknown; try LD_DEBUG=help\n", NULL);
 	  }
 	}
     }
Index: sysdeps/mach/hurd/i386/init-first.c
--- 0.28/sysdeps/mach/hurd/i386/init-first.c Tue, 30 Jun 1998 19:58:39 +0200 kettenis (libc/13_init-first 1.1.1.1 640)
+++ local.47(w)/sysdeps/mach/hurd/i386/init-first.c Sun, 05 Jul 1998 19:00:13 +0200 kettenis (libc/13_init-first 1.1.1.1 640)
@@ -32,9 +32,16 @@
 extern void __getopt_clean_environment (char **);
 extern void __libc_global_ctors (void);
 
+#ifndef PIC
 unsigned int __hurd_threadvar_max;
 unsigned long int __hurd_threadvar_stack_offset;
 unsigned long int __hurd_threadvar_stack_mask;
+#endif
+
+#ifndef PIC
+mach_port_t *_hurd_init_dtable;
+mach_msg_type_number_t _hurd_init_dtablesize;
+#endif
 
 int __libc_multiple_libcs = 1;
 
Index: elf/ldsodefs.h
--- 0.28/elf/ldsodefs.h Tue, 23 Jun 1998 22:00:32 +0200 kettenis (libc/30_ldsodefs.h 1.2 640)
+++ local.47(w)/elf/ldsodefs.h Sat, 04 Jul 1998 21:20:48 +0200 kettenis (libc/30_ldsodefs.h 1.2 640)
@@ -22,6 +22,13 @@
 
 #include <features.h>
 
+#include <bits/types.h>
+
+#ifndef ssize_t
+typedef __ssize_t ssize_t;
+# define ssize_t ssize_t
+#endif
+
 #define __need_size_t
 #define __need_NULL
 #include <stddef.h>
@@ -155,40 +162,48 @@
 extern const char *_dl_inhibit_rpath;
 
 /* OS-dependent function to open the zero-fill device.  */
-extern int _dl_sysdep_open_zero_fill (void); /* dl-sysdep.c */
+extern int _dl_sysdep_open_zero_fill (void);
 
-/* OS-dependent function to write a message on the specified
-   descriptor FD.  All arguments are `const char *'; args until a null
-   pointer are concatenated to form the message to print.  */
-extern void _dl_sysdep_output (int fd, const char *string, ...);
-
-/* OS-dependent function to write a debug message on the specified
-   descriptor for this.  All arguments are `const char *'; args until
-   a null pointer are concatenated to form the message to print.  If
-   NEW_LINE is nonzero it is assumed that the message starts on a new
-   line.*/
+/* OS-dependent function to read the whole contents of FILE into new
+   mmap'd space with given protections.  The size of the file is
+   returned in SIZEP.  */
+extern void *_dl_sysdep_read_whole_file (const char *file, size_t *sizep,
+					  int prot);
+
+/* OS-dependent function to write NBYTES from BUF to FD.  */
+extern ssize_t _dl_sysdep_write (int fd, const void *buf, size_t nbytes);
+
+/* Write a message on the specified descriptor FD.  All arguments are
+   `const char *'; args until a null pointer are concatenated to form
+   the message to print.  */
+extern void _dl_output (int fd, const char *string, ...);
+
+/* Write a debug message to `_dl_debug_fd'.  All arguments are `const
+   char *'; args until a null pointer are concatenated to form the
+   message to print.  If NEW_LINE is nonzero it is assumed that the
+   message starts on a new line.*/
 extern void _dl_debug_message (int new_line, const char *string, ...);
 
-/* OS-dependent function to write a message on the standard output.
-   All arguments are `const char *'; args until a null pointer
-   are concatenated to form the message to print.  */
-#define _dl_sysdep_message(string, args...) \
-  _dl_sysdep_output (STDOUT_FILENO, string, ##args)
-
-/* OS-dependent function to write a message on the standard error.
-   All arguments are `const char *'; args until a null pointer
-   are concatenated to form the message to print.  */
-#define _dl_sysdep_error(string, args...) \
-  _dl_sysdep_output (STDERR_FILENO, string, ##args)
-
-/* OS-dependent function to give a fatal error message and exit
-   when the dynamic linker fails before the program is fully linked.
-   All arguments are `const char *'; args until a null pointer
-   are concatenated to form the message to print.  */
-#define _dl_sysdep_fatal(string, args...) \
+/* Write a message on the standard output.  All arguments are `const
+   char *'; args until a null pointer are concatenated to form the
+   message to print.  */
+#define _dl_message(string, args...) \
+  _dl_output (STDOUT_FILENO, string, ##args)
+
+/* Write a message on the standard error.  All arguments are `const
+   char *'; args until a null pointer are concatenated to form the
+   message to print.  */
+#define _dl_error(string, args...) \
+  _dl_output (STDERR_FILENO, string, ##args)
+
+/* Give a fatal error message and exit when the dynamic linker fails
+   before the program is fully linked.  All arguments are `const char
+   *'; args until a null pointer are concatenated to form the message
+   to print.  */
+#define _dl_fatal(string, args...) \
   do									      \
     {									      \
-      _dl_sysdep_output (STDERR_FILENO, string, ##args);		      \
+      _dl_output (STDERR_FILENO, string, ##args);		      \
       _exit (127);							      \
     }									      \
   while (1)
@@ -245,6 +260,13 @@
 					int type, int trace_mode)
      internal_function;
 
+/* Map in the shared object NAME, actually located in REALNAME, and already
+   opened on FD.  */
+extern struct link_map * _dl_map_object_from_fd (char *name, int fd,
+						 char *realname,
+						 struct link_map *loader,
+						 int l_type);
+     
 /* Call _dl_map_object on the dependencies of MAP, and set up
    MAP->l_searchlist.  PRELOADS points to a vector of NPRELOADS previously
    loaded objects that will be inserted into MAP->l_searchlist after MAP
Index: elf/dl-reloc.c
--- 0.28/elf/dl-reloc.c Tue, 23 Jun 1998 20:30:54 +0200 kettenis (libc/b/2_dl-reloc.c 1.1 640)
+++ local.47(w)/elf/dl-reloc.c Sat, 04 Jul 1998 16:33:36 +0200 kettenis (libc/b/2_dl-reloc.c 1.1 640)
@@ -83,8 +83,8 @@
 	  (ElfW(Addr) *) calloc (sizeof (ElfW(Addr)),
 				 l->l_info[DT_PLTRELSZ]->d_un.d_val);
 	if (l->l_reloc_result == NULL)
-	  _dl_sysdep_fatal (_dl_argv[0] ?: "<program name unknown>",
-			    "cannot allocate memory for profiling", NULL);
+	  _dl_fatal (_dl_argv[0] ?: "<program name unknown>",
+		     "cannot allocate memory for profiling", NULL);
       }
   }
 
Index: elf/dl-profile.c
--- 0.28/elf/dl-profile.c Tue, 23 Jun 1998 20:30:54 +0200 kettenis (libc/b/5_dl-profile 1.1 640)
+++ local.47(w)/elf/dl-profile.c Sat, 04 Jul 1998 16:34:49 +0200 kettenis (libc/b/5_dl-profile 1.1 640)
@@ -268,9 +268,9 @@
     {
       /* We cannot write the profiling data so don't do anything.  */
       char buf[400];
-      _dl_sysdep_message (filename, ": cannot open file: ",
-			  __strerror_r (errno, buf, sizeof buf),
-			  "\n", NULL);
+      _dl_message (filename, ": cannot open file: ",
+		   __strerror_r (errno, buf, sizeof buf),
+		   "\n", NULL);
       return;
     }
 
@@ -280,9 +280,9 @@
       char buf[400];
       int errnum = errno;
       __close (fd);
-      _dl_sysdep_message (filename, ": cannot stat file: ",
-			  __strerror_r (errnum, buf, sizeof buf),
-			  "\n", NULL);
+      _dl_message (filename, ": cannot stat file: ",
+		   __strerror_r (errnum, buf, sizeof buf),
+		   "\n", NULL);
       return;
     }
 
@@ -302,9 +302,9 @@
 	cannot_create:
 	  errnum = errno;
 	  __close (fd);
-	  _dl_sysdep_message (filename, ": cannot create file: ",
-			      __strerror_r (errnum, buf, sizeof buf),
-			      "\n", NULL);
+	  _dl_message (filename, ": cannot create file: ",
+		       __strerror_r (errnum, buf, sizeof buf),
+		       "\n", NULL);
 	  return;
 	}
 
@@ -321,9 +321,8 @@
       if (addr != NULL)
 	__munmap ((void *) addr, expected_size);
 
-      _dl_sysdep_message (filename,
-			  ": file is no correct profile data file for `",
-			  _dl_profile, "'\n", NULL);
+      _dl_message (filename, ": file is no correct profile data file for `",
+		   _dl_profile, "'\n", NULL);
       return;
     }
 
@@ -334,9 +333,9 @@
       char buf[400];
       int errnum = errno;
       __close (fd);
-      _dl_sysdep_message (filename, ": cannot map file: ",
-			  __strerror_r (errnum, buf, sizeof buf),
-			  "\n", NULL);
+      _dl_message (filename, ": cannot map file: ",
+		   __strerror_r (errnum, buf, sizeof buf),
+		   "\n", NULL);
       return;
     }
 
@@ -379,7 +378,7 @@
   if (tos == NULL)
     {
       __munmap ((void *) addr, expected_size);
-      _dl_sysdep_fatal ("Out of memory while initializing profiler\n", NULL);
+      _dl_fatal ("Out of memory while initializing profiler\n", NULL);
       /* NOTREACHED */
     }
 
Index: elf/dl-load.c
--- 0.28/elf/dl-load.c Fri, 03 Jul 1998 19:07:12 +0200 kettenis (libc/b/7_dl-load.c 1.1.1.2 640)
+++ local.47(w)/elf/dl-load.c Sat, 04 Jul 1998 17:06:10 +0200 kettenis (libc/b/7_dl-load.c 1.1.1.2 640)
@@ -496,7 +496,6 @@
 
 /* Map in the shared object NAME, actually located in REALNAME, and already
    opened on FD.  */
-
 struct link_map *
 _dl_map_object_from_fd (char *name, int fd, char *realname,
 			struct link_map *loader, int l_type)
@@ -889,7 +888,6 @@
 /* Try to open NAME in one of the directories in DIRS.
    Return the fd, or -1.  If successful, fill in *REALNAME
    with the malloc'd full directory name.  */
-
 static int
 open_path (const char *name, size_t namelen, int preloaded,
 	   struct r_search_path_elem **dirs,
@@ -1006,7 +1004,6 @@
 }
 
 /* Map in the shared object file NAME.  */
-
 struct link_map *
 internal_function
 _dl_map_object (struct link_map *loader, const char *name, int preloaded,
Index: elf/dl-error.c
--- 0.28/elf/dl-error.c Tue, 23 Jun 1998 20:30:54 +0200 kettenis (libc/b/11_dl-error.c 1.1 640)
+++ local.47(w)/elf/dl-error.c Sat, 04 Jul 1998 16:27:16 +0200 kettenis (libc/b/11_dl-error.c 1.1 640)
@@ -81,13 +81,13 @@
     {
       /* Lossage while resolving the program's own symbols is always fatal.  */
       char buffer[1024];
-      _dl_sysdep_fatal (_dl_argv[0] ?: "<program name unknown>",
-			": error in loading shared libraries: ",
-			objname ?: "", objname && *objname ? ": " : "",
-			errstring, errcode ? ": " : "",
-			(errcode
-			 ? __strerror_r (errcode, buffer, sizeof buffer)
-			 : ""), "\n", NULL);
+      _dl_fatal (_dl_argv[0] ?: "<program name unknown>",
+		 ": error in loading shared libraries: ",
+		 objname ?: "", objname && *objname ? ": " : "",
+		 errstring, errcode ? ": " : "",
+		 (errcode
+		  ? __strerror_r (errcode, buffer, sizeof buffer)
+		  : ""), "\n", NULL);
     }
 }
 
Index: elf/dl-minimal.c
--- 0.28/elf/dl-minimal.c Tue, 23 Jun 1998 20:30:54 +0200 kettenis (libc/b/18_dl-minimal 1.1 640)
+++ local.47(w)/elf/dl-minimal.c Sat, 04 Jul 1998 16:28:31 +0200 kettenis (libc/b/18_dl-minimal 1.1 640)
@@ -180,12 +180,10 @@
 {
   char buf[64];
   buf[sizeof buf - 1] = '\0';
-  _dl_sysdep_fatal ("BUG IN DYNAMIC LINKER ld.so: ",
-		    file, ": ", _itoa_word (line, buf + sizeof buf - 1, 10, 0),
-		    ": ", function ?: "", function ? ": " : "",
-		    "Assertion `", assertion, "' failed!\n",
-		    NULL);
-
+  _dl_fatal ("BUG IN DYNAMIC LINKER ld.so: ",
+	     file, ": ", _itoa_word (line, buf + sizeof buf - 1, 10, 0),
+	     ": ", function ?: "", function ? ": " : "",
+	     "Assertion `", assertion, "' failed!\n", NULL);
 }
 
 void weak_function
@@ -196,13 +194,11 @@
   char errbuf[64];
   char buf[64];
   buf[sizeof buf - 1] = '\0';
-  _dl_sysdep_fatal ("BUG IN DYNAMIC LINKER ld.so: ",
-		    file, ": ", _itoa_word (line, buf + sizeof buf - 1, 10, 0),
-		    ": ", function ?: "", function ? ": " : "",
-		    "Unexpected error: ",
-		    __strerror_r (errnum, errbuf, sizeof (errbuf)), "\n",
-		    NULL);
-
+  _dl_fatal ("BUG IN DYNAMIC LINKER ld.so: ",
+	     file, ": ", _itoa_word (line, buf + sizeof buf - 1, 10, 0),
+	     ": ", function ?: "", function ? ": " : "",
+	     "Unexpected error: ",
+	     __strerror_r (errnum, errbuf, sizeof (errbuf)), "\n", NULL);
 }
 
 #endif
Index: sysdeps/sparc/sparc32/dl-machine.h
--- 0.28/sysdeps/sparc/sparc32/dl-machine.h Tue, 30 Jun 1998 19:58:39 +0200 kettenis (libc/c/30_dl-machine 1.1 640)
+++ local.47(w)/sysdeps/sparc/sparc32/dl-machine.h Sat, 04 Jul 1998 16:56:44 +0200 kettenis (libc/c/30_dl-machine 1.1 640)
@@ -352,10 +352,10 @@
 
 	      strtab = ((void *) map->l_addr
 			+ map->l_info[DT_STRTAB]->d_un.d_ptr);
-	      _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
-				": Symbol `", strtab + refsym->st_name,
-				"' has different size in shared object, "
-				"consider re-linking\n", NULL);
+	      _dl_error (_dl_argv[0] ?: "<program name unknown>",
+			 ": Symbol `", strtab + refsym->st_name,
+			 "' has different size in shared object, "
+			 "consider re-linking\n", NULL);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
 						   refsym->st_size));
Index: hurd/Versions
--- 0.28/hurd/Versions Fri, 03 Jul 1998 19:07:12 +0200 kettenis (libc/f/29_Versions 1.1 640)
+++ local.47(w)/hurd/Versions Sun, 05 Jul 1998 18:22:54 +0200 kettenis (libc/f/29_Versions 1.1 640)
@@ -1,9 +1,19 @@
 libc {
   GLIBC_2.0 {
+    # Mach-specific variables
+    __mach_task_self_;
+    __vm_page_size;
+    vm_page_size;
+
+    # This is necessary for the Hurd brk implementation.
+    _end;
+
     # Hurd-specific variables
     __hurd_sigthread_stack_base; __hurd_sigthread_stack_end;
     __hurd_sigthread_variables;
+    __hurd_threadvar_max;
     __hurd_threadvar_stack_mask; __hurd_threadvar_stack_offset;
+    _hurd_init_dtable; _hurd_init_dtablesize;
 
     # Internal functions referenced by libmachuser and libhurduser.
     __mach_msg;
Index: elf/Versions
--- 0.28/elf/Versions Fri, 03 Jul 1998 19:07:12 +0200 kettenis (libc/g/11_Versions 1.1 640)
+++ local.47(w)/elf/Versions Sat, 04 Jul 1998 16:35:40 +0200 kettenis (libc/g/11_Versions 1.1 640)
@@ -4,7 +4,7 @@
     _dl_debug_impcalls; _dl_debug_fd;
 
     # functions used in other libraries
-    _dl_open; _dl_close; _dl_addr; _dl_sysdep_output; _dl_debug_message;
+    _dl_open; _dl_close; _dl_addr; _dl_output; _dl_debug_message;
 
     # Those are in the dynamic linker, but used by libc.so.
     __libc_enable_secure; _dl_catch_error; _dl_check_all_versions;
Index: sysdeps/powerpc/dl-machine.h
--- 0.28/sysdeps/powerpc/dl-machine.h Sat, 04 Jul 1998 16:58:02 +0200 kettenis (libc/g/22_dl-machine 1.1 644)
+++ local.47(w)/sysdeps/powerpc/dl-machine.h Sat, 04 Jul 1998 17:00:20 +0200 kettenis (libc/g/22_dl-machine 1.1 644)
@@ -725,10 +725,10 @@
 
 	  strtab = ((void *) map->l_addr
 		    + map->l_info[DT_STRTAB]->d_un.d_ptr);
-	  _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
-			    ": Symbol `", strtab + refsym->st_name,
-			    "' has different size in shared object, "
-			    "consider re-linking\n", NULL);
+	  _dl_error (_dl_argv[0] ?: "<program name unknown>",
+		     ": Symbol `", strtab + refsym->st_name,
+		     "' has different size in shared object, "
+		     "consider re-linking\n", NULL);
 	}
       memcpy (reloc_addr, (char *) finaladdr, MIN (sym->st_size,
 						   refsym->st_size));
@@ -745,11 +745,11 @@
   else
     {
 #ifdef RTLD_BOOTSTRAP
-      PPC_DIE;  /* There is no point calling _dl_sysdep_error, it
-		   almost certainly hasn't been relocated properly.  */
+      PPC_DIE;  /* There is no point calling _dl_error, it almost
+		   certainly hasn't been relocated properly.  */
 #else
-      _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
-			": Unknown relocation type\n", NULL);
+      _dl_error (_dl_argv[0] ?: "<program name unknown>",
+		 ": Unknown relocation type\n", NULL);
 #endif
     }
 
Index: sysdeps/m68k/dl-machine.h
--- 0.28/sysdeps/m68k/dl-machine.h Sat, 04 Jul 1998 16:58:02 +0200 kettenis (libc/g/23_dl-machine 1.1 640)
+++ local.47(w)/sysdeps/m68k/dl-machine.h Sat, 04 Jul 1998 16:54:23 +0200 kettenis (libc/g/23_dl-machine 1.1 640)
@@ -278,10 +278,10 @@
 
 	      strtab = ((void *) map->l_addr
 			+ map->l_info[DT_STRTAB]->d_un.d_ptr);
-	      _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
-				": Symbol `", strtab + refsym->st_name,
-				"' has different size in shared object, "
-				"consider re-linking\n", NULL);
+	      _dl_error (_dl_argv[0] ?: "<program name unknown>",
+			 ": Symbol `", strtab + refsym->st_name,
+			 "' has different size in shared object, "
+			 "consider re-linking\n", NULL);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
 						   refsym->st_size));
Index: sysdeps/unix/sysv/linux/i386/dl-librecon.h
--- 0.28/sysdeps/unix/sysv/linux/i386/dl-librecon.h Sat, 04 Jul 1998 16:58:02 +0200 kettenis (libc/g/24_dl-libreco 1.1 644)
+++ local.47(w)/sysdeps/unix/sysv/linux/i386/dl-librecon.h Sat, 04 Jul 1998 16:52:21 +0200 kettenis (libc/g/24_dl-libreco 1.1 644)
@@ -40,7 +40,7 @@
 	      break;							      \
 									      \
 	  /* We print a `5' or `6' depending on the outcome.  */	      \
-	  _dl_sysdep_message (d->d_tag != DT_NULL ? "5\n" : "6\n", NULL);     \
+	  _dl_message (d->d_tag != DT_NULL ? "5\n" : "6\n", NULL);            \
 	}								      \
     }									      \
   while (0)
Index: sysdeps/unix/sysv/linux/i386/dl-procinfo.h
--- 0.28/sysdeps/unix/sysv/linux/i386/dl-procinfo.h Sat, 04 Jul 1998 16:58:02 +0200 kettenis (libc/g/25_dl-procinf 1.1 640)
+++ local.47(w)/sysdeps/unix/sysv/linux/i386/dl-procinfo.h Sat, 04 Jul 1998 16:59:30 +0200 kettenis (libc/g/25_dl-procinf 1.1 640)
@@ -39,13 +39,13 @@
      in the kernel sources.  */
   int i;
 
-  _dl_sysdep_message ("AT_HWCAP:   ", NULL);
+  _dl_message ("AT_HWCAP:   ", NULL);
 
   for (i = 0; i < 32; ++i)
     if (word & (1 << i))
-      _dl_sysdep_message (" ", x86_cap_flags[i], NULL);
+      _dl_message (" ", x86_cap_flags[i], NULL);
 
-  _dl_sysdep_message ("\n", NULL);
+  _dl_message ("\n", NULL);
 
   return 0;
 }
Index: sysdeps/arm/dl-machine.h
--- 0.28/sysdeps/arm/dl-machine.h Sat, 04 Jul 1998 16:58:02 +0200 kettenis (libc/g/26_dl-machine 1.1 640)
+++ local.47(w)/sysdeps/arm/dl-machine.h Sat, 04 Jul 1998 16:53:45 +0200 kettenis (libc/g/26_dl-machine 1.1 640)
@@ -388,10 +388,10 @@
 
 	      strtab = ((const char *) map->l_addr
 			+ map->l_info[DT_STRTAB]->d_un.d_ptr);
-	      _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
-				": Symbol `", strtab + refsym->st_name,
-				"' has different size in shared object, "
-				"consider re-linking\n", NULL);
+	      _dl_error (_dl_argv[0] ?: "<program name unknown>",
+			 ": Symbol `", strtab + refsym->st_name,
+			 "' has different size in shared object, "
+			 "consider re-linking\n", NULL);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
 						   refsym->st_size));
Index: sysdeps/sparc/sparc64/dl-machine.h
--- 0.28/sysdeps/sparc/sparc64/dl-machine.h Sat, 04 Jul 1998 16:58:02 +0200 kettenis (libc/g/27_dl-machine 1.1 644)
+++ local.47(w)/sysdeps/sparc/sparc64/dl-machine.h Sat, 04 Jul 1998 16:56:59 +0200 kettenis (libc/g/27_dl-machine 1.1 644)
@@ -145,10 +145,10 @@
 
 	      strtab = ((void *) map->l_addr
 			+ map->l_info[DT_STRTAB]->d_un.d_ptr);
-	      _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
-				": Symbol `", strtab + refsym->st_name,
-				"' has different size in shared object, "
-				"consider re-linking\n", NULL);
+	      _dl_error (_dl_argv[0] ?: "<program name unknown>",
+			 ": Symbol `", strtab + refsym->st_name,
+			 "' has different size in shared object, "
+			 "consider re-linking\n", NULL);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
 						   refsym->st_size));
Index: sysdeps/i386/dl-machine.h
--- 0.28/sysdeps/i386/dl-machine.h Sat, 04 Jul 1998 16:58:02 +0200 kettenis (libc/g/28_dl-machine 1.1 640)
+++ local.47(w)/sysdeps/i386/dl-machine.h Sat, 04 Jul 1998 16:54:02 +0200 kettenis (libc/g/28_dl-machine 1.1 640)
@@ -340,10 +340,10 @@
 
 	      strtab = ((const char *) map->l_addr
 			+ map->l_info[DT_STRTAB]->d_un.d_ptr);
-	      _dl_sysdep_error (_dl_argv[0] ?: "<program name unknown>",
-				": Symbol `", strtab + refsym->st_name,
-				"' has different size in shared object, "
-				"consider re-linking\n", NULL);
+	      _dl_error (_dl_argv[0] ?: "<program name unknown>",
+			 ": Symbol `", strtab + refsym->st_name,
+			 "' has different size in shared object, "
+			 "consider re-linking\n", NULL);
 	    }
 	  memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
 						   refsym->st_size));
Index: sysdeps/generic/dl-cache.c
--- 0.28/sysdeps/generic/dl-cache.c Sat, 04 Jul 1998 16:58:02 +0200 kettenis (libc/g/29_dl-cache.c 1.1 644)
+++ local.47(w)/sysdeps/generic/dl-cache.c Sat, 04 Jul 1998 16:53:09 +0200 kettenis (libc/g/29_dl-cache.c 1.1 644)
@@ -21,12 +21,6 @@
 #include <elf/ldsodefs.h>
 #include <sys/mman.h>
 
-/* System-dependent function to read a file's whole contents
-   in the most convenient manner available.  */
-extern void *_dl_sysdep_read_whole_file (const char *filename,
-					 size_t *filesize_ptr,
-					 int mmap_prot);
-
 #ifndef LD_SO_CACHE
 # define LD_SO_CACHE "/etc/ld.so.cache"
 #endif
Index: hurd/hurdstartup.c
--- 0.28/hurd/hurdstartup.c Sun, 05 Jul 1998 20:03:16 +0200 kettenis (libc/g/30_hurdstartu 1.1 644)
+++ local.47(w)/hurd/hurdstartup.c Sun, 05 Jul 1998 19:00:16 +0200 kettenis (libc/g/30_hurdstartu 1.1 644)
@@ -32,9 +32,6 @@
 #include "hurdstartup.h"
 #include <argz.h>
 
-mach_port_t *_hurd_init_dtable;
-mach_msg_type_number_t _hurd_init_dtablesize;
-
 extern void __mach_init (void);
 
 /* Entry point.  This is the first thing in the text segment.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]