Bug 194641 - [EFI] boot/loader.efi: miscompilation on Intel Haswell with AVX2 and CPUTYPE=native
Summary: [EFI] boot/loader.efi: miscompilation on Intel Haswell with AVX2 and CPUTYPE=...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
Keywords: uefi
Depends on:
Blocks: 231027
  Show dependency treegraph
Reported: 2014-10-27 19:24 UTC by O. Hartmann
Modified: 2020-06-18 21:11 UTC (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2014-10-27 19:24:42 UTC
Compileing world on Intel Haswell with CPUTYPE?=native set in either /etc/make.conf and/or /etc/src.conf renders /boot/loader.efi to fail: the EFI boot process stops and freezes when loader.efi is loaded.

The problem affects only Haswell-based hardware (from my point of view, it seems to be AVX2), since Sandy_bridge and Ivy-Bridge based systems do not show the problem, even if world/kernel is compiled with -O3 and -march=native as I have tested on several CURRENT systems with most recent CURRENT as of today (FreeBSD 11.0-CURRENT #2 r273743: Mon Oct 27 19:51:01 CET 2014 amd64).

The problem has been discussed recently on the CURRENT mailing list, but no PR has been issued so far.

Please look at 


Comment 1 Ed Maste freebsd_committer 2014-11-26 19:34:28 UTC
Note, adding -mno-avx2 reported not to help:

It appears the flags are not passed into libefi.
Comment 2 Warner Losh freebsd_committer 2017-11-20 21:06:55 UTC
Does CPUTYPE=haswell also cause this issue?

And more importantly, this was from 3 years ago...  Can someone confirm the problem still exists...
Comment 3 Warner Losh freebsd_committer 2017-11-20 23:43:22 UTC
I think that https://svnweb.freebsd.org/changeset/base/326038 fixed this. Can someone who is in a position to test please confirm?
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:50:02 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

- Set Status to "Open"
Comment 5 Ed Maste freebsd_committer 2018-08-31 18:25:52 UTC
I just tried this again in my WIP branch and loader.efi still hangs with CPUTYPE?=native in src.conf.
Comment 6 Ed Maste freebsd_committer 2018-08-31 18:35:52 UTC
comparing builds with and without the src.conf setting shows -march=native in the cc commandline
Comment 7 Warner Losh freebsd_committer 2018-08-31 19:52:41 UTC
I know how to paper over this bug :)
Comment 8 Ed Maste freebsd_committer 2019-09-16 19:31:24 UTC
Any update @imp?
Comment 9 Rebecca Cran freebsd_committer 2019-09-16 19:39:14 UTC
I'm starting to think there's a miscompilation or other build problem in general, too. I've been seeing memory corruption when using the new HTTP boot feature that appears to be in our binary.