3 * nasm -f elf64 elf64so.asm
4 * ld -shared -o elf64so.so elf64so.o
6 * gcc -o elf64so elftest64.c ./elf64so.so
13 extern long lrotate(long, int);
14 extern void greet_s(void);
15 extern void greet_m(void);
16 extern int8_t asmstr
[];
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");
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
);