mirror of
https://git.yoctoproject.org/poky
synced 2026-04-27 21:32:13 +02:00
grub2: fix build on gcc where _FORTIFY_SOURCE is defined
* e.g. with gentoo gcc-7.1 they define _FORTIFY_SOURCE by default with: https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/gcc/7.1.0/gentoo/10_all_default-fortify-source.patch?view=markup which results in following error while building grub-efi-native: ./config-util.h:1504:48: error: this use of "defined" may not be portable [-Werror=expansion-to-defined] || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ ^~~~~~~~~~~~~~~ this part comes from gnulib and it's used only for Apple and BSD, so we can ignore it, but we cannot add -Wno-error=expansion-to-defined because this warning was introduced only in gcc-7 and older gcc will fail with: cc1: error: -Werror=expansion-to-defined: no option -Wexpansion-to-defined use #pragma to work around this (From OE-Core rev: f5302b0ad2942f7705d46c33949ebc1c5ddf3f58) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
1a73074d75
commit
ed52aa9e79
39
meta/recipes-bsp/grub/files/fix.build.with.gcc-7.patch
Normal file
39
meta/recipes-bsp/grub/files/fix.build.with.gcc-7.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
* e.g. with gentoo gcc-7.1 they define _FORTIFY_SOURCE by default with:
|
||||
https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo/src/patchsets/gcc/7.1.0/gentoo/10_all_default-fortify-source.patch?view=markup
|
||||
which results in following error while building grub-efi-native:
|
||||
./config-util.h:1504:48: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
|
||||
|| (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \
|
||||
^~~~~~~~~~~~~~~
|
||||
this part comes from gnulib and it's used only for Apple and BSD,
|
||||
so we can ignore it, but we cannot add -Wno-error=expansion-to-defined
|
||||
because this warning was introduced only in gcc-7 and older gcc
|
||||
will fail with:
|
||||
cc1: error: -Werror=expansion-to-defined: no option -Wexpansion-to-defined
|
||||
use #pragma to work around this
|
||||
|
||||
Upstream-Status: Pending (should be fixed in gnulib which is then rarely updated in grub)
|
||||
|
||||
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
|
||||
|
||||
diff -uNr grub-2.02.old/m4/extern-inline.m4 grub-2.02/m4/extern-inline.m4
|
||||
--- grub-2.02.old/m4/extern-inline.m4 2016-02-28 15:22:21.000000000 +0100
|
||||
+++ grub-2.02/m4/extern-inline.m4 2017-08-22 19:26:45.213637276 +0200
|
||||
@@ -39,6 +39,10 @@
|
||||
OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and
|
||||
for clang but remains for g++; see <http://trac.macports.org/ticket/41033>.
|
||||
Assume DragonFly and FreeBSD will be similar. */
|
||||
+#pragma GCC diagnostic push
|
||||
+#if __GNUC__ >= 7
|
||||
+#pragma GCC diagnostic ignored "-Wexpansion-to-defined"
|
||||
+#endif
|
||||
#if (((defined __APPLE__ && defined __MACH__) \
|
||||
|| defined __DragonFly__ || defined __FreeBSD__) \
|
||||
&& (defined __header_inline \
|
||||
@@ -50,6 +52,7 @@
|
||||
&& defined __GNUC__ && ! defined __cplusplus))))
|
||||
# define _GL_EXTERN_INLINE_STDHEADER_BUG
|
||||
#endif
|
||||
+#pragma GCC diagnostic pop
|
||||
#if ((__GNUC__ \
|
||||
? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
|
||||
: (199901L <= __STDC_VERSION__ \
|
||||
@@ -17,6 +17,7 @@ SRC_URI = "https://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
|
||||
file://autogen.sh-exclude-pc.patch \
|
||||
file://grub-module-explicitly-keeps-symbole-.module_license.patch \
|
||||
file://0001-grub.d-10_linux.in-add-oe-s-kernel-name.patch \
|
||||
file://fix.build.with.gcc-7.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "1116d1f60c840e6dbd67abbc99acb45d"
|
||||
SRC_URI[sha256sum] = "660ee136fbcee08858516ed4de2ad87068bfe1b6b8b37896ce3529ff054a726d"
|
||||
|
||||
Reference in New Issue
Block a user