1 /* First C source file for actual execution test. */
3 /* The main point of this test is to make sure that the code and data
4 are truly position independent. We statically initialize several
5 global variables, and make sure that they are correctly adjusted at
12 char small_buf
[] = "aaaa";
13 char *small_pointer
= small_buf
;
14 char big_buf
[] = "aaaaaaaaaaaaaaaa";
15 char *big_pointer
= big_buf
;
28 int (*pfoo2
) () = foo2
;
35 /* Switch statements need extra effort to be position independent,
36 so we run one here, even though most of the cases will never be
72 /* This function is called by the assembler startup routine. It tries
73 to test that everything was correctly initialized. It returns 0 on
74 success, something else on failure. */
83 if (! chkstr (small_buf
, 4))
85 if (! chkstr (small_pointer
, 4))
87 if (! chkstr (big_buf
, 16))
89 if (! chkstr (big_pointer
, 16))
98 if ((*pfoo2
) (2) != 1)
107 if ((*pbar
) (0xa5a5a5a5) != -1)
111 if ((*pbar
) (0) != 0xa5a5a5a5)