sys-boot/gnu-efi: Add custom-cflags flag and prevent avx instructions
authorMatthias Dahl <matthias.dahl@binary-island.eu>
Tue, 4 Jul 2017 08:02:11 +0000 (10:02 +0200)
committerMike Gilbert <floppym@gentoo.org>
Sun, 9 Jul 2017 15:07:40 +0000 (11:07 -0400)
Building gnu-efi with custom compiler flags is risky at best and should
generally be avoided.

Nevertheless, if custom flags are used, we need to make sure no avx instructions
are generated as those cause a non-functional gnu-efi build. This is only
required for >= 3.0.5 as prior to this, "-mno-sse" was used which also implied
no avx.

Fixes bug #619628.

sys-boot/gnu-efi/gnu-efi-3.0.6-r1.ebuild [moved from sys-boot/gnu-efi/gnu-efi-3.0.6.ebuild with 87% similarity]

similarity index 87%
rename from sys-boot/gnu-efi/gnu-efi-3.0.6.ebuild
rename to sys-boot/gnu-efi/gnu-efi-3.0.6-r1.ebuild
index 838f2b4ecb0cbb5f07c2e543ffea7f6ccd6c57ba..356ce6f38e93e91bfa6db298b5ea13db63d3c3ed 100644 (file)
@@ -19,7 +19,7 @@ SLOT="0"
 # IA64 build is broken in setjmp code:
 # https://sourceforge.net/p/gnu-efi/bugs/9/
 KEYWORDS="-* ~amd64 ~arm ~arm64 -ia64 ~x86"
-IUSE="abi_x86_32 abi_x86_64"
+IUSE="abi_x86_32 abi_x86_64 -custom-cflags"
 
 DEPEND="sys-apps/pciutils"
 RDEPEND=""
@@ -61,8 +61,15 @@ efimake() {
 src_compile() {
        tc-export BUILD_CC AR AS CC LD
 
-       # https://bugs.gentoo.org/607992
-       filter-mfpmath sse
+       if use custom-cflags; then
+               # https://bugs.gentoo.org/607992
+               filter-mfpmath sse
+
+               # https://bugs.gentoo.org/619628
+               append-flags $(test-flags-CC -mno-avx)
+       else
+               unset CFLAGS CPPFLAGS LDFLAGS
+       fi
 
        if [[ ${CHOST} == x86_64* ]]; then
                use abi_x86_32 && CHOST=i686 ABI=x86 efimake