www.digitalmars.com         C & C++   DMDScript  

D.gnu - AMD64 Linux

reply John Demme <me teqdruid.com> writes:
Does anyone have GDC working on an AMD64 linux system?

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'

As I recall, a similar error message occurs with my compiled version.

$ gcc -v
Reading specs from /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/specs
Configured
with: /var/tmp/portage/gcc-3.4.6-r1/work/gcc-3.4.6/configure --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/3.4.6
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.6
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.6/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.6/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/include/g++-v3
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--enable-nls --without-included-gettext --with-system-zlib --disable-checking
--disable-werror --disable-libunwind-exceptions --enable-multilib
--disable-libgcj --enable-languages=c,c++,f77 --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)

$ uname -r
2.6.17-gentoo-r3


Any suggestions?

Thanks

-- 
~John Demme
me teqdruid.com
http://www.teqdruid.com/
Aug 18 2006
parent reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Demme schrieb am 2006-08-18:
 Does anyone have GDC working on an AMD64 linux system?
Yes
 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 don't remember seeing those error messages. Did you try to add "-m32" to your command line? - From my adapted gdmd file: 123:my $gcc_version = `$gdc -m32 -dumpversion`; 128:my $target_machine = `$gdc -m32 -dumpmachine`; 291: my cmd = ($gdc, '-m32', '--version', out); 332: my cmd = ($gdc, '-m32', '-I/opt/gdc/gdc-0.19/include/d/3.4.6/i386-unknown-linux/', out, '-c', all_sources_hack, $srcf, '-o', $outf ); 342: my cmd = ($gdc, '-m32', '-L/usr/lib32', out, dobjects, objects, link_out);
 $ gcc -v
 Reading specs from /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/specs
 Configured
 with: /var/tmp/portage/gcc-3.4.6-r1/work/gcc-3.4.6/configure --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/3.4.6
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.6
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.6/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.6/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/include/g++-v3
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--enable-nls --without-included-gettext --with-system-zlib --disable-checking
--disable-werror --disable-libunwind-exceptions --enable-multilib
--disable-libgcj --enable-languages=c,c++,f77 --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
 Thread model: posix
 gcc version 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)
Reading specs from /opt/gdc/gdc-0.19/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/specs Configured with: ./configure --prefix=/opt/gdc/gdc-0.19 --enable-languages=c,d --enable-checking=misc,tree,gc,rtl,rtlflag,fold,gcac Thread model: posix gcc version 3.4.6 (Gentoo Hardened 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9) (gdc 0.19, using dmd 0.162) (You'll have to disable checking if you are going to build GPhobos.)
 $ uname -r
 2.6.17-gentoo-r3
2.6.16-hardened-r10 Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFE5rhELK5blCcjpWoRAstGAJ4iKij6P1BU/CCU6Bw6TFgAZuai0ACgl/Es O5JqypXbautwa9qEv9+n2C4= =YAKA -----END PGP SIGNATURE-----
Aug 19 2006
parent reply John Demme <me teqdruid.com> writes:
Thomas Kuehne wrote:

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 John Demme schrieb am 2006-08-18:
 Does anyone have GDC working on an AMD64 linux system?
Yes
 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 don't remember seeing those error messages. Did you try to add "-m32" to your command line? - From my adapted gdmd file: 123:my $gcc_version = `$gdc -m32 -dumpversion`; 128:my $target_machine = `$gdc -m32 -dumpmachine`; 291: my cmd = ($gdc, '-m32', '--version', out); 332: my cmd = ($gdc, '-m32', '-I/opt/gdc/gdc-0.19/include/d/3.4.6/i386-unknown-linux/', out, '-c', all_sources_hack, $srcf, '-o', $outf ); 342: my cmd = ($gdc, '-m32', '-L/usr/lib32', out, dobjects, objects, link_out);
 $ gcc -v
 Reading specs from /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/specs
 Configured
 with: /var/tmp/portage/gcc-3.4.6-r1/work/gcc-3.4.6/configure
 --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/3.4.6
 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/include
 --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.6
 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.6/man
 --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/3.4.6/info
 --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.6/include/g++-v3
 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
 --enable-nls --without-included-gettext --with-system-zlib
 --disable-checking --disable-werror --disable-libunwind-exceptions
 --enable-multilib --disable-libgcj --enable-languages=c,c++,f77
 --enable-shared --enable-threads=posix --enable-__cxa_atexit
 --enable-clocale=gnu Thread model: posix gcc version 3.4.6 (Gentoo
 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9)
Reading specs from /opt/gdc/gdc-0.19/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/specs Configured with: ./configure --prefix=/opt/gdc/gdc-0.19 --enable-languages=c,d --enable-checking=misc,tree,gc,rtl,rtlflag,fold,gcac Thread model: posix gcc version 3.4.6 (Gentoo Hardened 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9) (gdc 0.19, using dmd 0.162) (You'll have to disable checking if you are going to build GPhobos.)
 $ uname -r
 2.6.17-gentoo-r3
2.6.16-hardened-r10 Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFE5rhELK5blCcjpWoRAstGAJ4iKij6P1BU/CCU6Bw6TFgAZuai0ACgl/Es O5JqypXbautwa9qEv9+n2C4= =YAKA -----END PGP SIGNATURE-----
I had forgotten -m32, but didn't help... Thanks for the gdmd tweaks, but still no luck with either modded gdmd or gdc. -- ~John Demme me teqdruid.com http://www.teqdruid.com/
Aug 20 2006
parent reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----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-----
Aug 21 2006
parent reply John Demme <me teqdruid.com> writes:
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 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 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", 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", progbits .align 4 .long ___modinit4test .section .eh_frame,"a", 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,"", progbits teqdruid home ~/temp $ cat test.d import std.stdio; void main() { writefln("Hello"); } -- ~John Demme me teqdruid.com http://www.teqdruid.com/
Aug 23 2006
parent reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Demme schrieb am 2006-08-24:

 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 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 home ~/temp $ cat test.s
         pushl   %ebp
         pushl   %ebp
         popl    %ebp
It seems like the -m32 has been lost in the tool chain. test.s is 32bit but the compiler seems to use the 64bit assembly driver... -L/where/ever/gphobos/is The above should succeed and print: /opt/gdc/gdc-0.19/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/specs --enable-languages=c,d --enable-checking=misc,tree,gc,rtl,rtlflag,fold,gcac 0.19, using dmd 0.162) --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -pie -z relro -z now -o test /usr/lib/../lib32/Scrt1.o /usr/lib/../lib32/crti.o /opt/gdc/gdc-0.19/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/32/crtbeginS.o -L/where/ever/gphobos/is -L/opt/gdc/gdc-0.19/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/32 -L/opt/gdc/gdc-0.19/lib/gcc/x86_64-unknown-linux-gnu/3.4.6 -L/opt/gdc/gdc-0.19/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/../../../../lib32 -L/opt/gdc/gdc-0.19/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/../../.. -L/lib/../lib32 -L/usr/lib/../lib32 /tmp/ccQi0vUU.o -lgcc -lpthread -lgphobos -lgphobos -lm -lgcc_s_32 -lgcc -lm -lpthread -lc -lgcc_s_32 -lgcc /opt/gdc/gdc-0.19/lib/gcc/x86_64-unknown-linux-gnu/3.4.6/32/crtendS.o /usr/lib/../lib32/crtn.o If that fails - most likely the "--32" in the "as" line is missing - it is a GDC bug. The following should always succeed: -L/where/ever/gphobos/is Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFE7axaLK5blCcjpWoRAn7eAJ0QaoZOeKGXgBsMZHGwdzwZ04TYtQCgl7TG FGCHD7eIBgfLCht/xliwcXA= =5eOt -----END PGP SIGNATURE-----
Aug 24 2006
parent reply John Demme <me teqdruid.com> writes:
Thomas Kuehne wrote:

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 It seems like the -m32 has been lost in the tool chain. test.s is
 32bit but the compiler seems to use the 64bit assembly driver...
 





 
 The above should succeed and print:


























 
 If that fails - most likely the "--32" in the "as" line is missing - it is
 a GDC bug.
 
 The following should always succeed:





 
 Thomas
 
 
 -----BEGIN PGP SIGNATURE-----
 
 iD8DBQFE7axaLK5blCcjpWoRAn7eAJ0QaoZOeKGXgBsMZHGwdzwZ04TYtQCgl7TG
 FGCHD7eIBgfLCht/xliwcXA=
 =5eOt
 -----END PGP SIGNATURE-----
You are correct: the gdc -m32 -v was lacking the --32 on the as line. The direct GCC invocation worked correctly. Who is maintaining GDC these days that I might contact? Thanks a ton. -- ~John Demme me teqdruid.com http://www.teqdruid.com/
Aug 24 2006
parent reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Demme schrieb am 2006-08-24:
 Thomas Kuehne wrote:

 It seems like the -m32 has been lost in the tool chain. test.s is
 32bit but the compiler seems to use the 64bit assembly driver...
 





 
 The above should succeed and print:



























 
 If that fails - most likely the "--32" in the "as" line is missing - it is
 a GDC bug.
 
 The following should always succeed:





 You are correct: the gdc -m32 -v was lacking the --32 on the as line.  The
 direct GCC invocation worked correctly.
Try:
 Who is maintaining GDC these days that I might contact?
Please use the usuall bugzilla. Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFE7g7ZLK5blCcjpWoRAs1eAKCK7xvBBfXnUlpXxJl3+VB44iVhpgCfTZ2V J9jnUiwYI93xXY/AU818Bfw= =BwZP -----END PGP SIGNATURE-----
Aug 24 2006
parent Cristian Vlasceanu <cristian zero-bugs.com> writes:
Hi Guys,

Not sure if this is still actual, but one solution is to invoke gdmd 
like this:

setarch i386 gdmd a.d ... etc

(I am working with a couple of test cases John sent me the other day to 
study the interoperability of D and the Zero Debugger and ran into  the 
same issue -- setarch seems to help the compiler driver to pick the 
correct toolchain)

Cheers,
Cristian
Dec 08 2006