5 ms·
Fantastic tool for compiling x86 assembly code but I've grown to like GNU gas and its at&t syntax. Which do you prefer?
by mrlonglong 5y ago
Fantastic tool for compiling x86 assembly code but I've grown to like GNU gas and its at&t syntax. Which do you prefer?
- pjmlp 5y agoIntel, I ported my toy compiler Assembly generation from Intel to AT&T back when it wasn't yet supported on gas, never again.
- guerrilla 5y agoIn case anyone doesn't know, gas supports Intel syntax now.
- xbar 5y agoIntel. AT&T is immoral.
- mrlonglong 5y agoWhy?
- xbar 5y agohttps://outerproduct.net/2021-02-13_att-asm.html https://outerproduct.net/2021-02-13_att-asm.html
- userbinator 5y agoAlso the slightly earlier http://x86asm.net/articles/what-i-dislike-about-gas/ http://x86asm.net/articles/what-i-dislike-about-gas/
- msla 5y agoIntel. I can't bring myself to learn this: movl mem_location(%ebx,%ecx,4), %eax on any architecture where assemblers also support this: mov eax, [ebx + ecx*4 + mem_location]
- mrlonglong 5y agoEither works for me, I'm easy. Besides I cut my teeth on m68k and x86, and I do like how it keeps it easy with things like mov.b, mov.w and mov.l - keeps things clear what you're working with.
- messe 5y agoAgreed. I like `mov %src, dst` more than `mov [dst], src`, but GAS's `seg:disp(base, index, scale)` is insanity compared to Intel syntax.
- Galanwe 5y agoWould you agree that it makes more sense though? I tend to agree with you, I _want_ to write 'mv src, dst', but the other way around has some strong supporting reasons: - it's closer to the usual pseudo assembly "eax <- ebx" - it's closer to the mathematical "A = B" - on a more practical side, it's what was adopter by C standard library "memcpy(dst, src)" Thinking about it, there are more reasons to favor 'mov dst, src'. I think the culprit (at least for me) is that I cannot "pronounce" it correctly in my head. I have to use some peripheral sentence such as "move in dst the contents of src" instead of the more natural (but backward from the reading perspective) "move src to dst"
- rhn_mk1 5y agoNitpickery, but in the mathematical notation A = B is not an assignment (and is exactly the same as B = A). Assignment is more clearly written as A := B, but I never saw this as a maths thing, but as a programming convention.
- mrlonglong 5y agoDoes movl mem(%ebx + %ecx + 4), %ecx also work? If so that would read better than with the commas. (Sorry, can't quite recall how to get code snippet markup to work)
- flykespice 5y agoIntel is much more intuitive than At&t's (if at all)