~ubuntu-branches/ubuntu/precise/eglibc/precise-201308281639

« back to all changes in this revision

Viewing changes to elf/dl-libc.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-02-08 01:58:09 UTC
  • mfrom: (1.5.3) (288.1.12 precise)
  • Revision ID: package-import@ubuntu.com-20120208015809-ulscst7uteq3e22z
Tags: 2.15~pre6-0ubuntu10
Merge from Debian (r5151, 2.13-26).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Handle loading and unloading shared objects for internal libc purposes.
2
 
   Copyright (C) 1999-2002,2004-2006,2009,2010 Free Software Foundation, Inc.
 
2
   Copyright (C) 1999-2002,2004-2006,2009,2010,2011
 
3
   Free Software Foundation, Inc.
3
4
   This file is part of the GNU C Library.
4
5
   Contributed by Zack Weinberg <zack@rabi.columbia.edu>, 1999.
5
6
 
44
45
  const char *last_errstring = NULL;
45
46
  bool malloced;
46
47
 
47
 
  (void) GLRO(dl_catch_error) (&objname, &last_errstring, &malloced,
48
 
                               operate, args);
 
48
  int result = (GLRO(dl_catch_error) (&objname, &last_errstring, &malloced,
 
49
                                      operate, args)
 
50
                ?: last_errstring != NULL);
49
51
 
50
 
  int result = last_errstring != NULL;
51
52
  if (result && malloced)
52
53
    free ((char *) last_errstring);
53
54
 
62
63
  const char *name;
63
64
  /* Opening mode.  */
64
65
  int mode;
 
66
  /* This is the caller of the dlopen() function.  */
 
67
  const void *caller_dlopen;
65
68
 
66
69
  /* Return from do_dlopen.  */
67
70
  struct link_map *map;
83
86
{
84
87
  struct do_dlopen_args *args = (struct do_dlopen_args *) ptr;
85
88
  /* Open and relocate the shared object.  */
86
 
  args->map = GLRO(dl_open) (args->name, args->mode, NULL, __LM_ID_CALLER,
87
 
                             __libc_argc, __libc_argv, __environ);
 
89
  args->map = GLRO(dl_open) (args->name, args->mode, args->caller_dlopen,
 
90
                             __LM_ID_CALLER, __libc_argc, __libc_argv,
 
91
                             __environ);
88
92
}
89
93
 
90
94
static void
153
157
  struct do_dlopen_args args;
154
158
  args.name = name;
155
159
  args.mode = mode;
 
160
  args.caller_dlopen = RETURN_ADDRESS (0);
156
161
 
157
162
#ifdef SHARED
158
163
  if (__builtin_expect (_dl_open_hook != NULL, 0))
302
307
        }
303
308
    }
304
309
 
305
 
  if (USE___THREAD || GL(dl_tls_dtv_slotinfo_list) != NULL)
306
 
    {
307
 
      /* Free the memory allocated for the dtv slotinfo array.  We can do
308
 
         this only if all modules which used this memory are unloaded.  */
 
310
  /* Free the memory allocated for the dtv slotinfo array.  We can do
 
311
     this only if all modules which used this memory are unloaded.  */
309
312
#ifdef SHARED
310
 
      if (GL(dl_initial_dtv) == NULL)
311
 
        /* There was no initial TLS setup, it was set up later when
312
 
           it used the normal malloc.  */
313
 
        free_slotinfo (&GL(dl_tls_dtv_slotinfo_list));
314
 
      else
 
313
  if (GL(dl_initial_dtv) == NULL)
 
314
    /* There was no initial TLS setup, it was set up later when
 
315
       it used the normal malloc.  */
 
316
    free_slotinfo (&GL(dl_tls_dtv_slotinfo_list));
 
317
  else
315
318
#endif
316
 
        /* The first element of the list does not have to be deallocated.
317
 
           It was allocated in the dynamic linker (i.e., with a different
318
 
           malloc), and in the static library it's in .bss space.  */
319
 
        free_slotinfo (&GL(dl_tls_dtv_slotinfo_list)->next);
320
 
    }
 
319
    /* The first element of the list does not have to be deallocated.
 
320
       It was allocated in the dynamic linker (i.e., with a different
 
321
       malloc), and in the static library it's in .bss space.  */
 
322
    free_slotinfo (&GL(dl_tls_dtv_slotinfo_list)->next);
321
323
 
322
324
  void *scope_free_list = GL(dl_scope_free_list);
323
325
  GL(dl_scope_free_list) = NULL;