Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
glibc/elf/order2.c
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
46 lines (40 sloc)
761 Bytes
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
#include <dlfcn.h> | |
#include <stdio.h> | |
int call_puts; | |
static int | |
do_test (void) | |
{ | |
call_puts = 1; | |
void *h1 = dlopen ("$ORIGIN/order2mod1.so", RTLD_LAZY | RTLD_GLOBAL); | |
if (h1 == NULL) | |
{ | |
puts ("cannot load order2mod1"); | |
return 1; | |
} | |
void *h2 = dlopen ("$ORIGIN/order2mod2.so", RTLD_LAZY); | |
if (h2 == NULL) | |
{ | |
puts ("cannot load order2mod2"); | |
return 1; | |
} | |
if (dlclose (h1) != 0) | |
{ | |
puts ("dlclose order2mod1 failed"); | |
return 1; | |
} | |
if (dlclose (h2) != 0) | |
{ | |
puts ("dlclose order2mod2 failed"); | |
return 1; | |
} | |
return 0; | |
} | |
#define TEST_FUNCTION do_test () | |
#include "../test-skeleton.c" | |
static void | |
__attribute__ ((destructor)) | |
fini (void) | |
{ | |
if (call_puts) | |
puts ("5"); | |
} |