4 ms·
GCC as expected, O>2 sub rsp, 8 mov rdi, QWORD PTR [rsi+8] mov edx, 10 xor esi, esi call strtol
by dom0 10y ago
GCC as expected, O>2
sub rsp, 8
mov rdi, QWORD PTR [rsi+8]
mov edx, 10
xor esi, esi
call strtol <-- atoi
xor eax, eax <-- zero return value
add rsp, 8
ret <-- return from main
Interestingly enough it does not elide the entire function body.
- gravypod 10y agoHow do you get objdump -S to print out non AT&T syntax? My output looked like this: 000000000400400 <main>: 400400: 48 83 ec 08 sub $0x8,%rsp 400404: 48 8b 7e 08 mov 0x8(%rsi),%rdi 400408: ba 0a 00 00 00 mov $0xa,%edx 40040d: 31 f6 xor %esi,%esi 40040f: e8 dc ff ff ff callq 4003f0 <strtol@plt> 400414: 31 c0 xor %eax,%eax 400416: 48 83 c4 08 add $0x8,%rsp 40041a: c3 retq 40041b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) Which I'm not a fan of. I've always wanted "add (store), (get)" but could never get that.
- dom0 10y agoNot on a development machine right now, so I just went to godbolt ;) https://godbolt.org/ https://godbolt.org/
- userbinator 10y agoUse the '-M intel' option.
- gens 10y ago-M intel