[meta-dpdk] dpdk: mk: disable warning for packed member pointer

Submitted by zhe.he@windriver.com on June 11, 2019, 3:06 a.m. | Patch ID: 162092

Details

Message ID 1560222410-414851-1-git-send-email-zhe.he@windriver.com
State New
Headers show

Commit Message

zhe.he@windriver.com June 11, 2019, 3:06 a.m.
From: He Zhe <zhe.he@windriver.com>

Backport a patch from upstream to fix the following build failure.

x86_64-native-linuxapp-gcc/include/rte_ether.h:178:2: error:
converting a packed 'const struct ether_addr' pointer (alignment 1) to a 'unaligned_uint16_t' {aka 'const short
 unsigned int'} pointer (alignment 2) may result in an unaligned pointer value [-Werror=address-of-packed-member]
|   178 |  const unaligned_uint16_t *ea_words = (const unaligned_uint16_t *)ea;
|       |  ^~~~~

Signed-off-by: He Zhe <zhe.he@windriver.com>
---
 ...disable-warning-for-packed-member-pointer.patch | 48 ++++++++++++++++++++++
 recipes-extended/dpdk/dpdk_17.11.3.bb              |  1 +
 2 files changed, 49 insertions(+)
 create mode 100644 recipes-extended/dpdk/dpdk/dpdk-17.11-mk-disable-warning-for-packed-member-pointer.patch

Patch hide | download patch | download mbox

diff --git a/recipes-extended/dpdk/dpdk/dpdk-17.11-mk-disable-warning-for-packed-member-pointer.patch b/recipes-extended/dpdk/dpdk/dpdk-17.11-mk-disable-warning-for-packed-member-pointer.patch
new file mode 100644
index 0000000..70a8dec
--- /dev/null
+++ b/recipes-extended/dpdk/dpdk/dpdk-17.11-mk-disable-warning-for-packed-member-pointer.patch
@@ -0,0 +1,48 @@ 
+From a385972c3675dd2b4792ab5b3cf7a536e6f9846c Mon Sep 17 00:00:00 2001
+From: Reshma Pattan <reshma.pattan@intel.com>
+Date: Thu, 2 May 2019 10:33:34 +0100
+Subject: [PATCH] mk: disable warning for packed member pointer
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+gcc 9 on Fedora 30 gives an error
+"taking address of packed member may result in an
+unaligned pointer value" warnings.
+
+For clang builds this warning is already disabled,
+so disable "-Waddress-of-packed-member" for gcc builds
+also.
+
+Snippet of build error:
+lib/librte_eal/linux/eal/eal_memalloc.c: In function ‘alloc_seg_walk’:
+lib/librte_eal/linux/eal/eal_memalloc.c:768:12: error:
+taking address of packed member of ‘struct rte_mem_config’ may result
+in an unaligned pointer value [-Werror=address-of-packed-member]
+  768 |  cur_msl = &mcfg->memsegs[msl_idx];
+      |            ^~~~~~~~~~~~~~~~~~~~~~~
+
+Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
+Tested-by: David Marchand <david.marchand@redhat.com>
+Upstream-Status: Backport
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ mk/toolchain/gcc/rte.vars.mk | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk
+index d8b99fa..b852fcf 100644
+--- a/mk/toolchain/gcc/rte.vars.mk
++++ b/mk/toolchain/gcc/rte.vars.mk
+@@ -87,5 +87,8 @@ WERROR_FLAGS += -Wimplicit-fallthrough=2
+ WERROR_FLAGS += -Wno-format-truncation
+ endif
+ 
++# disable packed member unalign warnings
++WERROR_FLAGS += -Wno-address-of-packed-member
++
+ export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF
+ export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS
+-- 
+2.7.4
+
diff --git a/recipes-extended/dpdk/dpdk_17.11.3.bb b/recipes-extended/dpdk/dpdk_17.11.3.bb
index 7fc89d2..af42ad8 100644
--- a/recipes-extended/dpdk/dpdk_17.11.3.bb
+++ b/recipes-extended/dpdk/dpdk_17.11.3.bb
@@ -12,4 +12,5 @@  SRC_URI += "\
         file://dpdk-16.07-dpdk-fix-for-parellel-make-issue.patch \
         file://dpdk-17.02-dpdk-fix-installation-warning-and-issue.patch \
         file://dpdk-17.11-Fix-strncpy-error-for-GCC8.patch \
+        file://dpdk-17.11-mk-disable-warning-for-packed-member-pointer.patch \
 "

Comments

Anuj Mittal June 11, 2019, 6:29 a.m.
Thanks, I have included this for 18.11 as well and merged.

Thanks,

Anuj

On Tue, 2019-06-11 at 11:06 +0800, zhe.he@windriver.com wrote:
> From: He Zhe <zhe.he@windriver.com>

> 

> Backport a patch from upstream to fix the following build failure.

> 

> x86_64-native-linuxapp-gcc/include/rte_ether.h:178:2: error:

> converting a packed 'const struct ether_addr' pointer (alignment 1)

> to a 'unaligned_uint16_t' {aka 'const short

>  unsigned int'} pointer (alignment 2) may result in an unaligned

> pointer value [-Werror=address-of-packed-member]

> >   178 |  const unaligned_uint16_t *ea_words = (const

> > unaligned_uint16_t *)ea;

> >       |  ^~~~~

> 

> Signed-off-by: He Zhe <zhe.he@windriver.com>

> ---

>  ...disable-warning-for-packed-member-pointer.patch | 48

> ++++++++++++++++++++++

>  recipes-extended/dpdk/dpdk_17.11.3.bb              |  1 +

>  2 files changed, 49 insertions(+)

>  create mode 100644 recipes-extended/dpdk/dpdk/dpdk-17.11-mk-disable-

> warning-for-packed-member-pointer.patch

> 

> diff --git a/recipes-extended/dpdk/dpdk/dpdk-17.11-mk-disable-

> warning-for-packed-member-pointer.patch b/recipes-

> extended/dpdk/dpdk/dpdk-17.11-mk-disable-warning-for-packed-member-

> pointer.patch

> new file mode 100644

> index 0000000..70a8dec

> --- /dev/null

> +++ b/recipes-extended/dpdk/dpdk/dpdk-17.11-mk-disable-warning-for-

> packed-member-pointer.patch

> @@ -0,0 +1,48 @@

> +From a385972c3675dd2b4792ab5b3cf7a536e6f9846c Mon Sep 17 00:00:00

> 2001

> +From: Reshma Pattan <reshma.pattan@intel.com>

> +Date: Thu, 2 May 2019 10:33:34 +0100

> +Subject: [PATCH] mk: disable warning for packed member pointer

> +MIME-Version: 1.0

> +Content-Type: text/plain; charset=UTF-8

> +Content-Transfer-Encoding: 8bit

> +

> +gcc 9 on Fedora 30 gives an error

> +"taking address of packed member may result in an

> +unaligned pointer value" warnings.

> +

> +For clang builds this warning is already disabled,

> +so disable "-Waddress-of-packed-member" for gcc builds

> +also.

> +

> +Snippet of build error:

> +lib/librte_eal/linux/eal/eal_memalloc.c: In function

> ‘alloc_seg_walk’:

> +lib/librte_eal/linux/eal/eal_memalloc.c:768:12: error:

> +taking address of packed member of ‘struct rte_mem_config’ may

> result

> +in an unaligned pointer value [-Werror=address-of-packed-member]

> +  768 |  cur_msl = &mcfg->memsegs[msl_idx];

> +      |            ^~~~~~~~~~~~~~~~~~~~~~~

> +

> +Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>

> +Tested-by: David Marchand <david.marchand@redhat.com>

> +Upstream-Status: Backport

> +Signed-off-by: He Zhe <zhe.he@windriver.com>

> +---

> + mk/toolchain/gcc/rte.vars.mk | 3 +++

> + 1 file changed, 3 insertions(+)

> +

> +diff --git a/mk/toolchain/gcc/rte.vars.mk

> b/mk/toolchain/gcc/rte.vars.mk

> +index d8b99fa..b852fcf 100644

> +--- a/mk/toolchain/gcc/rte.vars.mk

> ++++ b/mk/toolchain/gcc/rte.vars.mk

> +@@ -87,5 +87,8 @@ WERROR_FLAGS += -Wimplicit-fallthrough=2

> + WERROR_FLAGS += -Wno-format-truncation

> + endif

> + 

> ++# disable packed member unalign warnings

> ++WERROR_FLAGS += -Wno-address-of-packed-member

> ++

> + export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF

> + export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS

> +-- 

> +2.7.4

> +

> diff --git a/recipes-extended/dpdk/dpdk_17.11.3.bb b/recipes-

> extended/dpdk/dpdk_17.11.3.bb

> index 7fc89d2..af42ad8 100644

> --- a/recipes-extended/dpdk/dpdk_17.11.3.bb

> +++ b/recipes-extended/dpdk/dpdk_17.11.3.bb

> @@ -12,4 +12,5 @@ SRC_URI += "\

>          file://dpdk-16.07-dpdk-fix-for-parellel-make-issue.patch \

>          file://dpdk-17.02-dpdk-fix-installation-warning-and-

> issue.patch \

>          file://dpdk-17.11-Fix-strncpy-error-for-GCC8.patch \

> +        file://dpdk-17.11-mk-disable-warning-for-packed-member-

> pointer.patch \

>  "