1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00
This commit is contained in:
Jakub Jelinek
2007-07-12 18:26:36 +00:00
parent 7d58530341
commit 0ecb606cb6
6215 changed files with 494638 additions and 305010 deletions

View File

@ -39,14 +39,24 @@ _dl_new_object (char *realname, const char *libname, int type,
size_t libname_len = strlen (libname) + 1;
struct link_map *new;
struct libname_list *newname;
#ifdef SHARED
/* We create the map for the executable before we know whether we have
auditing libraries and if yes, how many. Assume the worst. */
unsigned int naudit = GLRO(dl_naudit) ?: ((mode & __RTLD_OPENEXEC)
? DL_NNS : 0);
size_t audit_space = naudit * sizeof (new->l_audit[0]);
#else
# define audit_space 0
#endif
new = (struct link_map *) calloc (sizeof (*new) + sizeof (*newname)
+ libname_len, 1);
new = (struct link_map *) calloc (sizeof (*new) + audit_space
+ sizeof (*newname) + libname_len, 1);
if (new == NULL)
return NULL;
new->l_real = new;
new->l_libname = newname = (struct libname_list *) (new + 1);
new->l_libname = newname = (struct libname_list *) ((char *) (new + 1)
+ audit_space);
newname->name = (char *) memcpy (newname + 1, libname, libname_len);
/* newname->next = NULL; We use calloc therefore not necessary. */
newname->dont_free = 1;
@ -59,6 +69,14 @@ _dl_new_object (char *realname, const char *libname, int type,
#endif
new->l_ns = nsid;
#ifdef SHARED
for (unsigned int cnt = 0; cnt < naudit; ++cnt)
{
new->l_audit[cnt].cookie = (uintptr_t) new;
/* new->l_audit[cnt].bindflags = 0; */
}
#endif
/* new->l_global = 0; We use calloc therefore not necessary. */
/* Use the 'l_scope_mem' array by default for the the 'l_scope'