X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com Message-ID: <46E02823.9080104@iki.fi> Date: Thu, 06 Sep 2007 19:17:39 +0300 From: Andris Pavenis User-Agent: Thunderbird 2.0.0.5 (X11/20070719) MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Problems cross-building DJGPP C library from Linux Content-Type: multipart/mixed; boundary="------------070901030002010408090208" X--MailScanner-Information: Please contact the ISP for more information X--MailScanner: Found to be clean X--MailScanner-From: andris DOT pavenis AT iki DOT fi X-Spam-Status: No Reply-To: djgpp-workers AT delorie DOT com This is a multi-part message in MIME format. --------------070901030002010408090208 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Run into 2 problems when cross-building DJGPP C library from Linux=20 x86_64. The first one is however not x86_64, but binutils-2.18 related. 1) The format of output of GAS version has been changed. Attached patch=20 fixes it, so it should work both with old and new binutils versions.=20 Verified with 2.18, but I don't see why it should not work with earlier versions 2) hostbin/dxegen.exe crashes with SIGSEGV. Perhaps length of integer=20 types variables messes things up: Output from GDB included Andris [andris AT ap SPECS]$ [andris AT ap libemu]$ gdb ../../hostbin/dxegen.exe=20 core.14895 GNU gdb Red Hat Linux (6.6-15.fc7rh) Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you = are welcome to change it and/or distribute copies of it under certain=20 conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for detail= s. This GDB was configured as "x86_64-redhat-linux-gnu"... Using host libthread_db library "/lib64/libthread_db.so.1". Reading symbols from /lib64/libc.so.6...done. Loaded symbols for /lib64/libc.so.6 Reading symbols from /lib64/ld-linux-x86-64.so.2...done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 Core was generated by `./../../hostbin/dxegen.exe ./../../bin/emu387.dxe=20 __emu_entry src/emu387.o id_e'. Program terminated with signal 11, Segmentation fault. #0 0x0000003d7be7869b in mempcpy () from /lib64/libc.so.6 (gdb) where #0 0x0000003d7be7869b in mempcpy () from /lib64/libc.so.6 #1 0x0000003d7be69d8e in _IO_file_xsgetn_internal () from /lib64/libc.so= .6 #2 0x0000003d7be60112 in fread () from /lib64/libc.so.6 #3 0x00000000004014f8 in write_dxe (inf=3D0x607160, outf=3D0x6073a0,=20 fh=3D0x7fff0b3c2400) at dxe3gen.c:553 #4 0x0000000000402d42 in main (argc=3D, argv=3D) at dxe3gen.c:1173 (gdb) f 3 #3 0x00000000004014f8 in write_dxe (inf=3D0x607160, outf=3D0x6073a0,=20 fh=3D0x7fff0b3c2400) at dxe3gen.c:553 553 fread(data, 1, sc.s_size, inf); (gdb) p sc $1 =3D {s_name =3D "<\000\000\000=EF=BF=BD{\000", s_paddr =3D 60000693125= 12, s_vaddr =3D=20 133384504344608, s_size =3D 13802688432960485005, s_scnptr =3D 9928521094656950272, s_relptr =3D 8466766210556585701,=20 s_lnnoptr =3D 14048700521977514787, s_nreloc =3D 0, s_nlnno =3D 16384, s_flags =3D 897625561524862975} (gdb) p /x sc $2 =3D {s_name =3D {0x3c, 0x0, 0x0, 0x0, 0xfc, 0x7b, 0x0, 0x0}, s_paddr =3D= =20 0x57500000000, s_vaddr =3D 0x795000000020, s_size =3D 0xbf8d00000000b68d, s_scnptr =3D 0x89c9315500000000, s_relp= tr=20 =3D 0x757fff02788166e5, s_lnnoptr =3D 0xc2f702b108508b23, s_nreloc =3D 0x0, s_nlnno =3D 0x4000, s_flags =3D 0xc7501b13fffffff} --------------070901030002010408090208 Content-Type: text/x-patch; name="djcrx-as_version.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="djcrx-as_version.diff" diff -up djgpp/src/makefile.inc.as_version djgpp/src/makefile.inc --- djgpp/src/makefile.inc.as_version 2007-09-06 19:01:47.000000000 +0300 +++ djgpp/src/makefile.inc 2007-09-06 18:48:33.000000000 +0300 @@ -20,8 +20,7 @@ endif # Set $(AS) before first use # -AS := $(shell $(CROSS_GCC) $(GCC_OPT) -print-prog-name=as) -AS := $(subst \,/,$(AS)) +AS := $(shell $(CROSS_GCC) $(GCC_OPT) -print-prog-name=as | sed 1q | sed 's:^.*\([1-9]\.[0-9\.]*\)$:\1:') # These were suggested by Tim Van Holder # but since $(CROSS_LD) is set in makefile.def and $(LD) is not used @@ -33,9 +32,9 @@ AS := $(subst \,/,$(AS)) # Figure out GAS version for use in *.S and inline asm compile flags # GAS_VERSION := $(subst ., ,$(shell $(AS) --version)) -GAS_MAJOR := $(word 3,$(GAS_VERSION)) -GAS_MINOR := $(word 4,$(GAS_VERSION)) -GAS_MINORMINOR := $(word 5,$(GAS_VERSION)) +GAS_MAJOR := $(word 1,$(GAS_VERSION)) +GAS_MINOR := $(word 2,$(GAS_VERSION)) +GAS_MINORMINOR := $(word 3,$(GAS_VERSION)) # Defaults for GAS version numbers ifeq ($(GAS_MAJOR),) --------------070901030002010408090208--