Skip to contentSkip to conversation

grub2: Disable address-of-packed-member warnings

PATCH In review Khem Raj 2 participants 3 messages Feb 6, 2019

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 grub2: Disable address-of-packed-member warnings

gcc9 has turned this warning into error when -Werror is used, lets paper it over by turning it into a warning for now

Fixes
error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]

---
 meta/recipes-bsp/grub/grub2.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-bsp/grub/grub2.inc +1 -1
index 8e0f86217c..28e1c210e8 100644
@@ -60,7 +60,7 @@ BUILD_CPPFLAGS = ""
 BUILD_CFLAGS = ""
 BUILD_CXXFLAGS = ""
 BUILD_LDFLAGS = ""
-
+CPPFLAGS += "-Wno-error=address-of-packed-member"
 do_configure_prepend() {
 	# The grub2 configure script uses variables such as TARGET_CFLAGS etc
 	# for its own purposes. Remove the OE versions from the environment to
Signature · 1 line
2.20.1
#1 lore raw
Quoted 27 lines · Khem Raj

gcc9 has turned this warning into error when -Werror is used, lets paper
it over by turning it into a warning for now

Fixes
error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]

---
 meta/recipes-bsp/grub/grub2.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes- renamed from meta/recipes-bsp/grub/grub2.inc +0 -0

bsp/grub/grub2.inc
index 8e0f86217c..28e1c210e8 100644

meta/recipes-bsp/grub/grub2.inc +1 -1
@@ -60,7 +60,7 @@ BUILD_CPPFLAGS = ""
 BUILD_CFLAGS = ""
 BUILD_CXXFLAGS = ""
 BUILD_LDFLAGS = ""
-
+CPPFLAGS += "-Wno-error=address-of-packed-member"
 do_configure_prepend() {
 	# The grub2 configure script uses variables such as

TARGET_CFLAGS etc

Quoted 2 lines
 	# for its own purposes. Remove the OE versions from the
environment to

This failed all over the place, e.g.:

https://autobuilder.yoctoproject.org/typhoon/#/builders/48/builds/264

Cheers,

Richard

author
#2 lore raw
Quoted 34 lines · Richard Purdie
Quoted 27 lines · Khem Raj

gcc9 has turned this warning into error when -Werror is used, lets paper
it over by turning it into a warning for now

Fixes
error: taking address of packed member of 'struct head' may result in an unaligned pointer value [-Werror=address-of-packed-member]

---
 meta/recipes-bsp/grub/grub2.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes- renamed from meta/recipes-bsp/grub/grub2.inc +0 -0

bsp/grub/grub2.inc
index 8e0f86217c..28e1c210e8 100644

meta/recipes-bsp/grub/grub2.inc +1 -1
@@ -60,7 +60,7 @@ BUILD_CPPFLAGS = ""
 BUILD_CFLAGS = ""
 BUILD_CXXFLAGS = ""
 BUILD_LDFLAGS = ""
-
+CPPFLAGS += "-Wno-error=address-of-packed-member"
 do_configure_prepend() {
      # The grub2 configure script uses variables such as

TARGET_CFLAGS etc

Quoted 2 lines
      # for its own purposes. Remove the OE versions from the
environment to

This failed all over the place, e.g.:

Quoted 2 lines

https://autobuilder.yoctoproject.org/typhoon/#/builders/48/builds/264

yeah this is new gcc9+ option , it did not occur to me. I think we need to make the code to see if compiler supports this option before adding it. Ideally code should be fixed but thats for laters. Drop this patch I will add a m4 macro check and add/remove it in Makefile.am

Quoted 6 lines

Cheers,

Richard