Skip to contentSkip to conversation

toolchain status

Linux-ia64 H . J . Lu 1 participant 1 message Nov 16, 2000

lore
Share & tools
lore

H . J . Lu

author
#0 lore raw
Quoted 8 lines · Richard Henderson
Quoted 2 lines · H . J . Lu

There is no DT_INIT_ARRAY in libc.so. Even if there is DT_INIT_ARRAY, I still don't know how to use it to tell where DT_INIT points to.

Easy enough -- you know from DT_PLTGOT what the GP is for the DSO. If *(long *)(DT_INIT + 8) = GP, then you can assume that DT_INIT is a descriptor instead of an offset.

Thanks. This patch seems to work for me.

Signature · 29 lines
H.J. Lu ([email protected])
---
2000-11-16  H.J. Lu  <[email protected]>

	* sysdeps/ia64/dl-lookupcfg.h (DL_DT_INIT_ADDRESS): Check if
	*(long *)(DT_INIT + 8) = GP to tell a descriptor from an
	offset. It is for the backward compatibility.
	(DL_DT_FINI_ADDRESS): Likewise.

Index: sysdeps/ia64/dl-lookupcfg.h
=================================RCS file: /work/cvs/gnu/glibc/sysdeps/ia64/dl-lookupcfg.h,v
retrieving revision 1.1.1.4
diff -u -p -r1.1.1.4 dl-lookupcfg.h
--- sysdeps/ia64/dl-lookupcfg.h	2000/11/16 18:49:34	1.1.1.4
+++ sysdeps/ia64/dl-lookupcfg.h	2000/11/16 23:25:42
@@ -40,5 +40,13 @@ extern Elf64_Addr _dl_function_address (
 					Elf64_Addr start);
 
 #define DL_FUNCTION_ADDRESS(map, addr) _dl_function_address (map, addr)
+#if 0
 #define DL_DT_INIT_ADDRESS(map, addr) DL_FUNCTION_ADDRESS (map, addr)
 #define DL_DT_FINI_ADDRESS(map, addr) DL_FUNCTION_ADDRESS (map, addr)
+#else
+/* When should this backward compatibility be removed? */
+#define DL_DT_INIT_ADDRESS(map, addr)					      \
+  ((map)->l_info[DT_PLTGOT]->d_un.d_ptr = *(Elf64_Addr *) ((addr) + 8)       \
+   ? (addr) : DL_FUNCTION_ADDRESS (map, addr))
+#define DL_DT_FINI_ADDRESS(map, addr) DL_DT_INIT_ADDRESS (map, addr)
+#endif