mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-24 14:00:30 +00:00
d57a3f0e02
2003-08-11 Carlos O'Donell <carlos@baldric.uwo.ca> * dlfcn/default.c (main): Cast dlsym loaded value to same type as main. Address passed to test_in_mod1 and test_in_mod2 without casting. * dlfcn/defaultmod1.c: Change prototype of test_in_mod1. (test_in_mod1): Cast dlsym loaded value to same type as mainp. * dlfcn/defaultmod2.c: Change prototype of test_in_mod2. (test_in_mod2): Cast dlsym loaded value to same type as mainp. 2003-08-15 Jakub Jelinek <jakub@redhat.com> * sysdeps/sparc/sparc32/elf/configure.in (libc_cv_sparc32_tls): Change quotes before using []. * sysdeps/unix/sysv/linux/sparc/sys/user.h: New file. * sysdeps/sparc/sparc32/bits/atomic.h (__sparc32_atomic_lock): Renamed to... (__sparc32_atomic_locks): ...this. Change into 64-byte array. (__sparc32_atomic_do_lock, __sparc32_atomic_do_unlock): Add addr argument. Select one of 64 locks from address bits. (atomic_compare_and_exchange_val_acq, atomic_compare_and_exchange_bool_acq): Pass memory address to __sparc32_atomic_do_{,un}lock.
72 lines
1.4 KiB
C
72 lines
1.4 KiB
C
#include <dlfcn.h>
|
|
#include <stdio.h>
|
|
|
|
extern int found_in_mod1 (void);
|
|
int
|
|
found_in_mod1 (void)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
extern int found_in_mod2 (void);
|
|
int
|
|
found_in_mod2 (void)
|
|
{
|
|
return 2;
|
|
}
|
|
|
|
|
|
extern int test_in_mod2 (int (*mainp)(int, char **));
|
|
int
|
|
test_in_mod2 (int (*mainp)(int, char **))
|
|
{
|
|
int (*ifp) (void);
|
|
void *p;
|
|
int result = 0;
|
|
|
|
/* Find function `main'. */
|
|
p = dlsym (RTLD_DEFAULT, "main");
|
|
if (p == NULL)
|
|
{
|
|
printf ("%s: main not found\n", __FILE__);
|
|
result = 1;
|
|
}
|
|
else if ((int (*)(int, char **))p != mainp)
|
|
{
|
|
printf ("%s: wrong address returned for main\n", __FILE__);
|
|
result = 1;
|
|
}
|
|
else
|
|
printf ("%s: main correctly found\n", __FILE__);
|
|
|
|
ifp = dlsym (RTLD_DEFAULT, "found_in_mod1");
|
|
if ((void *) ifp == NULL)
|
|
{
|
|
printf ("%s: found_in_mod1 not found\n", __FILE__);
|
|
result = 1;
|
|
}
|
|
else if (ifp () != 1)
|
|
{
|
|
printf ("%s: wrong address returned for found_in_mod1\n", __FILE__);
|
|
result = 1;
|
|
}
|
|
else
|
|
printf ("%s: found_in_mod1 correctly found\n", __FILE__);
|
|
|
|
ifp = dlsym (RTLD_DEFAULT, "found_in_mod2");
|
|
if ((void *) ifp == NULL)
|
|
{
|
|
printf ("%s: found_in_mod2 not found\n", __FILE__);
|
|
result = 1;
|
|
}
|
|
else if (ifp () != 2)
|
|
{
|
|
printf ("%s: wrong address returned for found_in_mod2\n", __FILE__);
|
|
result = 1;
|
|
}
|
|
else
|
|
printf ("%s: found_in_mod2 correctly found\n", __FILE__);
|
|
|
|
return result;
|
|
}
|