summary refs log tree commit diff
path: root/elf/dl-addr.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-09-27 07:29:51 +0000
committerRoland McGrath <roland@gnu.org>2002-09-27 07:29:51 +0000
commit8323008c642b50b3d3d1258ce87bae40c79df55e (patch)
tree3a41ad00649d63b6c632cb3ce82b63b335d9a2c3 /elf/dl-addr.c
parent29c082c51314b5507d563e8147109aef8aae8037 (diff)
downloadglibc-8323008c642b50b3d3d1258ce87bae40c79df55e.tar.gz
glibc-8323008c642b50b3d3d1258ce87bae40c79df55e.tar.xz
glibc-8323008c642b50b3d3d1258ce87bae40c79df55e.zip
* elf/dl-addr.c (_dl_addr): Set dli_fbase to l_map_start
	unconditionally.  Set dli_fname to _dl_argv[0] only for main program.

2002-09-27  Roland McGrath  <roland@redhat.com>

	* elf/dl-addr.c (_dl_addr): Add a cast.

	* sysdeps/x86_64/dl-machine.h (elf_machine_rela) [USE_TLS]: Handle new
	TLS relocs R_X86_64_DTPMOD64, R_X86_64_DTPOFF64, and R_X86_64_TPOFF64.

	* elf/elf.h (R_X86_64_DTPMOD64, R_X86_64_DTPOFF64, R_X86_64_TPOFF64,
	R_X86_64_TLSGD, R_X86_64_TLSLD, R_X86_64_DTPOFF32,
	R_x86_64_GOTTPOFF, R_X86_64_TPOFF32): New macros.
	(R_X86_64_NUM): Update the value.
Diffstat (limited to 'elf/dl-addr.c')
-rw-r--r--elf/dl-addr.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/elf/dl-addr.c b/elf/dl-addr.c
index 66cec39eb4..e560c74ab5 100644
--- a/elf/dl-addr.c
+++ b/elf/dl-addr.c
@@ -60,14 +60,12 @@ _dl_addr (const void *address, Dl_info *info)
 
   /* Now we know what object the address lies in.  */
   info->dli_fname = match->l_name;
-  info->dli_fbase = (void *) match->l_addr;
+  info->dli_fbase = (void *) match->l_map_start;
 
   /* If this is the main program the information is incomplete.  */
-  if (__builtin_expect (info->dli_fbase == NULL, 0))
-    {
-      info->dli_fname = _dl_argv[0];
-      info->dli_fbase = (void *) match->l_map_start;
-    }
+  if (__builtin_expect (l->l_name[0], 'a') == '\0'
+      && l->l_type == lt_executable)
+    info->dli_fname = _dl_argv[0];
 
   symtab = (const void *) D_PTR (match, l_info[DT_SYMTAB]);
   strtab = (const void *) D_PTR (match, l_info[DT_STRTAB]);
@@ -81,7 +79,7 @@ _dl_addr (const void *address, Dl_info *info)
        dynamic symbol table and no hash table is present.  The ELF
        binary is ill-formed but what shall we do?  Use the beginning of
        the string table which generally follows the symbol table.  */
-    symtabend = strtab;
+    symtabend = (const ElfW(Sym) *) strtab;
 
   /* We assume that the string table follows the symbol table, because
      there is no way in ELF to know the size of the dynamic symbol table!!  */