Update test files
[nasm/nasm.git] / test / elftest64.c
blob1f3dec1f6bc240a4ff3c6465d334915662d3f7d8
1 /*
2 * build with:
3 * nasm -f elf64 elf64so.asm
4 * ld -shared -o elf64so.so elf64so.o
5 * test with:
6 * gcc -o elf64so elftest64.c ./elf64so.so
7 * ./elf64so
8 */
10 #include <stdio.h>
11 #include <inttypes.h>
13 extern long lrotate(long, int);
14 extern void greet_s(void);
15 extern void greet_m(void);
16 extern int8_t asmstr[];
17 extern void *selfptr;
18 extern void *textptr;
19 extern long integer;
20 long commvar;
22 int main(void)
25 printf("Testing lrotate: should get 0x00400000, 0x00000001\n");
26 printf("lrotate(0x00040000, 4) = 0x%08lx\n", lrotate(0x40000, 4));
27 printf("lrotate(0x00040000, 46) = 0x%08lx\n", lrotate(0x40000, 46));
29 printf("This string should read `hello, world': `%s'\n", asmstr);
31 printf("&integer = %p, &commvar = %p\n", &integer, &commvar);
32 printf("The integers here should be 1234, 1235 and 4321:\n");
33 integer = 1234;
34 commvar = 4321;
35 greet_s();
36 greet_m();
38 printf("These pointers should be equal: %p and %p\n", &greet_s, textptr);
40 printf("So should these: %p and %p\n", selfptr, &selfptr);
42 return 0;