AMD64 Linux

John Demme me at teqdruid.com
Wed Aug 23 22:47:22 PDT 2006


Thomas Kuehne wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> John Demme schrieb am 2006-08-21:
>>>> I've tried both compiling with GCC manually, and the 0.19 i386 binary
>>>> on the
>>>> website, but neither work properly.  When I use the i386 binary,
>>>> compiling a simple test program gives me:
>>>> /tmp/ccDMD2fb.s: Assembler messages:
>>>> /tmp/ccDMD2fb.s:10: Error: suffix or operands invalid for `push'
>>>> /tmp/ccDMD2fb.s:86: Error: suffix or operands invalid for `push'
>>>> /tmp/ccDMD2fb.s:93: Error: suffix or operands invalid for `pop'
> 
>> I had forgotten -m32, but didn't help...
> 
> Let's have a look at the offending file:
> 
> gdc -m32 -save-temps -c sample.d
> 
> This should generate a sample.s, where the lines 10, 86 and 93 are
> looking strange.
> 
> Thomas
> 
> 
> -----BEGIN PGP SIGNATURE-----
> 
> iD8DBQFE6qaBLK5blCcjpWoRAixTAJ4/2lSjaRdUD7OoS9ZeurHUkCJWWwCfUHv+
> sdhBEn3dVdsOppMloZv5D3E=
> =fWVm
> -----END PGP SIGNATURE-----


Thanks for your help... sorry I'm not responding quicker- I haven't had much
time to devote to this issue.  Here are the results.  They don't mean much
to me- I haven't bothered learning x86 assembly yet.

teqdruid at home ~/temp $ /user/gdc/bin/gdc -m32 -save-temps -c test.d
test.s: Assembler messages:
test.s:10: Error: suffix or operands invalid for `push'
test.s:86: Error: suffix or operands invalid for `push'
test.s:93: Error: suffix or operands invalid for `pop'
teqdruid at home ~/temp $ cat test.s
        .file   "test.d"
        .section        .rodata
.LC0:
        .string "Hello"
        .text
.globl _Dmain
        .type   _Dmain, @function
_Dmain:
.LFB2:
        pushl   %ebp
.LCFI0:
        movl    %esp, %ebp
.LCFI1:
        subl    $40, %esp
.LCFI2:
        andl    $-16, %esp
        movl    $0, %eax
        addl    $15, %eax
        addl    $15, %eax
        shrl    $4, %eax
        sall    $4, %eax
        subl    %eax, %esp
        movl    $5, -16(%ebp)
        movl    $.LC0, -12(%ebp)
        movl    -12(%ebp), %edx
        movl    $5, -8(%ebp)
        movl    $.LC0, -4(%ebp)
        movl    -8(%ebp), %eax
        movl    %edx, 12(%esp)
        movl    %eax, 8(%esp)
        movl    _arguments_Aa, %eax
        movl    _arguments_Aa+4, %edx
        movl    %eax, (%esp)
        movl    %edx, 4(%esp)
        call    _D3std5stdio8writeflnFYv
        movl    $0, %eax
        leave
        ret
.LFE2:
        .size   _Dmain, .-_Dmain
        .data
        .type   ___s.764, @object
        .size   ___s.764, 4
___s.764:
        .long   _init_11TypeInfo_Aa
        .weak   _arguments_Aa
        .section        .gnu.linkonce.d._arguments_Aa,"awG", at progbits,_arguments_Aa,comdat
        .align 4
        .type   _arguments_Aa, @object
        .size   _arguments_Aa, 8
_arguments_Aa:
        .long   1
        .long   ___s.764
.globl _ModuleInfo_4test
        .section        .rodata
.LC1:
        .string "test"
        .data
        .align 4
        .type   _ModuleInfo_4test, @object
        .size   _ModuleInfo_4test, 8
_ModuleInfo_4test:
        .long   0
        .long   0
        .long   4
        .long   .LC1
        .long   1
        .long   _ModuleInfo_4test+48
        .long   0
        .long   0
        .long   0
        .long   0
        .long   0
        .long   0
        .long   _ModuleInfo_3std5stdio
        .align 4
        .type   __mod_ref.782, @object
        .size   __mod_ref.782, 8
__mod_ref.782:
        .long   0
        .long   _ModuleInfo_4test
        .text
        .type   ___modinit4test, @function
___modinit4test:
.LFB3:
        pushl   %ebp
.LCFI3:
        movl    %esp, %ebp
.LCFI4:
        movl    _Dmodule_ref, %eax
        movl    %eax, __mod_ref.782
        movl    $__mod_ref.782, _Dmodule_ref
        popl    %ebp
        ret
.LFE3:
        .size   ___modinit4test, .-___modinit4test
        .section        .ctors,"aw", at progbits
        .align 4
        .long   ___modinit4test
        .section        .eh_frame,"a", at progbits
.Lframe1:
        .long   .LECIE1-.LSCIE1
.LSCIE1:
        .long   0x0
        .byte   0x1
        .string "zP"
        .uleb128 0x1
        .sleb128 -4
        .byte   0x8
        .uleb128 0x5
        .byte   0x0
        .long   __gdc_personality_v0
        .byte   0xc
        .uleb128 0x4
        .uleb128 0x4
        .byte   0x88
        .uleb128 0x1
        .align 4
.LECIE1:
.LSFDE1:
        .long   .LEFDE1-.LASFDE1
.LASFDE1:
        .long   .LASFDE1-.Lframe1
        .long   .LFB2
        .long   .LFE2-.LFB2
        .uleb128 0x0
        .byte   0x4
        .long   .LCFI0-.LFB2
        .byte   0xe
        .uleb128 0x8
        .byte   0x85
        .uleb128 0x2
        .byte   0x4
        .long   .LCFI1-.LCFI0
        .byte   0xd
        .uleb128 0x5
        .align 4
.LEFDE1:
        .ident  "GCC: (GNU) 4.0.3 (gdc 0.19, using dmd 0.162)"
        .section        .note.GNU-stack,"", at progbits
teqdruid at home ~/temp $ cat test.d
import std.stdio;

void main()
{
        writefln("Hello");
}


-- 
~John Demme
me at teqdruid.com
http://www.teqdruid.com/



More information about the D.gnu mailing list