Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 596026

Summary: cross-i686-w64-mingw32/mingw64-runtime: -march=native triggers undefined __sync_val_compare_and_swap_4
Product: Gentoo Linux Reporter: Paul Fertser <fercerpav>
Component: Current packagesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED NEEDINFO    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Paul Fertser 2016-10-03 09:21:45 UTC
When using "crossdev -t i686-w64-mingw32" building of GCC stage2 fails because it tries to link to libraries from mingw64-runtime which reference __sync_val_compare_and_swap_4 which is supposed to be GCC builtin, so linking obviously fails.

Rebuilding mingw64-runtime without -march=native in CFLAGS solves the issue.
Comment 1 SpanKY gentoo-dev 2017-02-15 08:56:32 UTC
i don't think it's a bug in the mingw runtime.  gcc shouldn't have generated that reference if its target runtime doesn't support it.

please attach full build logs and crossdev output in every bug report you file.
Comment 2 Paul Fertser 2017-02-15 09:24:06 UTC
I'm not saying it's a bug in mingw runtime, I'm saying that the way cross-i686-w64-mingw32/mingw64-runtime is currently getting built with -march=native is producing incorrect results (while x86_64 version is fine). And the problem surfaces only later, when someone is actually trying to link something to that runtime.
Are you not able to reproduce it on your machine with -march=native by emerging cross-i686-w64-mingw32/mingw64-runtime and then checking the generated binaries for __sync_val_compare_and_swap_4 relocations (there should be none, as it's a GCC builtin)? If yes, please tell me what cross-gcc and mingw runtime versions you're using. At the moment I was reporting that bug I was experiencing the issue with cross-i686-w64-mingw32/gcc-5.4.0 and cross-i686-w64-mingw32/mingw64-runtime-4.0.6.
Please advice me on what particular logs you need, do you really mean you want full build log for gcc stage1, mingw runtime and gcc stage2 failed attempt?