Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Update.
2001-09-05 Ulrich Drepper <drepper@redhat.com> * elf/Makefile: Add rules to build new tests. Don't run them yet since they both fail. * elf/dblload.c: New file. * elf/dblloadmod1.c: New file. * elf/dblloadmod2.c: New file. * elf/dblloadmod3.c: New file. * elf/dblunload.c: New file.
- Loading branch information
Ulrich Drepper
committed
Sep 6, 2001
1 parent
9cd9ea1
commit 3fac000
Showing
7 changed files
with
157 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include <dlfcn.h> | ||
#include <mcheck.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
|
||
int | ||
main (void) | ||
{ | ||
void *p1; | ||
void *p2; | ||
int (*fp) (void); | ||
int result; | ||
|
||
mtrace (); | ||
|
||
p1 = dlopen ("dblloadmod1.so", RTLD_LAZY); | ||
if (p1 == NULL) | ||
{ | ||
printf ("cannot open dblloadmod1.so: %s\n", dlerror ()); | ||
exit (EXIT_FAILURE); | ||
} | ||
|
||
p2 = dlopen ("dblloadmod2.so", RTLD_LAZY); | ||
if (p1 == NULL) | ||
{ | ||
printf ("cannot open dblloadmod2.so: %s\n", dlerror ()); | ||
exit (EXIT_FAILURE); | ||
} | ||
|
||
fp = dlsym (p1, "foo"); | ||
if (fp == NULL) | ||
{ | ||
printf ("cannot get function \"foo\": %s\n", dlerror ()); | ||
exit (EXIT_FAILURE); | ||
} | ||
|
||
result = fp (); | ||
|
||
if (dlclose (p1) != 0) | ||
{ | ||
printf ("error while closing dblloadmod1.so: %s\n", dlerror ()); | ||
exit (EXIT_FAILURE); | ||
} | ||
|
||
if (dlclose (p2) != 0) | ||
{ | ||
printf ("error while closing dblloadmod2.so: %s\n", dlerror ()); | ||
exit (EXIT_FAILURE); | ||
} | ||
|
||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
extern int bar (void); | ||
|
||
int | ||
foo (void) | ||
{ | ||
return 10 + bar (); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
extern int bar (void); | ||
|
||
int | ||
baz (void) | ||
{ | ||
return -42; | ||
} | ||
|
||
int | ||
xyzzy (void) | ||
{ | ||
return 10 + bar (); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
extern int baz (void); | ||
|
||
int | ||
bar (void) | ||
{ | ||
return 32 + baz (); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include <dlfcn.h> | ||
#include <mcheck.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
|
||
int | ||
main (void) | ||
{ | ||
void *p1; | ||
void *p2; | ||
int (*fp) (void); | ||
int result; | ||
|
||
mtrace (); | ||
|
||
p1 = dlopen ("dblloadmod1.so", RTLD_LAZY); | ||
if (p1 == NULL) | ||
{ | ||
printf ("cannot load dblloadmod1.so: %s\n", dlerror ()); | ||
exit (EXIT_FAILURE); | ||
} | ||
|
||
p2 = dlopen ("dblloadmod2.so", RTLD_LAZY); | ||
if (p2 == NULL) | ||
{ | ||
printf ("cannot load dblloadmod2.so: %s\n", dlerror ()); | ||
exit (EXIT_FAILURE); | ||
} | ||
|
||
if (dlclose (p1) != 0) | ||
{ | ||
printf ("error while closing dblloadmod1.so: %s\n", dlerror ()); | ||
exit (EXIT_FAILURE); | ||
} | ||
|
||
fp = dlsym (p2, "xyzzy"); | ||
if (fp == NULL) | ||
{ | ||
printf ("cannot get function \"xyzzy\": %s\n", dlerror ()); | ||
exit (EXIT_FAILURE); | ||
} | ||
|
||
result = fp (); | ||
|
||
if (dlclose (p2) != 0) | ||
{ | ||
printf ("error while closing dblloadmod2.so: %s\n", dlerror ()); | ||
exit (EXIT_FAILURE); | ||
} | ||
|
||
return result; | ||
} |