flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
bitRAKE 07 Mar 2013, 04:43
Hopefully, this is still true - seems it would really help you:
http://stackoverflow.com/questions/972602/att-vs-intel-syntax-and-limitations Quote: GCC can do Intel syntax with -masm=intel |
|||
![]() |
|
zir_blazer 07 Mar 2013, 05:21
bitRAKE wrote: Hopefully, this is still true - seems it would really help you: Been there, done that. -masm=intel uses Intel syntax for instructions, but the rest is all of the AT&T data and metadata. Example: att.c C source Code: int a = 42; unsigned char b = 21; int main(int argc, char const *argv[]) { a = 99; b = 255; return 0;} gcc -S att.c (Default AT&T syntax) att.s content Code: .file "att.c" .globl _a .data .align 4 _a: .long 42 .globl _b _b: .byte 21 .def ___main; .scl 2; .type 32; .endef .text .globl _main .def _main; .scl 2; .type 32; .endef _main: LFB0: .cfi_startproc pushl %ebp .cfi_def_cfa_offset 8 .cfi_offset 5, -8 movl %esp, %ebp .cfi_def_cfa_register 5 andl $-16, %esp call ___main movl $99, _a movb $-1, _b movl $0, %eax leave .cfi_restore 5 .cfi_def_cfa 4, 4 ret .cfi_endproc LFE0: gcc -S -masm=intel att.c att.s content Code: .file "att.c" .intel_syntax noprefix .globl _a .data .align 4 _a: .long 42 .globl _b _b: .byte 21 .def ___main; .scl 2; .type 32; .endef .text .globl _main .def _main; .scl 2; .type 32; .endef _main: LFB0: .cfi_startproc push ebp .cfi_def_cfa_offset 8 .cfi_offset 5, -8 mov ebp, esp .cfi_def_cfa_register 5 and esp, -16 call ___main mov DWORD PTR _a, 99 mov BYTE PTR _b, -1 mov eax, 0 leave .cfi_restore 5 .cfi_def_cfa 4, 4 ret .cfi_endproc LFE0: As far that I know, in MASM, data is defined the same way that FASM, so that .long 42 should be dd 42, as .byte 21 should be db 21. So the output when using -masm=intel is a ugly mix of both Intel syntax and AT&T leftovers that makes reading it a pain. |
|||
![]() |
|
bitRAKE 07 Mar 2013, 08:31
Yeah, that sucks. I don't know what all that .cfi_* crap is - maybe there is a way to turn that off, and then do something like:
Code: .file fix ; .intel_syntax fix ; .globl fix extrn .data fix segment data .long fix dd .byte fix db .def fix label .text fix segment code Best way to learn x86 is in a debugger, imho. But that's how I learned. ![]() _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
![]() |
|
rugxulo 18 May 2013, 22:18
bitRAKE wrote: It's like - when is the last time you really tasted a potato? Usually, there is so much stuff on it... (Okay, I really can't resist here.) A baked potato is the blandest food on Earth! Apparently nobody "wants" to taste it all by itself! (Only thing worse is probably grits.) EDIT: Just to be vaguely on-topic: echo set disassembly-flavor intel > gdb.ini objdump -d -M intel blah.o All that .cfi stuff is new in GCC. Just use an older version to avoid it. (No, I can't remember why it's there either. Probably debugging or constructors or whatnot.) |
|||
![]() |
|
revolution 18 May 2013, 22:40
rugxulo wrote: (Okay, I really can't resist here.) A baked potato is the blandest food on Earth! Apparently nobody "wants" to taste it all by itself! |
|||
![]() |
|
HaHaAnonymous 19 May 2013, 00:32
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 20:29; edited 1 time in total |
|||
![]() |
|
randall 19 May 2013, 11:24
|
|||
![]() |
|
HaHaAnonymous 19 May 2013, 16:26
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 20:25; edited 1 time in total |
|||
![]() |
|
randall 19 May 2013, 18:20
HaHaAnonymous wrote:
A human is capable of doing anything. |
|||
![]() |
|
zir_blazer 20 May 2013, 23:43
randall wrote: http://gcc.godbolt.org/ I saw that link when this Thread was new because it was mentioned in the Heap forum. It took that link two months to get posted here. All the code that begins with a . seems to be the GCC linker metadata, so its not actual code. At least now I know where all those lines comes from. What I didn't recall if I ever found is a parameter to disable that linker metadata output. But I didn't needed it any longer considering I can just use that converter site that removes that by default. |
|||
![]() |
|
Bob++ 25 May 2013, 21:22
randall wrote:
Including Skynet. ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.