All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] elfutils: fix build with -Os
@ 2015-04-10 10:18 Martin Jansa
  2015-04-10 13:56 ` Junling Zheng
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Jansa @ 2015-04-10 10:18 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 ...m-Silence-Werror-maybe-uninitialized-fals.patch | 35 ++++++++++++++++++++++
 meta/recipes-devtools/elfutils/elfutils_0.161.bb   |  1 +
 2 files changed, 36 insertions(+)
 create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.161/0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch

diff --git a/meta/recipes-devtools/elfutils/elfutils-0.161/0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch b/meta/recipes-devtools/elfutils/elfutils-0.161/0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch
new file mode 100644
index 0000000..3754c1c
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/elfutils-0.161/0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch
@@ -0,0 +1,35 @@
+From 668accf322fd7185e273bfd50b84320e71d9de5a Mon Sep 17 00:00:00 2001
+From: Martin Jansa <Martin.Jansa@gmail.com>
+Date: Fri, 10 Apr 2015 00:29:18 +0200
+Subject: [PATCH] elf_getarsym: Silence -Werror=maybe-uninitialized false
+ positive
+
+Upstream-Status: Pending
+Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
+---
+ libelf/elf_getarsym.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
+index d0bb28a..08954d2 100644
+--- a/libelf/elf_getarsym.c
++++ b/libelf/elf_getarsym.c
+@@ -165,8 +165,13 @@ elf_getarsym (elf, ptr)
+       int w = index64_p ? 8 : 4;
+ 
+       /* We have an archive.  The first word in there is the number of
+-	 entries in the table.  */
+-      uint64_t n;
++	 entries in the table.
++	 Set to SIZE_MAX just to silence -Werror=maybe-uninitialized
++	 elf_getarsym.c:290:9: error: 'n' may be used uninitialized in this function
++	 The read_number_entries function doesn't initialize n only when returning
++	 -1 which in turn ensures to jump over usage of this uninitialized variable.
++	 */
++      uint64_t n = SIZE_MAX;
+       size_t off = elf->start_offset + SARMAG + sizeof (struct ar_hdr);
+       if (read_number_entries (&n, elf, &off, index64_p) < 0)
+ 	{
+-- 
+2.3.5
+
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.161.bb b/meta/recipes-devtools/elfutils/elfutils_0.161.bb
index a3c1f36..d8c27f5 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.161.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.161.bb
@@ -15,6 +15,7 @@ SRC_URI += "\
         file://dso-link-change.patch \
         file://Fix_elf_cvt_gunhash.patch \
         file://fixheadercheck.patch \
+        file://0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch \
 "
 
 # pick the patch from debian
-- 
2.3.5



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] elfutils: fix build with -Os
  2015-04-10 10:18 [PATCH] elfutils: fix build with -Os Martin Jansa
@ 2015-04-10 13:56 ` Junling Zheng
  0 siblings, 0 replies; 2+ messages in thread
From: Junling Zheng @ 2015-04-10 13:56 UTC (permalink / raw)
  To: Martin Jansa; +Cc: openembedded-core

Good, I encounter this problem today, and prepare to fix it:)

Thanks for your patch,

On 2015/4/10 18:18, Martin Jansa wrote:
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  ...m-Silence-Werror-maybe-uninitialized-fals.patch | 35 ++++++++++++++++++++++
>  meta/recipes-devtools/elfutils/elfutils_0.161.bb   |  1 +
>  2 files changed, 36 insertions(+)
>  create mode 100644 meta/recipes-devtools/elfutils/elfutils-0.161/0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch
> 
> diff --git a/meta/recipes-devtools/elfutils/elfutils-0.161/0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch b/meta/recipes-devtools/elfutils/elfutils-0.161/0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch
> new file mode 100644
> index 0000000..3754c1c
> --- /dev/null
> +++ b/meta/recipes-devtools/elfutils/elfutils-0.161/0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch
> @@ -0,0 +1,35 @@
> +From 668accf322fd7185e273bfd50b84320e71d9de5a Mon Sep 17 00:00:00 2001
> +From: Martin Jansa <Martin.Jansa@gmail.com>
> +Date: Fri, 10 Apr 2015 00:29:18 +0200
> +Subject: [PATCH] elf_getarsym: Silence -Werror=maybe-uninitialized false
> + positive
> +
> +Upstream-Status: Pending
> +Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> +---
> + libelf/elf_getarsym.c | 9 +++++++--
> + 1 file changed, 7 insertions(+), 2 deletions(-)
> +
> +diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
> +index d0bb28a..08954d2 100644
> +--- a/libelf/elf_getarsym.c
> ++++ b/libelf/elf_getarsym.c
> +@@ -165,8 +165,13 @@ elf_getarsym (elf, ptr)
> +       int w = index64_p ? 8 : 4;
> + 
> +       /* We have an archive.  The first word in there is the number of
> +-	 entries in the table.  */
> +-      uint64_t n;
> ++	 entries in the table.
> ++	 Set to SIZE_MAX just to silence -Werror=maybe-uninitialized
> ++	 elf_getarsym.c:290:9: error: 'n' may be used uninitialized in this function
> ++	 The read_number_entries function doesn't initialize n only when returning
> ++	 -1 which in turn ensures to jump over usage of this uninitialized variable.
> ++	 */
> ++      uint64_t n = SIZE_MAX;
> +       size_t off = elf->start_offset + SARMAG + sizeof (struct ar_hdr);
> +       if (read_number_entries (&n, elf, &off, index64_p) < 0)
> + 	{
> +-- 
> +2.3.5
> +
> diff --git a/meta/recipes-devtools/elfutils/elfutils_0.161.bb b/meta/recipes-devtools/elfutils/elfutils_0.161.bb
> index a3c1f36..d8c27f5 100644
> --- a/meta/recipes-devtools/elfutils/elfutils_0.161.bb
> +++ b/meta/recipes-devtools/elfutils/elfutils_0.161.bb
> @@ -15,6 +15,7 @@ SRC_URI += "\
>          file://dso-link-change.patch \
>          file://Fix_elf_cvt_gunhash.patch \
>          file://fixheadercheck.patch \
> +        file://0001-elf_getarsym-Silence-Werror-maybe-uninitialized-fals.patch \
>  "
>  
>  # pick the patch from debian
> 




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-10 13:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-10 10:18 [PATCH] elfutils: fix build with -Os Martin Jansa
2015-04-10 13:56 ` Junling Zheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.