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

Subversion Repositories open8_urisc

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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 khays
/* Test STT_GNU_IFUNC symbols:
2
 
3
   1. Direct function call.
4
   2. Function pointer.
5
   3. Visibility.
6
 */
7
#include "ifunc-sel.h"
8
 
9
int global __attribute__ ((visibility ("protected"))) = -1;
10
 
11
static int
12
one (void)
13
{
14
  return 1;
15
}
16
 
17
static int
18
minus_one (void)
19
{
20
  return -1;
21
}
22
 
23
static int
24
zero (void)
25
{
26
  return 0;
27
}
28
 
29
void * foo_ifunc (void) __asm__ ("foo");
30
__asm__(".type foo, %gnu_indirect_function");
31
 
32
void *
33
foo_ifunc (void)
34
{
35
  return ifunc_sel (one, minus_one, zero);
36
}
37
 
38
void * foo_hidden_ifunc (void) __asm__ ("foo_hidden");
39
__asm__(".type foo_hidden, %gnu_indirect_function");
40
 
41
void *
42
foo_hidden_ifunc (void)
43
{
44
  return ifunc_sel (minus_one, one, zero);
45
}
46
 
47
void * foo_protected_ifunc (void) __asm__ ("foo_protected");
48
__asm__(".type foo_protected, %gnu_indirect_function");
49
 
50
void *
51
foo_protected_ifunc (void)
52
{
53
  return ifunc_sel (one, zero, minus_one);
54
}
55
 
56
/* Test hidden indirect function.  */
57
__asm__(".hidden foo_hidden");
58
 
59
/* Test protected indirect function.  */
60
__asm__(".protected foo_protected");
61
 
62
extern int foo (void);
63
extern int foo_hidden (void);
64
extern int foo_protected (void);
65
extern int ret_foo;
66
extern int ret_foo_hidden;
67
extern int ret_foo_protected;
68
 
69
#define FOO_P
70
typedef int (*foo_p) (void);
71
 
72
extern foo_p get_foo_p (void);
73
extern foo_p get_foo_hidden_p (void);
74
extern foo_p get_foo_protected_p (void);
75
 
76
foo_p
77
get_foo_p (void)
78
{
79
  ret_foo = foo ();
80
  return foo;
81
}
82
 
83
foo_p
84
get_foo_hidden_p (void)
85
{
86
  ret_foo_hidden = foo_hidden ();
87
  return foo_hidden;
88
}
89
 
90
foo_p
91
get_foo_protected_p (void)
92
{
93
  ret_foo_protected = foo_protected ();
94
  return foo_protected;
95
}

powered by: WebSVN 2.1.0

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