This is the mail archive of the libc-hacker@sourceware.org mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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] Fix tst-addr1 on ppc64 and ia64


Hi!

On ppc64 and ia64 &printf is put into GOT, so the SHN_UNDEF printf
symbol has zero st_value and thus dladdr (&printf, ...) returns
a symbol in libc.so.  But, unfortunately, in libc.so _IO_printf
is an alias to printf, both are global symbols and have the same
address and size.  Which one comes first in the hash table depends
on the linker.

2006-08-31  Jakub Jelinek  <jakub@redhat.com>

	* elf/tst-addr1.c (do_test): Allow i.dli_sname "_IO_printf".

--- libc/elf/tst-addr1.c.jj	2006-08-24 22:18:59.000000000 +0200
+++ libc/elf/tst-addr1.c	2006-08-31 17:27:20.000000000 +0200
@@ -12,7 +12,14 @@ do_test (void)
       return 1;
     }
   printf ("found symbol %s in %s\n", i.dli_sname, i.dli_fname);
-  return i.dli_sname == NULL || strcmp (i.dli_sname, "printf") != 0;
+  return i.dli_sname == NULL
+	 || (strcmp (i.dli_sname, "printf") != 0
+	     /* On architectures which create PIC code by default
+		&printf may resolve to an address in libc.so
+		rather than in the binary.  printf and _IO_printf
+		are aliased and which one comes first in the
+		hash table is up to the linker.  */
+	     && strcmp (i.dli_sname, "_IO_printf") != 0);
 }
 
 #define TEST_FUNCTION do_test ()

	Jakub


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