1. main.cpp
#includeusing namespace std;extern "C" int GetValueFromGAS();int main(){ cout << "GAS said " << GetValueFromGAS() << endl; return 0;}
2. asm.asm
.section .text.global GetValueFromGASGetValueFromGAS: movq $25, %rax ret
3. 编译
as asm.asm -o asm.og++ asm.o main.cpp -o runme
4. 运行
./runme GAS said 25