This is the mail archive of the libc-alpha@sourceware.org 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]
Other format: [Raw text]

[PATCH v2] Invoke DL_AFTER_LOAD if defined


2012-10-29  Chris Metcalf  <cmetcalf@tilera.com>

	* elf/dl-load.c (_dl_map_object_from_fd): Call DL_AFTER_LOAD
	if defined.
	* ports/sysdeps/tile/dl-machine.h: Use new DL_AFTER_LOAD macro
	and rename _dl_arch_map_object to _dl_after_load.
	* ports/sysdeps/tile/dl-runtime.c: Rename _dl_arch_map_object
	to _dl_after_load and remove spurious DL_UNMAP definition.

This hook is useful for any arch-specific functionality that
should be done on loaded objects.  For the tile architecture,
the hook is already provided (though we switch to using the new
macro name with this commit) and implements a simulator notifier
so that the simulator can load Elf symbols to match the object
and generate better error messages for PC's.

Also, remove a spurious definition of DL_UNMAP in dl-runtime.c
---
 elf/dl-load.c                   |    4 ++++
 ports/sysdeps/tile/dl-machine.h |    4 ++--
 ports/sysdeps/tile/dl-runtime.c |    4 +---
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/elf/dl-load.c b/elf/dl-load.c
index 4b57879..a695556 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1580,6 +1580,10 @@ cannot enable executable stack as shared object requires");
     add_name_to_object (l, ((const char *) D_PTR (l, l_info[DT_STRTAB])
 			    + l->l_info[DT_SONAME]->d_un.d_val));
 
+#ifdef DL_AFTER_LOAD
+  DL_AFTER_LOAD (l);
+#endif
+
   /* Now that the object is fully initialized add it to the object list.  */
   _dl_add_to_namespace_list (l, nsid);
 
diff --git a/ports/sysdeps/tile/dl-machine.h b/ports/sysdeps/tile/dl-machine.h
index c4413f9..09a2993 100644
--- a/ports/sysdeps/tile/dl-machine.h
+++ b/ports/sysdeps/tile/dl-machine.h
@@ -253,8 +253,8 @@ elf_machine_plt_value (struct link_map *map, const ElfW(Rela) *reloc,
 }
 
 /* Support notifying the simulator about new objects. */
-void internal_function _dl_arch_map_object (struct link_map *l);
-#define _dl_arch_map_object _dl_arch_map_object
+void internal_function _dl_after_load (struct link_map *l);
+#define DL_AFTER_LOAD _dl_after_load
 
 /* Names of the architecture-specific auditing callback functions.  */
 #define ARCH_LA_PLTENTER tile_gnu_pltenter
diff --git a/ports/sysdeps/tile/dl-runtime.c b/ports/sysdeps/tile/dl-runtime.c
index 0aa211d..6864c3a 100644
--- a/ports/sysdeps/tile/dl-runtime.c
+++ b/ports/sysdeps/tile/dl-runtime.c
@@ -30,7 +30,7 @@
 
 /* Support notifying the simulator about new objects. */
 void internal_function
-_dl_arch_map_object (struct link_map *l)
+_dl_after_load (struct link_map *l)
 {
   int shift;
 
@@ -75,5 +75,3 @@ _dl_unmap (struct link_map *l)
 
   __munmap ((void *) l->l_map_start, l->l_map_end - l->l_map_start);
 }
-
-#define DL_UNMAP(map) _dl_unmap (map)
-- 
1.7.10.3


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