mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-07 06:43:00 +03:00
Update.
2000-10-21 Ulrich Drepper <drepper@redhat.com> * elf/dl-open.c (add_to_global): New function. Split out from dl_open_worker. (dl_open_worker): Call add_to_global not only for new objects, also for previously loaded objects when (mode & RTLD_GLOBAL) and the object was not yet in the global scope. * elf/Makefile: Add rules to build and run lateglobal. * elf/lateglobal.c: New file. * elf/ltglobmod1.c: New file. * elf/ltglobmod2.c: New file.
This commit is contained in:
32
elf/ltglobmod2.c
Normal file
32
elf/ltglobmod2.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
extern int bar (void);
|
||||
|
||||
int
|
||||
foo (void)
|
||||
{
|
||||
void *h;
|
||||
int res;
|
||||
|
||||
/* Load ltglobalmod1 in the global namespace. */
|
||||
h = dlopen ("ltglobmod1.so", RTLD_GLOBAL | RTLD_LAZY);
|
||||
if (h == NULL)
|
||||
{
|
||||
printf ("%s: cannot open %s: %s",
|
||||
__FUNCTION__, "ltglobmod1.so", dlerror ());
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Call bar. This is undefined in the DSO. */
|
||||
puts ("about to call `bar'");
|
||||
fflush (stdout);
|
||||
res = bar ();
|
||||
|
||||
printf ("bar returned %d\n", res);
|
||||
|
||||
dlclose (h);
|
||||
|
||||
return res != 42;
|
||||
}
|
Reference in New Issue
Block a user