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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [binutils-2.20.1/] [ld/] [testsuite/] [ld-auto-import/] [client.c] - Blame information for rev 818

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 215 jeremybenn
#include <stdio.h>
2
 
3
extern int var;
4
extern void (*func_ptr)(void);
5
extern void print_var (void);
6
extern void print_foo (void);
7
extern int foo;
8
extern int var2[2];
9
 
10
typedef struct
11
{
12
  int *   var;
13
  void (* func_ptr)(void);
14
  int *   var_with_offset;
15
}
16
TEST;
17
 
18
TEST xyz = { & var, print_var, & var };
19
 
20
const TEST const_xyz = { & var, print_var, & var };
21
 
22
int
23
main (void)
24
{
25
  print_var ();
26
 
27
  printf ("We see var = %d\n", var);
28
  printf ("Setting var = 456\n");
29
 
30
  var = 456;
31
 
32
  print_var ();
33
  printf ("We see var = %d\n\n", var);
34
 
35
  var = 90;
36
  print_var ();
37
  printf ("We see var = %d\n\n", var);
38
 
39
  print_foo ();
40
  printf ("We see foo = %d\n", foo);
41
  printf ("Setting foo = 19\n");
42
  foo = 19;
43
  print_foo ();
44
  printf ("We see foo = %d\n\n", foo);
45
  fflush (stdout);
46
 
47
  printf ("Calling dllimported function pointer\n");
48
  func_ptr ();
49
 
50
  printf ("Calling functions using global structure\n");
51
  xyz.func_ptr ();
52
  * xyz.var = 40;
53
  xyz.func_ptr ();
54
 
55
  printf ("We see var2[0] = %d\n\n", var2[0]);
56
 
57
  printf ("We see const xyz %x %x\n", const_xyz.var, const_xyz.var_with_offset);
58
 
59
  return 0;
60
}

powered by: WebSVN 2.1.0

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