aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-elf/pr21964-5.c
blob: bc77422a5664f9b7dc2bebf11658229427786410 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>

extern int foo (void);

extern int __start___verbose[];
extern int __stop___verbose[];
int bar (void)
{
  static int my_var __attribute__((section("__verbose"), used)) = 6;
  int *ptr;
  ptr = (int*) dlsym(RTLD_DEFAULT, "__start___verbose");
  if (!ptr || *ptr != 6)
    return -1;
  return 0;
}

int main()
{
  if (bar () == 0)
    printf ("PASS\n");

  return 0;
}