]> sourceware.org Git - glibc.git/commitdiff
Wed Sep 27 00:27:25 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
authorRoland McGrath <roland@gnu.org>
Wed, 27 Sep 1995 06:49:48 +0000 (06:49 +0000)
committerRoland McGrath <roland@gnu.org>
Wed, 27 Sep 1995 06:49:48 +0000 (06:49 +0000)
* config.make.in (AS): New variable; set to `$(CC) -c'.

* posix/unistd.h [__USE_BSD]: Declare profil.

* elf/dl-load.c (_dl_map_object_from_fd): New function, broken out
of _dl_map_object.
(_dl_map_object): Call it.
* elf/link.h (_dl_map_object_from_fd): Declare it.

ChangeLog
config.make.in
elf/dl-load.c
elf/link.h
posix/unistd.h

index bd0651bf8fa016dde3167f856bdc7b798d8c404a..2865f35eff3cfa104cd97af1fe9bb7325809f51d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Wed Sep 27 00:27:25 1995  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
+
+       * config.make.in (AS): New variable; set to `$(CC) -c'.
+
+       * posix/unistd.h [__USE_BSD]: Declare profil.
+
+       * elf/dl-load.c (_dl_map_object_from_fd): New function, broken out
+       of _dl_map_object.
+       (_dl_map_object): Call it.
+       * elf/link.h (_dl_map_object_from_fd): Declare it.
+
 Tue Sep 26 16:50:17 1995  Roland McGrath  <roland@churchy.gnu.ai.mit.edu>
 
        * locale/libintl.h: Rewritten by Ulrich Drepper for use with GNU
index 652f10ec13c49ab628da3a11bc09f62fc4fdc6b7..69d4fcbdea812910dfe2ba15bb6700ce9b9a4ddf 100644 (file)
@@ -29,6 +29,7 @@ build-omitfp = @omitfp@
 CC = @CC@
 AR = @AR@
 RANLIB = @RANLIB@
+AS = $(CC) -c
 
 # Installation tools.
 INSTALL = @INSTALL@
index 6cacd3e3b6d68ac064b04c94e005cdf1e9789cc2..7319602d813bdb71c969e5b5a74e86be417ae0b8 100644 (file)
@@ -108,40 +108,8 @@ _dl_map_object (struct link_map *loader, const char *name,
                Elf32_Addr *entry_point)
 {
   int fd;
-  struct link_map *l = NULL;
   char *realname;
-  const size_t pagesize = getpagesize ();
-  void *file_mapping = NULL;
-  size_t mapping_size = 0;
-
-  void lose (int code, const char *msg)
-    {
-      (void) close (fd);
-      if (file_mapping)
-       munmap (file_mapping, mapping_size);
-      _dl_signal_error (code, l ? l->l_name : name, msg);
-    }
-
-  /* Make sure LOCATION is mapped in.  */
-  void *map (off_t location, size_t size)
-    {
-      if ((off_t) mapping_size <= location + (off_t) size)
-       {
-         void *result;
-         if (file_mapping)
-           munmap (file_mapping, mapping_size);
-         mapping_size = (location + size + 1 + pagesize - 1);
-         mapping_size &= ~(pagesize - 1);
-         result = mmap (file_mapping, mapping_size, PROT_READ,
-                        MAP_COPY|MAP_FILE, fd, 0);
-         if (result == (void *) -1)
-           lose (errno, "cannot map file data");
-         file_mapping = result;
-       }
-      return file_mapping + location;
-    }
-
-  const Elf32_Ehdr *header;
+  struct link_map *l;
 
   /* Look for this name among those already loaded.  */
   for (l = _dl_loaded; l; l = l->l_next)
@@ -182,7 +150,52 @@ _dl_map_object (struct link_map *loader, const char *name,
     }
 
   if (fd == -1)
-    lose (errno, "cannot open shared object file");
+    _dl_signal_error (errno, name, "cannot open shared object file");
+
+  return _dl_map_object_from_fd (name, fd, realname, entry_point);
+}
+
+
+/* Map in the shared object NAME, actually located in REALNAME, and already
+   opened on FD.  */
+
+struct link_map *
+_dl_map_object_from_fd (const char *name, int fd, char *realname, 
+                       Elf32_Addr *entry_point)
+{
+  struct link_map *l = NULL;
+  const size_t pagesize = getpagesize ();
+  void *file_mapping = NULL;
+  size_t mapping_size = 0;
+
+  void lose (int code, const char *msg)
+    {
+      (void) close (fd);
+      if (file_mapping)
+       munmap (file_mapping, mapping_size);
+      _dl_signal_error (code, l ? l->l_name : name, msg);
+    }
+
+  /* Make sure LOCATION is mapped in.  */
+  void *map (off_t location, size_t size)
+    {
+      if ((off_t) mapping_size <= location + (off_t) size)
+       {
+         void *result;
+         if (file_mapping)
+           munmap (file_mapping, mapping_size);
+         mapping_size = (location + size + 1 + pagesize - 1);
+         mapping_size &= ~(pagesize - 1);
+         result = mmap (file_mapping, mapping_size, PROT_READ,
+                        MAP_COPY|MAP_FILE, fd, 0);
+         if (result == (void *) -1)
+           lose (errno, "cannot map file data");
+         file_mapping = result;
+       }
+      return file_mapping + location;
+    }
+
+  const Elf32_Ehdr *header;
 
   /* Look again to see if the real name matched another already loaded.  */
   for (l = _dl_loaded; l; l = l->l_next)
@@ -191,11 +204,11 @@ _dl_map_object (struct link_map *loader, const char *name,
        /* The object is already loaded.
           Just bump its reference count and return it.  */
        close (fd);
+       free (realname);
        ++l->l_opencount;
        return l;
       }
 
-
   /* Map in the first page to read the header.  */
   header = map (0, sizeof *header);
 
index 6f44a0cfdbcbbb5071b503a319a1de7999a7eace..aacb3f163048ef30d67ce80478c90278e673ef86 100644 (file)
@@ -164,6 +164,12 @@ extern struct link_map *_dl_map_object (struct link_map *loader,
                                        const char *name,
                                        Elf32_Addr *entry_point);
 
+/* Similar, but file found at REALNAME and opened on FD.
+   REALNAME must malloc'd storage and is used in internal data structures.  */
+extern struct link_map *_dl_map_object_from_fd (const char *name,
+                                               int fd, char *realname,
+                                               Elf32_Addr *entry_point);
+
 /* Cache the locations of MAP's hash table.  */
 extern void _dl_setup_hash (struct link_map *map);
 
index eda44c96be55ab5f3e3523556f0b21f1119ea0c7..846653c75c7fbb56e0672ae1c988ded3f87d6625 100644 (file)
@@ -568,6 +568,15 @@ extern int vhangup __P ((void));
 extern int revoke __P ((const char *__file));
 
 
+/* Enable statistical profiling, writing samples of the PC into at most
+   SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling
+   is enabled, the system examines the user PC and increments
+   SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536].  If SCALE is zero,
+   disable profiling.  Returns zero on success, -1 on error.  */
+extern int profil __P ((unsigned short int *__sample_buffer, size_t __size,
+                       size_t __offset, unsigned int __scale));
+
+
 /* Turn accounting on if NAME is an existing file.  The system will then write
    a record for each process as it terminates, to this file.  If NAME is NULL,
    turn accounting off.  This call is restricted to the super-user.  */
This page took 0.075822 seconds and 5 git commands to generate.