From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Fix tst-addr1 on ppc64 and ia64
Date: Thu, 31 Aug 2006 15:38:00 -0000 [thread overview]
Message-ID: <20060831153800.GQ4556@sunsite.mff.cuni.cz> (raw)
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
next reply other threads:[~2006-08-31 15:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-31 15:38 Jakub Jelinek [this message]
2006-08-31 15:56 ` Steve Munroe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060831153800.GQ4556@sunsite.mff.cuni.cz \
--to=jakub@redhat.com \
--cc=drepper@redhat.com \
--cc=libc-hacker@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).