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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.18.50/] [ld/] [testsuite/] [ld-shared/] [main.c] - Blame information for rev 455

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

Line No. Rev Author Line
1 38 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
  int (*p) ();
42
 
43
  printf ("mainvar == %d\n", mainvar);
44
  printf ("overriddenvar == %d\n", overriddenvar);
45
  printf ("shlibvar1 == %d\n", shlibvar1);
46
#ifndef XCOFF_TEST
47
  printf ("shlib_mainvar () == %d\n", shlib_mainvar ());
48
  printf ("shlib_overriddenvar () == %d\n", shlib_overriddenvar ());
49
#endif
50
  printf ("shlib_shlibvar1 () == %d\n", shlib_shlibvar1 ());
51
  printf ("shlib_shlibvar2 () == %d\n", shlib_shlibvar2 ());
52
  printf ("shlib_shlibcall () == %d\n", shlib_shlibcall ());
53
#ifndef XCOFF_TEST
54
  printf ("shlib_shlibcall2 () == %d\n", shlib_shlibcall2 ());
55
  printf ("shlib_maincall () == %d\n", shlib_maincall ());
56
#endif
57
  printf ("main_called () == %d\n", main_called ());
58
#ifndef SYMBOLIC_TEST
59
  printf ("shlib_checkfunptr1 (shlib_shlibvar1) == %d\n",
60
          shlib_checkfunptr1 (shlib_shlibvar1));
61
#ifndef XCOFF_TEST
62
  printf ("shlib_checkfunptr2 (main_called) == %d\n",
63
          shlib_checkfunptr2 (main_called));
64
#endif
65
  p = shlib_getfunptr1 ();
66
  printf ("shlib_getfunptr1 () ");
67
  if (p == shlib_shlibvar1)
68
    printf ("==");
69
  else
70
    printf ("!=");
71
  printf (" shlib_shlibvar1\n");
72
#ifndef XCOFF_TEST
73
  p = shlib_getfunptr2 ();
74
  printf ("shlib_getfunptr2 () ");
75
  if (p == main_called)
76
    printf ("==");
77
  else
78
    printf ("!=");
79
  printf (" main_called\n");
80
#endif
81
#endif
82
  printf ("shlib_check () == %d\n", shlib_check ());
83
  return 0;
84
}

powered by: WebSVN 2.1.0

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