Thread overview
trouble with dmd + obj2asm under linux
Dec 28, 2008
Weed
Dec 29, 2008
Daniel Keep
Dec 29, 2008
Weed
December 28, 2008
I wrote and compile program:

$ dmd demo.d

And I need disassembly it:

$ obj2asm ./demo ./demo.d -cdemo.cod

And I see asm file "demo.cod" without names of functions:

==================
.init   segment
        assume  CS:.init
                push    EBP
                mov     EBP,ESP
                push    EBX
                sub     ESP,4
                call    near ptr LC
LC:             pop     EBX
                add     EBX,01056Ch
                mov     EDX,-8[EBX]
                test    EDX,EDX
                je      L22
                call    near ptr LC0
L22:            call    near ptr L3F8
                call    near ptr LD338
                pop     EAX
                pop     EBX
                leave
                ret
.init   ends
.plt    segment
        assume  CS:.plt
L0:             push    dword ptr [080591A4h]
                jmp     dword ptr [080591A8h]
==================


From other person I have received such listing with names:

==================
        assume  CS:_D4test1C5opAddMFC4test1CZC4test1C
L0:             push    EAX
                push    EBX
                push    offset FLAT:_D4test1C7__ClassZ
                call    near ptr __d_newclass
                mov     EBX,EAX
                mov     EAX,8[ESP]
                mov     ECX,8[EAX]
                mov     EDX,010h[ESP]
==================

What it is necessary to make such listing?


$ obj2asm
Digital Mars .OBJ file disassembler Version 8.51.3
Copyright (C) Digital Mars 2000-2007.  All Rights Reserved.
Written by Walter Bright  http://www.digitalmars.com/ctg/obj2asm.html
Use:
     obj2asm [-l] [-o] objfile[.obj] [srcfile] [-c[outfile[.cod]]]
        -c Specify output filename
        -l Omit generated code labels
        -o Output object code for each assembly instruction.
        -x Emit code offsets
December 29, 2008

Weed wrote:
> [snip]

If I had to guess, I'd say it's because you compiled without symbols. Try this:

$ dmd -g demo.d

 -- Daniel
December 29, 2008
Daniel Keep пишет:
> 
> 
> Weed wrote:
>> [snip]
> 
> If I had to guess, I'd say it's because you compiled without symbols. Try this:
> 
> $ dmd -g demo.d

Has varied nothing.
Names of functions and were earlier in a binary file, they are
enumerated from above (I have reduced them):

        public  _D2rt8typeinfo7ti_uint10TypeInfo_k5tsizeMFZk
        public  _d_isbaseof2
        public  _D6object14TypeInfo_Const5flagsMFZk
        extrn   pthread_key_create@@GLIBC_2.0
        public  _D4core6thread5Fiber9freeStackMFZv
        public  _D6object14TypeInfo_Tuple7getHashMFxPvZk
        public  _D2rt4deh29FuncTable6__initZ

.init   segment
        assume  CS:.init
                push    EBP
                mov     EBP,ESP



However, objdump works quite normally for D a code