olawlor@ozzy:/me/olawlor/tmp/yasm_demo$ sudo apt-get install yasm make g++ Reading package lists... Done Building dependency tree Reading state information... Done g++ is already the newest version. make is already the newest version. yasm is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 64 not upgraded. olawlor@ozzy:/me/olawlor/tmp/yasm_demo$ cat > demo.cpp #include <iostream> extern "C" int diggit(void); int main() { std::cout<<"Diggit="<<diggit()<<"\n"; return 0; } olawlor@ozzy:/me/olawlor/tmp/yasm_demo$ olawlor@ozzy:/me/olawlor/tmp/yasm_demo$ cat > diggit.S section .text global diggit ; note no underscore on Linux diggit: mov eax,1234 ret olawlor@ozzy:/me/olawlor/tmp/yasm_demo$ yasm -f elf64 diggit.S olawlor@ozzy:/me/olawlor/tmp/yasm_demo$ g++ diggit.o demo.cpp olawlor@ozzy:/me/olawlor/tmp/yasm_demo$ ./a.out Diggit=1234 olawlor@ozzy:/me/olawlor/tmp/yasm_demo$
|