Page MenuHomePhabricator

build: Disable AVX2 code path on mingw builds
AbandonedPublicDraft

Authored by PiRK on Oct 31 2023, 19:53.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

The stack is 16 byte aligned according to the ABI, but gcc assumes 32
byte alignment during register spilling (doesn't re-align the stack
pointer), resulting in ~50% chance of a crash.

Avoid this issue by disabling detection of AVX2 compiler support when
compiling with mingw-w64.

Upstream bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412

This is a backport of core#24727

Test Plan

@bot build-win64

Event Timeline

Tail of the build log:

  \-PE	    7f7fb3e00000-    7f7fb3e19000	\               shcore
ELF	    7f7fb3e19000-    7f7fb3e30000	Deferred        version<elf>
  \-PE	    7f7fb3e20000-    7f7fb3e30000	\               version
ELF	    7f7fb3e30000-    7f7fb3fe9000	Deferred        gdi32<elf>
  \-PE	    7f7fb3e50000-    7f7fb3fe9000	\               gdi32
ELF	    7f7fb3fe9000-    7f7fb4281000	Deferred        user32<elf>
  \-PE	    7f7fb4010000-    7f7fb4281000	\               user32
ELF	    7f7fb4281000-    7f7fb42e5000	Deferred        shlwapi<elf>
  \-PE	    7f7fb4290000-    7f7fb42e5000	\               shlwapi
ELF	    7f7fb42e5000-    7f7fb4d1e000	Deferred        shell32<elf>
  \-PE	    7f7fb4300000-    7f7fb4d1e000	\               shell32
ELF	    7f7fb4d1e000-    7f7fb4e10000	Deferred        msvcrt<elf>
  \-PE	    7f7fb4d40000-    7f7fb4e10000	\               msvcrt
ELF	    7f7fb4e10000-    7f7fb4e44000	Deferred        iphlpapi<elf>
  \-PE	    7f7fb4e20000-    7f7fb4e44000	\               iphlpapi
ELF	    7f7fb4e44000-    7f7fb4e6c000	Deferred        bcrypt<elf>
  \-PE	    7f7fb4e50000-    7f7fb4e6c000	\               bcrypt
ELF	    7f7fb4f6c000-    7f7fb5008000	Deferred        advapi32<elf>
  \-PE	    7f7fb4f80000-    7f7fb5008000	\               advapi32
ELF	    7f7fb5008000-    7f7fb501c000	Deferred        libnss_files.so.2
ELF	    7f7fb5286000-    7f7fb52ae000	Deferred        liblzma.so.5
ELF	    7f7fb52ae000-    7f7fb52c8000	Deferred        libgcc_s.so.1
ELF	    7f7fb52c8000-    7f7fb540c000	Deferred        libm.so.6
ELF	    7f7fb540c000-    7f7fb5427000	Deferred        libunwind.so.8
ELF	    7f7fb5429000-    7f7fb542f000	Deferred        libdl.so.2
ELF	    7f7fb542f000-    7f7fb5603000	Deferred        libc.so.6
ELF	    7f7fb5603000-    7f7fb5625000	Deferred        libpthread.so.0
ELF	    7f7fb5627000-    7f7fb5633000	Deferred        libffi.so.7
ELF	    7f7fb57df000-    7f7fb580c000	Deferred        ld-linux-x86-64.so.2
Threads:
process  tid      prio (all id:s are in hex)
0000000c services.exe
	0000000d    0
	0000000e    0
	0000001e    0
	0000002c    0
00000011 explorer.exe
	00000012    0
0000001c winedevice.exe
	0000001d    0
	0000001f    0
	00000020    0
0000002a winedevice.exe
	0000002b    0
	0000002d    0
	0000002e    0
	0000002f    0
	00000030    0
00000031 (D) Z:\results\artifacts\bin\test_bitcoin.exe
	00000032    0 <==
	00000056    0
	0000001b    0
	0000001a    0
System information:
    Wine build: wine-5.0.3 (Debian 5.0.3-3)
    Platform: x86_64
    Version: Windows 7
    Host system: Linux
    Host version: 4.19.0-10-amd64
Build build-win64 failed with exit code 5

@bot build-win64 gitian-win

Tail of the build log:

ELF	    7f0f89bd5000-    7f0f89bec000	Deferred        version<elf>
  \-PE	    7f0f89be0000-    7f0f89bec000	\               version
ELF	    7f0f89bec000-    7f0f89da5000	Deferred        gdi32<elf>
  \-PE	    7f0f89c00000-    7f0f89da5000	\               gdi32
ELF	    7f0f89da5000-    7f0f8a03d000	Deferred        user32<elf>
  \-PE	    7f0f89dd0000-    7f0f8a03d000	\               user32
ELF	    7f0f8a03d000-    7f0f8a0a1000	Deferred        shlwapi<elf>
  \-PE	    7f0f8a050000-    7f0f8a0a1000	\               shlwapi
ELF	    7f0f8a0a1000-    7f0f8aada000	Deferred        shell32<elf>
  \-PE	    7f0f8a0c0000-    7f0f8aada000	\               shell32
ELF	    7f0f8aada000-    7f0f8abcc000	Deferred        msvcrt<elf>
  \-PE	    7f0f8ab00000-    7f0f8abcc000	\               msvcrt
ELF	    7f0f8abcc000-    7f0f8ac00000	Deferred        iphlpapi<elf>
  \-PE	    7f0f8abe0000-    7f0f8ac00000	\               iphlpapi
ELF	    7f0f8ac00000-    7f0f8ac28000	Deferred        bcrypt<elf>
  \-PE	    7f0f8ac10000-    7f0f8ac28000	\               bcrypt
ELF	    7f0f8ad28000-    7f0f8adc4000	Deferred        advapi32<elf>
  \-PE	    7f0f8ad40000-    7f0f8adc4000	\               advapi32
ELF	    7f0f8adc4000-    7f0f8add8000	Deferred        libnss_files.so.2
ELF	    7f0f8b042000-    7f0f8b06a000	Deferred        liblzma.so.5
ELF	    7f0f8b06a000-    7f0f8b084000	Deferred        libgcc_s.so.1
ELF	    7f0f8b084000-    7f0f8b1c8000	Deferred        libm.so.6
ELF	    7f0f8b1c8000-    7f0f8b1e3000	Deferred        libunwind.so.8
ELF	    7f0f8b1e5000-    7f0f8b1eb000	Deferred        libdl.so.2
ELF	    7f0f8b1eb000-    7f0f8b3bf000	Deferred        libc.so.6
ELF	    7f0f8b3bf000-    7f0f8b3e1000	Deferred        libpthread.so.0
ELF	    7f0f8b3e3000-    7f0f8b3ef000	Deferred        libffi.so.7
ELF	    7f0f8b59b000-    7f0f8b5c8000	Deferred        ld-linux-x86-64.so.2
Threads:
process  tid      prio (all id:s are in hex)
0000000c services.exe
	0000000d    0
	0000000e    0
	00000020    0
	0000002e    0
	00000031    0
00000011 explorer.exe
	00000012    0
0000001e winedevice.exe
	0000001f    0
	00000021    0
	00000022    0
0000002c winedevice.exe
	0000002d    0
	0000002f    0
	00000030    0
	00000032    0
	00000033    0
00000034 (D) Z:\results\artifacts\bin\test_bitcoin.exe
	00000035    0 <==
	0000001c    0
	0000001d    0
	0000005a    0
System information:
    Wine build: wine-5.0.3 (Debian 5.0.3-3)
    Platform: x86_64
    Version: Windows 7
    Host system: Linux
    Host version: 4.19.0-10-amd64
Build build-win64 failed with exit code 5