all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ofv@wanadoo.es (Óscar Fuentes)
To: 19111@debbugs.gnu.org
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	[thread overview]
Message-ID: <87fvdfrl4p.fsf@telefonica.net> (raw)


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.





             reply	other threads:[~2014-11-19 20:27 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-19 20:27 Óscar Fuentes [this message]
2014-11-19 20:40 ` bug#19111: 25.0.50; 32 bits temacs.exe is linked with wrong image-base when built on 64 bit Windows host Eli Zaretskii
2014-11-19 21:27   ` Óscar Fuentes
2014-11-19 21:50     ` Óscar Fuentes
2014-11-19 22:01       ` Óscar Fuentes
2014-11-20  3:45         ` Eli Zaretskii
2014-11-20  3:43       ` Eli Zaretskii
2014-11-20  3:41     ` Eli Zaretskii
2014-11-20  4:10       ` Óscar Fuentes
2014-11-20 16:05         ` Eli Zaretskii
2014-11-20 16:23           ` Óscar Fuentes
2014-11-20 17:12             ` Eli Zaretskii
2014-11-20 18:30               ` Óscar Fuentes
2014-11-20 19:12                 ` Dani Moncayo
2014-11-20 21:03                 ` Eli Zaretskii
2014-11-21  0:07                   ` Óscar Fuentes
2014-11-21  8:28                     ` Eli Zaretskii
2014-11-21 14:15                       ` Óscar Fuentes
2014-11-21 15:03                         ` Eli Zaretskii
2014-11-21 16:06                           ` Dani Moncayo
2014-11-21 17:02                             ` Glenn Morris
2014-11-21 17:17                               ` Dani Moncayo
2014-11-21 17:21                                 ` Glenn Morris
2014-11-21 18:12                           ` Óscar Fuentes
2014-11-21 17:56                     ` Dani Moncayo
2014-11-21 18:01                       ` Dani Moncayo
2014-11-21 18:21                         ` Óscar Fuentes
2014-11-21 18:34                           ` Dani Moncayo
2014-11-21 18:41                             ` Óscar Fuentes
2014-11-21 22:54                               ` Óscar Fuentes
2014-11-22  1:05                                 ` Glenn Morris
2014-11-22  1:13                                   ` Óscar Fuentes
2014-11-25  2:38                                     ` Óscar Fuentes
2014-11-25 20:26                                       ` Dani Moncayo
2014-11-25 20:52                                         ` Óscar Fuentes
2014-11-25 21:13                                           ` Dani Moncayo
2014-11-25 23:41                                             ` Óscar Fuentes
2014-11-25 23:46                                               ` Dani Moncayo
2014-11-26  0:00                                                 ` Óscar Fuentes
2014-11-26  3:49                                                   ` Eli Zaretskii
2014-11-26 20:05                                                     ` Dani Moncayo
2014-11-29 10:07                                                       ` Dani Moncayo
2014-11-29 10:32                                                         ` Eli Zaretskii
2014-11-29 18:22                                                           ` Dani Moncayo
2014-11-29 18:31                                                             ` Eli Zaretskii
2014-11-29 19:25                                                               ` Dani Moncayo
2014-11-29 20:23                                                                 ` Eli Zaretskii
2014-11-29 20:37                                                                   ` Dani Moncayo
2014-11-29 20:52                                                                     ` Eli Zaretskii
2014-11-29 16:24                                                         ` Óscar Fuentes
2014-11-29 18:37                                                           ` Dani Moncayo
2014-11-29 18:49                                                             ` Eli Zaretskii
2014-11-29 19:23                                                               ` Dani Moncayo
2014-11-29 19:33                                                                 ` Achim Gratz
2014-11-29 19:41                                                                   ` Andreas Schwab
2014-11-29 19:45                                                                 ` Óscar Fuentes
2014-11-29 20:21                                                                 ` Eli Zaretskii
2014-11-25 23:42                                             ` Dani Moncayo
2014-11-22  8:46                                 ` Dani Moncayo
2014-11-22 10:16                                   ` Eli Zaretskii
2014-11-22 15:11                                   ` Óscar Fuentes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fvdfrl4p.fsf@telefonica.net \
    --to=ofv@wanadoo.es \
    --cc=19111@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.