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
* elf/dl-close.c: Include stddef.h.
(_dl_close): If called recursively, just remember GC needs to be rerun and decrease l_direct_opencount. Avoid GC if l_direct_opencount decreased to 1. Rerun GC at the end if any destructor unloaded some additional libraries. * elf/Makefile: Add rules to build and run unload6 test. * elf/unload6.c: New test. * elf/unload6mod1.c: New file. * elf/unload6mod2.c: New file. * elf/unload6mod3.c: New file. * malloc/hooks.c (mem2chunk_check): Add magic_p argument, set *magic_p if magic_p is not NULL. (top_check): Invoke MALLOC_FAILURE_ACTION if MORECORE failed. (malloc_check): Fail if sz == -1. (free_check): Adjust mem2chunk_check caller. (realloc_check): Likewise. Fail if bytes == -1. If bytes == 0 and oldmem != NULL, call free_check and return NULL. If reallocating and returning NULL, invert magic byte again to make oldmem valid region for further checking. (memalign_check): Fail if bytes == -1. * malloc/Makefile: Add rules to build and run tst-mcheck. * malloc/tst-mcheck.c: New test.
- Loading branch information
Ulrich Drepper
committed
Apr 27, 2005
1 parent
462be69
commit bfc832c
Showing
10 changed files
with
302 additions
and
26 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
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,30 @@ | ||
#include <dlfcn.h> | ||
#include <stdio.h> | ||
|
||
int | ||
main (void) | ||
{ | ||
void *h = dlopen ("unload6mod1.so", RTLD_LAZY); | ||
if (h == NULL) | ||
{ | ||
puts ("dlopen unload6mod1.so failed"); | ||
return 1; | ||
} | ||
|
||
int (*fn) (int); | ||
fn = dlsym (h, "foo"); | ||
if (fn == NULL) | ||
{ | ||
puts ("dlsym failed"); | ||
return 1; | ||
} | ||
|
||
int val = fn (16); | ||
if (val != 24) | ||
{ | ||
printf ("foo returned %d != 24\n", val); | ||
return 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,16 @@ | ||
#include <dlfcn.h> | ||
#include <stdio.h> | ||
|
||
int | ||
foo (int i) | ||
{ | ||
void *h = dlopen ("unload6mod2.so", RTLD_LAZY); | ||
if (h == NULL) | ||
{ | ||
puts ("dlopen unload6mod2.so failed"); | ||
return 1; | ||
} | ||
|
||
dlclose (h); | ||
return i + 8; | ||
} |
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,23 @@ | ||
#include <dlfcn.h> | ||
#include <stdio.h> | ||
#include <unistd.h> | ||
|
||
static void *h; | ||
|
||
static void __attribute__((constructor)) | ||
mod2init (void) | ||
{ | ||
h = dlopen ("unload6mod3.so", RTLD_LAZY); | ||
if (h == NULL) | ||
{ | ||
puts ("dlopen unload6mod3.so failed"); | ||
fflush (stdout); | ||
_exit (1); | ||
} | ||
} | ||
|
||
static void __attribute__((destructor)) | ||
mod2fini (void) | ||
{ | ||
dlclose (h); | ||
} |
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,23 @@ | ||
#include <dlfcn.h> | ||
#include <stdio.h> | ||
#include <unistd.h> | ||
|
||
static void *h; | ||
|
||
static void __attribute__((constructor)) | ||
mod3init (void) | ||
{ | ||
h = dlopen ("unload6mod1.so", RTLD_LAZY); | ||
if (h == NULL) | ||
{ | ||
puts ("dlopen unload6mod1.so failed"); | ||
fflush (stdout); | ||
_exit (1); | ||
} | ||
} | ||
|
||
static void __attribute__((destructor)) | ||
mod3fini (void) | ||
{ | ||
dlclose (h); | ||
} |
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
Oops, something went wrong.