file config.texi was initially added on branch binutils-2_17-branch.
[binutils.git] / ld / testsuite / ld-shared / main.c
blobce06261eb7ac57b1f84e10ff00e993c46ed4ba98
1 /* This is the main program for the shared library test. */
3 #include <stdio.h>
5 int mainvar = 1;
6 int overriddenvar = 2;
7 extern int shlibvar1;
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 ();
22 /* This function is called by the shared library. */
24 int
25 main_called ()
27 return 6;
30 /* This function overrides a function in the shared library. */
32 int
33 shlib_overriddencall2 ()
35 return 8;
38 int
39 main ()
41 int (*p) ();
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;