This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/12575] New: dlopen RTLD_NOW does not apply to GNU-IFUNCs
- From: "jan.kratochvil at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: Sun, 13 Mar 2011 10:15:44 +0000
- Subject: [Bug libc/12575] New: dlopen RTLD_NOW does not apply to GNU-IFUNCs
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=12575
Summary: dlopen RTLD_NOW does not apply to GNU-IFUNCs
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper.fsp@gmail.com
ReportedBy: jan.kratochvil@redhat.com
`-Wl,-z,now' works and the GNU-IFUNC resolver is called before `main'.
But RTLD_NOW returns handle and GNU-IFUNC gets called only after `dlsym'.
Even if the executable calling dlopen(, RTLD_NOW) uses -Wl,-z,-now.
The first part of the test below is correct:
+ ./mc
f
main
But this part prints:
+ ./mcd
dlsym
f
while I expect:
+ ./mcd
f
dlsym
This behavior determines how the glibc Bug 2328 should be resolved in GDB.
cat >lc.c <<EOH
#include <stdio.h>
static int
fi (int a)
{
return a + 1;
}
asm (".type f, @gnu_indirect_function");
int (*
f (void)) (int a)
{
puts ("f");
return fi;
}
EOH
cat >mc.c <<EOH
#include <stdio.h>
extern int f (int a);
int
main (void)
{
puts ("main");
return f (-1);
}
EOH
cat >mcd.c <<EOH
#include <stdio.h>
#include <dlfcn.h>
int
main (void)
{
void *h = dlopen ("./lc.so", RTLD_NOW);
puts ("dlsym");
int (*fp) (int a) = (int (*) (int a)) dlsym (h, "f");
return fp (-1);
}
EOH
gcc -o lc.so lc.c -Wall -g -shared -fPIC; gcc -o mc mc.c -Wall -g -Wl,-z,now
./lc.so; gcc -o mcd mcd.c -Wall -g -Wl,-z,now -ldl; (set -x; ./mc; ./mcd)
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.