public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Change dladdr to return same thing as dlsym/dlvsym in dli_saddr
@ 2004-10-19 16:20 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2004-10-19 16:20 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

Hi!

On most arches this means no change (well, the first hunk means that
STT_TLS symbols will not be looked at, as they don't represent addresses
in the shared library or binary), but on IA-64/HPPA this matters.

2004-10-19  Jakub Jelinek  <jakub@redhat.com>

	* elf/dl-addr.c (_dl_addr): Don't look at STT_TLS symbols.
	Use DL_SYMBOL_ADDRESS to set dli_saddr.

--- libc/elf/dl-addr.c.jj	2004-10-15 23:08:33.000000000 +0200
+++ libc/elf/dl-addr.c	2004-10-19 10:10:31.000000000 +0200
@@ -92,6 +92,9 @@ _dl_addr (const void *address, Dl_info *
 	 dynamic symbol table!!  */
       for (matchsym = NULL; (void *) symtab < (void *) symtabend; ++symtab)
 	if (addr >= match->l_addr + symtab->st_value
+#if defined USE_TLS
+	    && ELFW(ST_TYPE) (symtab->st_info) != STT_TLS
+#endif
 	    && ((symtab->st_size == 0
 		 && addr == match->l_addr + symtab->st_value)
 		|| addr < match->l_addr + symtab->st_value + symtab->st_size)
@@ -110,8 +113,10 @@ _dl_addr (const void *address, Dl_info *
 	{
 	  /* We found a symbol close by.  Fill in its name and exact
 	     address.  */
+	  lookup_t matchl = LOOKUP_VALUE (match);
+
 	  info->dli_sname = strtab + matchsym->st_name;
-	  info->dli_saddr = (void *) (match->l_addr + matchsym->st_value);
+	  info->dli_saddr = DL_SYMBOL_ADDRESS (matchl, matchsym);
 	}
       else
 	{

	Jakub

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-19 16:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-19 16:20 [PATCH] Change dladdr to return same thing as dlsym/dlvsym in dli_saddr Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).