Browse Source
* testsuite/ld-elf/pr21964-1a.c (foo): Renamed to ... (foo1): This. * testsuite/ld-elf/pr21964-1b.c: Rewrite. * testsuite/ld-elf/pr21964-1c.c: New file. * testsuite/ld-elf/pr21964-2c.c: Likewise. * testsuite/ld-elf/pr21964-2a.c (foo): Renamed to ... (foo1): This. * testsuite/ld-elf/pr21964-2b.c: Rewrite. * testsuite/ld-elf/shared.exp: Update PR ld/21964 tests.gdb-8.1-branch
8 changed files with 107 additions and 52 deletions
@ -0,0 +1,29 @@ |
|||
#include <stdio.h> |
|||
|
|||
extern int foo1 (void); |
|||
extern int foo2 (void); |
|||
|
|||
extern int __start___verbose[]; |
|||
extern int __stop___verbose[]; |
|||
static int my_var __attribute__((used, section("__verbose"))) = 6; |
|||
int |
|||
bar (void) |
|||
{ |
|||
if (__start___verbose == __stop___verbose) |
|||
return -1; |
|||
|
|||
if (__start___verbose[0] != 6) |
|||
return -2; |
|||
else |
|||
return 0; |
|||
} |
|||
|
|||
int |
|||
main () |
|||
{ |
|||
if (bar () == 0 |
|||
&& foo1 () == 0 |
|||
&& foo2 () == 0) |
|||
printf ("PASS\n"); |
|||
return 0; |
|||
} |
|||
@ -1,27 +1,12 @@ |
|||
#include <dlfcn.h> |
|||
#include <stdio.h> |
|||
|
|||
int main() |
|||
extern int __start___verbose[]; |
|||
extern int __stop___verbose[]; |
|||
int |
|||
foo2 (void) |
|||
{ |
|||
void *dl; |
|||
void *sym; |
|||
int (*func) (void); |
|||
|
|||
dl = dlopen("pr21964-2.so", RTLD_LAZY); |
|||
if (!dl) |
|||
return 1; |
|||
|
|||
sym = dlsym(dl, "__start___verbose"); |
|||
if (!sym) |
|||
return 2; |
|||
|
|||
func = dlsym(dl, "foo"); |
|||
if (!func) |
|||
return 3; |
|||
if (func () == 0) |
|||
printf ("PASS\n"); |
|||
|
|||
dlclose(dl); |
|||
|
|||
return 0; |
|||
static int my_var __attribute__((used, section("__verbose"))) = 10; |
|||
if (__start___verbose == __stop___verbose |
|||
|| __start___verbose[0] != 10) |
|||
return -1; |
|||
else |
|||
return 0; |
|||
} |
|||
|
|||
@ -0,0 +1,32 @@ |
|||
#include <dlfcn.h> |
|||
#include <stdio.h> |
|||
|
|||
extern int foo1 (void); |
|||
|
|||
int main() |
|||
{ |
|||
void *dl; |
|||
void *sym; |
|||
int (*func) (void); |
|||
|
|||
if (foo1 () != 0) |
|||
return 1; |
|||
|
|||
dl = dlopen("pr21964-2b.so", RTLD_LAZY); |
|||
if (!dl) |
|||
return 2; |
|||
|
|||
sym = dlsym(dl, "__start___verbose"); |
|||
if (!sym) |
|||
return 3; |
|||
|
|||
func = dlsym(dl, "foo2"); |
|||
if (!func) |
|||
return 4; |
|||
if (func () == 0) |
|||
printf ("PASS\n"); |
|||
|
|||
dlclose(dl); |
|||
|
|||
return 0; |
|||
} |
|||
Loading…
Reference in new issue