mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-19 07:13:40 +08:00
823143c6ca
Define __start/__stop symbols if they are referenced by shared objects, not if they are also defined in shared objects. bfd/ PR ld/21964 * elflink.c (bfd_elf_define_start_stop): Check if __start and __stop symbols are referenced by shared objects. ld/ PR ld/21964 * testsuite/ld-elf/pr21964-4.c: New file. * testsuite/ld-elf/shared.exp: Run pr21964-4 test on Linux.
23 lines
396 B
C
23 lines
396 B
C
#define _GNU_SOURCE
|
|
#include <dlfcn.h>
|
|
#include <stdio.h>
|
|
|
|
extern int __start___verbose[];
|
|
int bar (void)
|
|
{
|
|
static int my_var __attribute__ ((section("__verbose"), used)) = 6;
|
|
int *ptr;
|
|
ptr = (int*) dlsym (RTLD_DEFAULT, "__start___verbose");
|
|
if (ptr != NULL || __start___verbose[0] != 6)
|
|
return -1;
|
|
return 0;
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
if (bar () == 0)
|
|
printf ("PASS\n");
|
|
return 0;
|
|
}
|