4 ms·
Alternatively you can cut/paste the GAS syntax and use gcc. gcc -nostdlib hello.S -o hello This example uses the old 32-bit syscall invocation mechanism, w
by minimax 11y ago
Alternatively you can cut/paste the GAS syntax and use gcc.
gcc -nostdlib hello.S -o hello
This example uses the old 32-bit syscall invocation mechanism, which works fine under 64-bit Linux. It might be a useful exercise to try porting this program to the 64-bit syscall convention.
- mindcrime 11y agoAlternatively you can cut/paste the GAS syntax and use gcc. Oh, interesting. I didn't know you could do that with gcc. Thanks for the tip! This example uses the old 32-bit syscall invocation mechanism, which works fine under 64-bit Linux. It might be a useful exercise to try porting this program to the 64-bit syscall convention. I wasn't familiar with the difference, but some googling turned up this SO discussion which seems relevant. Maybe I will try making the change and see if I can get this to run with pure 64 bit code. http://stackoverflow.com/questions/8510333/x86-64-assembly-linux-system-call-confusion http://stackoverflow.com/questions/8510333/x86-64-assembly-l...
- oso2k 11y agoYou can extract the differences by looking at my librt0 [0] project. You can also see a minimal amd64 version in C here [1]. [0] https://github.com/lpsantil/rt0/blob/master/src/lib/syscall.c https://github.com/lpsantil/rt0/blob/master/src/lib/syscall.... [1] https://gist.github.com/lunixbochs/462ee21c3353c56b910f https://gist.github.com/lunixbochs/462ee21c3353c56b910f
- mindcrime 11y agoYou can also see a minimal amd64 version in C here [1]. Ah, that is very handy, and very illustrative. Thanks for sharing!