glibc/glibc-rh179072.patch
2012-01-25 21:57:42 -07:00

158 lines
4.8 KiB
Diff

diff -Nrup a/elf/dl-close.c b/elf/dl-close.c
--- a/elf/dl-close.c 2012-01-25 21:49:58.892869984 -0700
+++ b/elf/dl-close.c 2012-01-25 21:50:22.283882509 -0700
@@ -32,6 +32,7 @@
#include <sys/mman.h>
#include <sysdep-cancel.h>
#include <tls.h>
+#include <stap-probe.h>
/* Type of the constructor functions. */
@@ -469,6 +470,7 @@ _dl_close_worker (struct link_map *map)
struct r_debug *r = _dl_debug_initialize (0, nsid);
r->r_state = RT_DELETE;
_dl_debug_state ();
+ LIBC_PROBE (rtld_unmap_start, 2, nsid, r);
if (unload_global)
{
@@ -738,6 +740,7 @@ _dl_close_worker (struct link_map *map)
/* Notify the debugger those objects are finalized and gone. */
r->r_state = RT_CONSISTENT;
_dl_debug_state ();
+ LIBC_PROBE (rtld_unmap_complete, 2, nsid, r);
/* Recheck if we need to retry, release the lock. */
out:
diff -Nrup a/elf/dl-load.c b/elf/dl-load.c
--- a/elf/dl-load.c 2012-01-25 21:49:58.895869986 -0700
+++ b/elf/dl-load.c 2012-01-25 21:50:22.288882511 -0700
@@ -36,6 +36,7 @@
#include <stackinfo.h>
#include <caller.h>
#include <sysdep.h>
+#include <stap-probe.h>
#include <dl-dst.h>
@@ -881,7 +882,7 @@ _dl_init_paths (const char *llp)
static void
__attribute__ ((noreturn, noinline))
lose (int code, int fd, const char *name, char *realname, struct link_map *l,
- const char *msg, struct r_debug *r)
+ const char *msg, struct r_debug *r, Lmid_t nsid)
{
/* The file might already be closed. */
if (fd != -1)
@@ -895,6 +896,7 @@ lose (int code, int fd, const char *name
{
r->r_state = RT_CONSISTENT;
_dl_debug_state ();
+ LIBC_PROBE (rtld_map_complete, 2, nsid, r);
}
_dl_signal_error (code, name, NULL, msg);
@@ -933,7 +935,7 @@ _dl_map_object_from_fd (const char *name
errval = errno;
call_lose:
lose (errval, fd, name, realname, l, errstring,
- make_consistent ? r : NULL);
+ make_consistent ? r : NULL, nsid);
}
/* Look again to see if the real name matched another already loaded. */
@@ -1040,6 +1042,7 @@ _dl_map_object_from_fd (const char *name
linking has not been used before. */
r->r_state = RT_ADD;
_dl_debug_state ();
+ LIBC_PROBE (rtld_map_start, 2, nsid, r);
make_consistent = true;
}
else
@@ -1735,7 +1738,7 @@ open_verify (const char *name, struct fi
name = strdupa (realname);
free (realname);
}
- lose (errval, fd, name, NULL, NULL, errstring, NULL);
+ lose (errval, fd, name, NULL, NULL, errstring, NULL, 0);
}
/* See whether the ELF header is what we expect. */
diff -Nrup a/elf/dl-open.c b/elf/dl-open.c
--- a/elf/dl-open.c 2012-01-01 05:16:32.000000000 -0700
+++ b/elf/dl-open.c 2012-01-25 21:50:22.291882514 -0700
@@ -33,6 +33,7 @@
#include <caller.h>
#include <sysdep-cancel.h>
#include <tls.h>
+#include <stap-probe.h>
#include <dl-dst.h>
@@ -292,6 +293,7 @@ dl_open_worker (void *a)
struct r_debug *r = _dl_debug_initialize (0, args->nsid);
r->r_state = RT_CONSISTENT;
_dl_debug_state ();
+ LIBC_PROBE (rtld_map_complete, 2, args->nsid, r);
/* Print scope information. */
if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0))
@@ -308,10 +310,18 @@ dl_open_worker (void *a)
struct link_map *l = new;
while (l->l_next)
l = l->l_next;
+ int relocation_in_progress = 0;
while (1)
{
if (! l->l_real->l_relocated)
{
+ if (! relocation_in_progress)
+ {
+ /* Notify the debugger that relocations are about to happen. */
+ LIBC_PROBE (rtld_reloc_start, 2, args->nsid, r);
+ relocation_in_progress = 1;
+ }
+
#ifdef SHARED
if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
{
@@ -481,6 +491,10 @@ cannot load any more object with static
}
}
+ /* Notify the debugger all new objects have been relocated. */
+ if (relocation_in_progress)
+ LIBC_PROBE (rtld_reloc_complete, 2, args->nsid, r);
+
/* Run the initializer functions of new objects. */
_dl_init (new, args->argc, args->argv, args->env);
diff -Nrup a/elf/rtld.c b/elf/rtld.c
--- a/elf/rtld.c 2012-01-25 21:49:58.898869987 -0700
+++ b/elf/rtld.c 2012-01-25 21:53:42.262987201 -0700
@@ -40,6 +40,7 @@
#include <dl-osinfo.h>
#include <dl-procinfo.h>
#include <tls.h>
+#include <stap-probe.h>
#include <stackinfo.h>
#include <assert.h>
@@ -1670,6 +1671,7 @@ ERROR: ld.so: object '%s' cannot be load
/* We start adding objects. */
r->r_state = RT_ADD;
_dl_debug_state ();
+ LIBC_PROBE (rtld_init_start, 2, LM_ID_BASE, r);
/* Auditing checkpoint: we are ready to signal that the initial map
is being constructed. */
@@ -2382,6 +2384,7 @@ ERROR: ld.so: object '%s' cannot be load
r = _dl_debug_initialize (0, LM_ID_BASE);
r->r_state = RT_CONSISTENT;
_dl_debug_state ();
+ LIBC_PROBE (rtld_init_complete, 2, LM_ID_BASE, r);
#ifndef MAP_COPY
/* We must munmap() the cache file. */