Summary: | sys-devel/crossdev-20180508 / i686 / mingw: any exe crashs at start (CFLAGS=-mindirect-branch=thunk) | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | fkater <fkater> |
Component: | Current packages | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | CONFIRMED --- | ||
Severity: | normal | CC: | crossdev, embedded, fkater, jstein |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
the generated/crashing binary
output of emerge --info output of i686-w64-mingw32-gcc -v eventviewer entry after crash output of the crash dialog itself |
Description
fkater
2018-07-06 11:23:05 UTC
Can you provide a few more details? 1. 'emerge --info' for a host system 2. 'i686-w64-mingw32-gcc -v' output 3. attach binary resulting from 'i686-w64-mingw32-gcc test.c' compilation 4. crash details from windows box. maybe eventlog contains something like a backtrace with addresses. Created attachment 538568 [details]
the generated/crashing binary
Created attachment 538570 [details]
output of emerge --info
Created attachment 538572 [details]
output of i686-w64-mingw32-gcc -v
Created attachment 538574 [details]
eventviewer entry after crash
Created attachment 538576 [details]
output of the crash dialog itself
Thanks for asking. Attachements created. In your binary I see unusual code in CRT startup code like: 00401000 <___mingw_invalidParameterHandler>: 401000: ff 25 3a 15 40 00 jmp *0x40153a while mine (working) has: 00401000 <___mingw_invalidParameterHandler>: 401000: c3 ret I think it's caused by retpoline flags. Your CFLAGS are: CFLAGS="-march=core2 -g0 -O3 -pipe -fomit-frame-pointer -mindirect-branch=thunk -mfunction-return=thunk -mindirect-branch-register -fno-diagnostics-show-caret" Can you try to rebuild cross-i686-w64-mingw32/mingw64-runtime with safer CFLAGS (ideally drop flags one by one to find the culprit) and check it it workarounds failure for you? (In reply to Sergei Trofimovich from comment #8) > In your binary I see unusual code in CRT startup code like: > > 00401000 <___mingw_invalidParameterHandler>: > 401000: ff 25 3a 15 40 00 jmp *0x40153a > > while mine (working) has: > > 00401000 <___mingw_invalidParameterHandler>: > 401000: c3 ret > > I think it's caused by retpoline flags. Your CFLAGS are: > > CFLAGS="-march=core2 -g0 -O3 -pipe -fomit-frame-pointer > -mindirect-branch=thunk -mfunction-return=thunk -mindirect-branch-register > -fno-diagnostics-show-caret" > > Can you try to rebuild > cross-i686-w64-mingw32/mingw64-runtime > with safer CFLAGS (ideally drop flags one by one to find the culprit) and > check it it workarounds failure for you? Thanks for the terrific support. Leaving out all three -minderiect-* CFLAGS fixed the issue. I'll now try to recompile mingw64-runtime with some combinations of the above flags to narrow down the causes a bit further. Can the CFLAGS be specified for crossdev only, so elsewhere than in /etc/portage/make.conf, to keep that separate from the hosts CFLAGS? And here the results of more tests, for completeness: # # works # CFLAGS="-march=core2 -g0 -O3 -pipe -fomit-frame-pointer -fno-diagnostics-show-caret" # # variant1 -- crash # #CFLAGS="-march=core2 -g0 -O3 -pipe -fomit-frame-pointer -mindirect-branch=thunk -mfunction-return=thunk -fno-diagnostics-show-caret" # # variant2 -- crash # #CFLAGS="-march=core2 -g0 -O3 -pipe -fomit-frame-pointer -mindirect-branch=thunk -mindirect-branch-register -fno-diagnostics-show-caret" # # variant3 -- crash # #CFLAGS="-march=core2 -g0 -O3 -pipe -fomit-frame-pointer -mfunction-return=thunk -mindirect-branch-register -fno-diagnostics-show-caret" (In reply to fkater from comment #10) > Can the CFLAGS be specified for crossdev only, so elsewhere than in > /etc/portage/make.conf, to keep that separate from the hosts CFLAGS? I suggest using https://wiki.gentoo.org/wiki/etc/portage/package.env It should look like /etc/portage/env/safer-cflags.conf: CFLAGS="-march=core2 -g0 -O3 -pipe -fomit-frame-pointer -fno-diagnostics-show-caret" /etc/portage/package.env: cross-i686-w64-mingw32/mingw64-runtime safer-cflags.conf Invalid generated code it more likely a dev-util/mingw64-runtime bug or sys-devel/gcc bug (if trampolines can be statically resolved). Reassigning to toolchain@. |