DMD now incorporates a disassembler
Walter Bright
newshound2 at digitalmars.com
Sun Jan 9 23:03:19 UTC 2022
On 1/8/2022 10:04 PM, max haughton wrote:
> For GCC/Clang you'd want -S
I know about that, but take a look at it:
> cat fred.c
int fred(int a[10])
{
return a[11];
}
> cc -S test.c
> cat test.s
.file "test.c"
.text
.globl test
.type test, @function
test:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl $0, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size test, .-test
.ident "GCC: (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4"
.section .note.GNU-stack,"", at progbits
************************************************
Contrast with what -vasm does:
> cat test.d:
int fred(int* a)
{
return a[11];
}
> dmd -c test.d -vasm
_D4test4fredFPiZi:
0000: 8B 47 2C mov EAX,02Ch[RDI]
0003: C3 ret
***********************************************
-vasm gives me what I want to see. There aren't extra steps to getting it, the
object code is included, and all the boilerplate is omitted.
It's all about the friction.
More information about the Digitalmars-d-announce
mailing list