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.
2002-02-17 Andreas Schwab <schwab@suse.de> * reldep7.c: New file. * reldep7mod1.c: New file. * reldep7mod2.c: New file. * Makefile: Add rules to build and run reldep7.
- Loading branch information
Ulrich Drepper
committed
Apr 15, 2002
1 parent
78575a8
commit a41d8a7
Showing
5 changed files
with
96 additions
and
3 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,58 @@ | ||
#include <dlfcn.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int | ||
main (void) | ||
{ | ||
void *h1; | ||
void *h2; | ||
void *mod1_bar, *mod2_bar; | ||
|
||
h1 = dlopen ("reldep7mod1.so", RTLD_GLOBAL | RTLD_LAZY); | ||
if (h1 == NULL) | ||
{ | ||
printf ("cannot open reldep7mod1.so: %s\n", dlerror ()); | ||
exit (1); | ||
} | ||
|
||
h2 = dlopen ("reldep7mod2.so", RTLD_GLOBAL | RTLD_LAZY); | ||
if (h2 == NULL) | ||
{ | ||
printf ("cannot open reldep7mod1.so: %s\n", dlerror ()); | ||
exit (1); | ||
} | ||
|
||
mod1_bar = dlsym (h1, "mod1_bar"); | ||
if (mod1_bar == NULL) | ||
{ | ||
printf ("cannot get address of \"mod1_bar\": %s\n", dlerror ()); | ||
exit (1); | ||
} | ||
|
||
mod2_bar = dlsym (h2, "mod2_bar"); | ||
if (mod2_bar == NULL) | ||
{ | ||
printf ("cannot get address of \"mod2_bar\": %s\n", dlerror ()); | ||
exit (1); | ||
} | ||
|
||
printf ("%d\n", ((int (*) (void)) mod1_bar) ()); | ||
printf ("%d\n", ((int (*) (void)) mod2_bar) ()); | ||
|
||
if (dlclose (h1) != 0) | ||
{ | ||
printf ("closing h1 failed: %s\n", dlerror ()); | ||
exit (1); | ||
} | ||
|
||
printf ("%d\n", ((int (*) (void)) mod2_bar) ()); | ||
|
||
if (dlclose (h2) != 0) | ||
{ | ||
printf ("closing h2 failed: %s\n", dlerror ()); | ||
exit (1); | ||
} | ||
|
||
return 0; | ||
} |
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,12 @@ | ||
int foo (void) __attribute__ ((weak)); | ||
int | ||
foo (void) | ||
{ | ||
return 1; | ||
} | ||
|
||
int | ||
mod1_bar (void) | ||
{ | ||
return foo (); | ||
} |
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,12 @@ | ||
int foo (void) __attribute__ ((weak)); | ||
int | ||
foo (void) | ||
{ | ||
return 2; | ||
} | ||
|
||
int | ||
mod2_bar (void) | ||
{ | ||
return foo (); | ||
} |