OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [gold/] [testsuite/] [ifuncmain5.c] - Blame information for rev 27

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 khays
/* Test STT_GNU_IFUNC symbols with dynamic function pointer only.  */
2
 
3
#include <stdlib.h>
4
 
5
extern int foo (void);
6
extern int foo_protected (void);
7
 
8
typedef int (*foo_p) (void);
9
 
10
extern foo_p __attribute__ ((noinline)) get_foo (void);
11
extern foo_p __attribute__ ((noinline)) get_foo_protected (void);
12
 
13
foo_p
14
__attribute__ ((noinline))
15
get_foo (void)
16
{
17
  return foo;
18
}
19
 
20
foo_p
21
__attribute__ ((noinline))
22
get_foo_protected (void)
23
{
24
  return foo_protected;
25
}
26
 
27
int
28
main (void)
29
{
30
  foo_p p;
31
 
32
  p = get_foo ();
33
  if ((*p) () != -1)
34
    abort ();
35
 
36
  p = get_foo_protected ();
37
  if ((*p) () != 0)
38
    abort ();
39
 
40
  return 0;
41
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.