test_relocs.c revision d6dd2fcf84a73288fbdc5c207ec28ee877a19c9b
1/* this little test is written to check that the relocations generated
2 * in a shared library are correct. it depends on the content of lib_relocs.c
3 * being compiled as a shared object.
4 */
5#include <stdio.h>
6
7extern int  func1(void);
8extern int  func2(void);
9
10int
11main( void )
12{
13    int   f1, f2, expect1 = 1, expect2 = 2;
14
15    f1 = func1();
16    f2 = func2();
17
18    printf( "func1() returns %d: %s\n", f1, (f1 == expect1) ? "OK" : "FAIL" );
19    printf( "func2() returns %d: %s\n", f2, (f2 == expect2) ? "OK" : "FAIL" );
20
21    if (f1 != expect1 || f2 != expect2)
22        return 1;
23
24    return 0;
25}
26