There was an error when build with gcc 4.7 (FC 17 64bit):
| fs/zfs/zfs.c: In function 'get_filesystem_dnode':
| fs/zfs/zfs.c:1449:7: error: dereferencing type-punned pointer will break 
strict-aliasing rules [-Werror=strict-aliasing]
......
cc1: all warnings being treated as errors

While compare the compile command between gcc 4.4.4 and gcc 4.7.0, they
are the same (both of them have -Wall and -Werror), it seems that gcc
4.7.0 has changed its algorithm for the strict aliasing check, but I
didn't find the related information from its release note.

Add "-fno-strict-aliasing" to gcc's option would fix the problem, this
would disable the optimization for strict-aliasing.

[YOCTO #2291]

Signed-off-by: Robert Yang <[email protected]>
---
 meta/recipes-bsp/grub/grub_1.99.bb |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/meta/recipes-bsp/grub/grub_1.99.bb 
b/meta/recipes-bsp/grub/grub_1.99.bb
index ac66e83..f45b634 100644
--- a/meta/recipes-bsp/grub/grub_1.99.bb
+++ b/meta/recipes-bsp/grub/grub_1.99.bb
@@ -12,7 +12,7 @@ LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
 RDEPENDS_${PN} = "diffutils freetype"
-PR = "r3"
+PR = "r4"
 
 SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz \
           file://grub-install.in.patch \
@@ -29,6 +29,11 @@ inherit gettext
 EXTRA_OECONF = "--with-platform=pc --disable-grub-mkfont 
--target=${TARGET_ARCH} --program-prefix="""
 
 do_configure() {
+    # Fix build error for gcc 4.7
+    echo "CPPFLAGS_DEFAULT += -fno-strict-aliasing" >> conf/Makefile.common
+    # Also modify Makefile.in, we can remove this when we can run autoreconf
+    sed -i 's/^CPPFLAGS_DEFAULT = \(.*\)/CPPFLAGS_DEFAULT = 
-fno-strict-aliasing \1/' \
+       Makefile.in grub-core/Makefile.in
     oe_runconf
 }
 
-- 
1.7.1


_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Reply via email to