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
Fix scope handling during dl_close
- Loading branch information
Andreas Schwab
committed
Aug 24, 2011
1 parent
22044b4
commit 39dd69d
Showing
8 changed files
with
103 additions
and
1 deletion.
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
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,33 @@ | ||
#include <dlfcn.h> | ||
#include <stdio.h> | ||
|
||
int | ||
main (void) | ||
{ | ||
void *h = dlopen ("$ORIGIN/unload8mod1.so", RTLD_LAZY); | ||
if (h == NULL) | ||
{ | ||
puts ("dlopen unload8mod1.so failed"); | ||
return 1; | ||
} | ||
|
||
void *h2 = dlopen ("$ORIGIN/unload8mod1x.so", RTLD_LAZY); | ||
if (h2 == NULL) | ||
{ | ||
puts ("dlopen unload8mod1x.so failed"); | ||
return 1; | ||
} | ||
dlclose (h2); | ||
|
||
int (*mod1) (void) = dlsym (h, "mod1"); | ||
if (mod1 == NULL) | ||
{ | ||
puts ("dlsym failed"); | ||
return 1; | ||
} | ||
|
||
mod1 (); | ||
dlclose (h); | ||
|
||
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,7 @@ | ||
extern void mod2 (void); | ||
|
||
void | ||
mod1 (void) | ||
{ | ||
mod2 (); | ||
} |
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 @@ | ||
int mod1x; |
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 void mod3 (void); | ||
|
||
void | ||
mod2 (void) | ||
{ | ||
mod3 (); | ||
} |
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,27 @@ | ||
#include <dlfcn.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
void | ||
mod3_fini2 (void) | ||
{ | ||
} | ||
|
||
void | ||
mod3_fini (void) | ||
{ | ||
mod3_fini2 (); | ||
} | ||
|
||
void | ||
mod3 (void) | ||
{ | ||
void *h = dlopen ("$ORIGIN/unload8mod2.so", RTLD_LAZY); | ||
if (h == NULL) | ||
{ | ||
puts ("dlopen unload8mod2.so failed"); | ||
exit (1); | ||
} | ||
|
||
atexit (mod3_fini); | ||
} |