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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [binutils-2.20.1/] [ld/] [testsuite/] [ld-shared/] [main.c] - Blame information for rev 859

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

Line No. Rev Author Line
1 205 julius
/* This is the main program for the shared library test.  */
2
 
3
#include <stdio.h>
4
 
5
int mainvar = 1;
6
int overriddenvar = 2;
7
extern int shlibvar1;
8
 
9
extern int shlib_mainvar ();
10
extern int shlib_overriddenvar ();
11
extern int shlib_shlibvar1 ();
12
extern int shlib_shlibvar2 ();
13
extern int shlib_shlibcall ();
14
extern int shlib_maincall ();
15
extern int shlib_checkfunptr1 ();
16
extern int shlib_checkfunptr2 ();
17
extern int (*shlib_getfunptr1 ()) ();
18
extern int (*shlib_getfunptr2 ()) ();
19
extern int shlib_check ();
20
extern int shlib_shlibcall2 ();
21
 
22
/* This function is called by the shared library.  */
23
 
24
int
25
main_called ()
26
{
27
  return 6;
28
}
29
 
30
/* This function overrides a function in the shared library.  */
31
 
32
int
33
shlib_overriddencall2 ()
34
{
35
  return 8;
36
}
37
 
38
int
39
main ()
40
{
41
  printf ("mainvar == %d\n", mainvar);
42
  printf ("overriddenvar == %d\n", overriddenvar);
43
  printf ("shlibvar1 == %d\n", shlibvar1);
44
#ifndef XCOFF_TEST
45
  printf ("shlib_mainvar () == %d\n", shlib_mainvar ());
46
  printf ("shlib_overriddenvar () == %d\n", shlib_overriddenvar ());
47
#endif
48
  printf ("shlib_shlibvar1 () == %d\n", shlib_shlibvar1 ());
49
  printf ("shlib_shlibvar2 () == %d\n", shlib_shlibvar2 ());
50
  printf ("shlib_shlibcall () == %d\n", shlib_shlibcall ());
51
#ifndef XCOFF_TEST
52
  printf ("shlib_shlibcall2 () == %d\n", shlib_shlibcall2 ());
53
  printf ("shlib_maincall () == %d\n", shlib_maincall ());
54
#endif
55
  printf ("main_called () == %d\n", main_called ());
56
#ifndef SYMBOLIC_TEST
57
  printf ("shlib_checkfunptr1 (shlib_shlibvar1) == %d\n",
58
          shlib_checkfunptr1 (shlib_shlibvar1));
59
#ifndef XCOFF_TEST
60
  printf ("shlib_checkfunptr2 (main_called) == %d\n",
61
          shlib_checkfunptr2 (main_called));
62
#endif
63
  {
64
    int (*p) ();
65
 
66
    p = shlib_getfunptr1 ();
67
    printf ("shlib_getfunptr1 () ");
68
    if (p == shlib_shlibvar1)
69
      printf ("==");
70
    else
71
      printf ("!=");
72
    printf (" shlib_shlibvar1\n");
73
  }
74
#ifndef XCOFF_TEST
75
  {
76
    int (*p) ();
77
 
78
    p = shlib_getfunptr2 ();
79
    printf ("shlib_getfunptr2 () ");
80
    if (p == main_called)
81
      printf ("==");
82
    else
83
      printf ("!=");
84
    printf (" main_called\n");
85
  }
86
#endif
87
#endif
88
  printf ("shlib_check () == %d\n", shlib_check ());
89
  return 0;
90
}

powered by: WebSVN 2.1.0

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