From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ofv@wanadoo.es (=?UTF-8?Q?=C3=93scar?= Fuentes) Newsgroups: gmane.emacs.bugs Subject: bug#19111: 25.0.50; 32 bits temacs.exe is linked with wrong image-base when built on 64 bit Windows host Date: Wed, 19 Nov 2014 21:27:50 +0100 Message-ID: <87fvdfrl4p.fsf@telefonica.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1416428974 3063 80.91.229.3 (19 Nov 2014 20:29:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Nov 2014 20:29:34 +0000 (UTC) To: 19111@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 19 21:29:27 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XrBsT-00057N-83 for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Nov 2014 21:29:25 +0100 Original-Received: from localhost ([::1]:60557 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrBsS-00049a-SW for geb-bug-gnu-emacs@m.gmane.org; Wed, 19 Nov 2014 15:29:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrBsJ-00048Q-Dk for bug-gnu-emacs@gnu.org; Wed, 19 Nov 2014 15:29:22 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XrBs6-00007w-9F for bug-gnu-emacs@gnu.org; Wed, 19 Nov 2014 15:29:14 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41491) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrBs6-00007m-5M for bug-gnu-emacs@gnu.org; Wed, 19 Nov 2014 15:29:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XrBs5-0003yK-Px for bug-gnu-emacs@gnu.org; Wed, 19 Nov 2014 15:29:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: ofv@wanadoo.es (=?UTF-8?Q?=C3=93scar?= Fuentes) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 Nov 2014 20:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19111 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.141642889815208 (code B ref -1); Wed, 19 Nov 2014 20:29:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Nov 2014 20:28:18 +0000 Original-Received: from localhost ([127.0.0.1]:38704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XrBrN-0003xC-DP for submit@debbugs.gnu.org; Wed, 19 Nov 2014 15:28:17 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:42098) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XrBrL-0003x4-1A for submit@debbugs.gnu.org; Wed, 19 Nov 2014 15:28:16 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XrBrE-0008Kf-3s for submit@debbugs.gnu.org; Wed, 19 Nov 2014 15:28:14 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:53254) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrBrD-0008KZ-Pu for submit@debbugs.gnu.org; Wed, 19 Nov 2014 15:28:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43673) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrBr7-0003Pr-9H for bug-gnu-emacs@gnu.org; Wed, 19 Nov 2014 15:28:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XrBr1-0008Df-0Q for bug-gnu-emacs@gnu.org; Wed, 19 Nov 2014 15:28:01 -0500 Original-Received: from smtp21.acens.net ([86.109.99.145]:42739 helo=smtp.movistar.es) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XrBr0-0008DL-ME for bug-gnu-emacs@gnu.org; Wed, 19 Nov 2014 15:27:54 -0500 X-CTCH-RefID: str=0001.0A0B020A.546CFD48.002E, ss=1, re=0.001, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-Spam: Unknown Original-Received: from qcore (79.158.48.132) by smtp.movistar.es (8.6.122.03) (authenticated as 981711563$telefonica.net) id 54430CAB0106897A for bug-gnu-emacs@gnu.org; Wed, 19 Nov 2014 20:27:52 +0000 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:96278 Building 32 bit Emacs `master' on MSYS2 64 bits on a Windows 64 bit host creates an invalid temacs.exe. What follows is the analysis made by an MSYS2 user (David Macek) on the MSYS2 mailing list: Few notes first. Running the binary directly from Windows shell causes appinfo to display an "app can't run on your PC" error, which is common for architecture mismatches (like when running x64 binary on x86 system). Running "strace ./temacs" confirmed it by displaying error code 193 (ERROR_BAD_EXE_FORMAT, "... is not a valid Win32 application"). The command that links temacs.exe on i686: > gcc -std=gnu99 -Demacs -I. -I. -I../lib -I../lib -mtune=generic > -pthread -mms-bitfields > -ID:/applications/msys2.x64/mingw32/include/librsvg-2.0 > -ID:/applications/msys2.x64/mingw32/include/gdk-pixbuf-2.0 > -ID:/applications/msys2.x64/mingw32/include/libpng16 > -ID:/applications/msys2.x64/mingw32/include/cairo > -ID:/applications/msys2.x64/mingw32/include/glib-2.0 > -ID:/applications/msys2.x64/mingw32/lib/glib-2.0/include > -ID:/applications/msys2.x64/mingw32/include/pixman-1 > -ID:/applications/msys2.x64/mingw32/include -I/mingw32/include > -I/mingw32/include/freetype2 -I/mingw32/include > -I/mingw32/include/libpng16 -I/mingw32/include/harfbuzz > -ID:/applications/msys2.x64/mingw32/include > -ID:/applications/msys2.x64/mingw32/include/freetype2 > -ID:/applications/msys2.x64/mingw32/include > -ID:/applications/msys2.x64/mingw32/include/harfbuzz > -ID:/applications/msys2.x64/mingw32/include/libpng16 -fopenmp > -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -D_DLL > -D_MT -fopenmp -DMAGICKCORE_HDR I_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -D_DLL -D_MT -ID:/applications/msys2.x64/mingw32/include/ImageMagick-6 -ID:/applications/msys2.x64/mingw32/include/libxml2 -ID:/applications/msys2.x64/mingw32/include/dbus-1.0 -ID:/applications/msys2.x64/mingw32/lib/dbus-1.0/include -MMD -MF deps/.d -MP -ID:/applications/msys2.x64/mingw32/include -ID:/applications/msys2.x64/mingw32/include/p11-kit-1 -ID:/applications/msys2.x64/mingw32/include -g3 -O2 -gdwarf-2 -Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x400000000 -Wl,-entry,__start -Wl,-Map,./temacs.map -o temacs firstfile.o dispnew.o frame.o scroll.o xdisp.o menu.o window.o charset.o coding.o category.o ccl.o character.o chartab.o bidi.o term.o terminal.o xfaces.o dbusbind.o emacs.o keyboard.o macros.o keymap.o sysdep.o buffer.o filelock.o insdel.o marker.o minibuf.o fileio.o dired.o cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o alloc.o data.o doc.o editfns.o callint.o eval.o floatfns.o fns.o font.o print.o lread.o syntax.o unexw32.o bytecode.o process.o gnutls.o callproc.o region-cache.o sound.o atimer.o doprnt.o intervals.o textprop.o composite.o xml.o w32notify.o profiler.o decompress.o w32fns.o w32menu.o w32reg.o w32font.o w32term.o w32xfns.o w32select.o w32uniscribe.o w32.o w32console.o w32heap.o w32inevt.o w32proc.o fontset.o fringe.o image.o tparam.o lastfile.o ../lib/libgnu.a emacs.res -lwinmm -lgdi32 -lcomdlg32 -lmpr -lwinspool -lole32 -lcomctl32 -lusp10 -LD:/applications/msys2.x64/mingw32/lib -lMagickWand-6.Q16HDRI -lMagickCore-6.Q16HDRI -LD:/applications/msys2.x64/mingw32/lib -ldbus-1 The offending argument is "-Wl,-image-base,0x400000000", which sets the executable to instruct Windows loader to load the executable at the 16 GiB mark or higher in virtual memory, which is ridiculous for a 32-bit program. So although the error message is not very clear, it's justified, this binary can't be loaded. I found the declaration in configure.ac in a case starting at line 4911. The linker argument is added there when building on 64-bit mingw, probably in an attempt to improve performance and/or compatibility. The problem is that even on i686, the $canonical triplet is "x86_64-pc-mingw32". I have not tried to find out why the triplet is wrong. The PKGBUILD doesn't have this problem because it always passes correct "--build=${MINGW_CHOST}" to configure.