* [PATCH 0/1] binutils-native:do_compile failed on Ubuntu 12.10 @ 2012-11-21 9:24 Hongxu Jia 2012-11-21 9:24 ` [PATCH 1/1] binutils-native: do_compile " Hongxu Jia 0 siblings, 1 reply; 3+ messages in thread From: Hongxu Jia @ 2012-11-21 9:24 UTC (permalink / raw) To: openembedded-core The following changes since commit 66861cce918eb7ed1f16f829d652c9d7105152b7: Revert "gcc: Use FILESPATH instead of FILESDIR and cleanup/simplify" (2012-11-20 16:47:11 +0000) are available in the git repository at: git://git.pokylinux.org/poky-contrib hongxu/binutils http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/binutils Hongxu Jia (1): binutils-native: do_compile failed on Ubuntu 12.10 meta/recipes-devtools/binutils/binutils-2.22.inc | 3 +- .../binutils-check-size-before-memset.patch | 43 ++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/binutils/binutils/binutils-check-size-before-memset.patch -- 1.7.10.4 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] binutils-native: do_compile failed on Ubuntu 12.10 2012-11-21 9:24 [PATCH 0/1] binutils-native:do_compile failed on Ubuntu 12.10 Hongxu Jia @ 2012-11-21 9:24 ` Hongxu Jia 2012-11-28 21:43 ` Saul Wold 0 siblings, 1 reply; 3+ messages in thread From: Hongxu Jia @ 2012-11-21 9:24 UTC (permalink / raw) To: openembedded-core binutils-native do_compile failed on Ubuntu 12.10: ... error: call to '__warn_memset_zero_len' declared with attribute warning: memset used with constant zero length parameter; this could be due to transposed parameters [-Werror] ... When compiling binutils-native, option "--enable-targets=all" makes oasys.c compiled and option "-Werror" makes warning treated as error, so both of the options make the compile warning of oasys.c cause binutils-native compile failed. The warning caused by /usr/include/x86_64-linux-gnu/bits/string3.h:82 in Ubuntu 12.10, here is the code: __extern_always_inline void * __NTH (memset (void *__dest, int __ch, size_t __len)) { if (__builtin_constant_p (__len) && __len == 0 && (!__builtin_constant_p (__ch) || __ch != 0)) { __warn_memset_zero_len (); return __dest; } return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest)); } In oasys.c, invoking memset without checking len nonzero caused the warning. Add len nonzero checking when invoke memset in oasys.c to remove the compile warning could fix the problem. [YOCTO #3464] Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> --- meta/recipes-devtools/binutils/binutils-2.22.inc | 3 +- .../binutils-check-size-before-memset.patch | 43 ++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/binutils/binutils/binutils-check-size-before-memset.patch diff --git a/meta/recipes-devtools/binutils/binutils-2.22.inc b/meta/recipes-devtools/binutils/binutils-2.22.inc index 9697242..94cd17f 100644 --- a/meta/recipes-devtools/binutils/binutils-2.22.inc +++ b/meta/recipes-devtools/binutils/binutils-2.22.inc @@ -1,4 +1,4 @@ -PR = "r17" +PR = "r18" LIC_FILES_CHKSUM="\ file://src-release;endline=17;md5=4830a9ef968f3b18dd5e9f2c00db2d35\ @@ -45,6 +45,7 @@ SRC_URI = "\ file://0144-timer.cc-include-unistd.h.patch \ file://0166-2012-04-27-Doug-Kwan-dougkwan-google.com.patch \ file://0182-PR-ld-13991.patch \ + file://binutils-check-size-before-memset.patch \ " SRC_URI[md5sum] = "ee0f10756c84979622b992a4a61ea3f5" diff --git a/meta/recipes-devtools/binutils/binutils/binutils-check-size-before-memset.patch b/meta/recipes-devtools/binutils/binutils/binutils-check-size-before-memset.patch new file mode 100644 index 0000000..0baf42e --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/binutils-check-size-before-memset.patch @@ -0,0 +1,43 @@ +bfd/oasys.c: check size before memset + +On Ubuntu 12.10 /usr/include/x86_64-linux-gnu/bits/string3.h:77 + +__extern_always_inline void * +__NTH (memset (void *__dest, int __ch, size_t __len)) +{ + if (__builtin_constant_p (__len) && __len == 0 + && (!__builtin_constant_p (__ch) || __ch != 0)) + { + __warn_memset_zero_len (); + return __dest; + } + return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest)); +} + +The "memset(void *s, int c, size_t n)" will warn if the "n" is zero, +check the value of "n" before memset will fix the problem. + +Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> + +Upstream-Status: Pending +--- + binutils-2.22/bfd/oasys.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/bfd/oasys.c b/bfd/oasys.c +--- a/bfd/oasys.c ++++ b/bfd/oasys.c +@@ -908,7 +908,9 @@ oasys_write_header (bfd *abfd) + length = sizeof (r.module_name); + + (void) memcpy (r.module_name, abfd->filename, length); +- (void) memset (r.module_name + length, ' ', sizeof (r.module_name) - length); ++ ++ if (sizeof (r.module_name) > length) ++ (void) memset (r.module_name + length, ' ', sizeof (r.module_name) - length); + + r.version_number = OASYS_VERSION_NUMBER; + r.rev_number = OASYS_REV_NUMBER; +-- +1.7.10.4 + -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] binutils-native: do_compile failed on Ubuntu 12.10 2012-11-21 9:24 ` [PATCH 1/1] binutils-native: do_compile " Hongxu Jia @ 2012-11-28 21:43 ` Saul Wold 0 siblings, 0 replies; 3+ messages in thread From: Saul Wold @ 2012-11-28 21:43 UTC (permalink / raw) To: Hongxu Jia; +Cc: openembedded-core On 11/21/2012 01:24 AM, Hongxu Jia wrote: > binutils-native do_compile failed on Ubuntu 12.10: > ... > error: call to '__warn_memset_zero_len' declared with attribute warning: > memset used with constant zero length parameter; this could be due to > transposed parameters [-Werror] > ... > > When compiling binutils-native, option "--enable-targets=all" makes > oasys.c compiled and option "-Werror" makes warning treated as error, > so both of the options make the compile warning of oasys.c cause > binutils-native compile failed. > This patch is not needed for 2.23 since it's been fixed there. Sau! > The warning caused by /usr/include/x86_64-linux-gnu/bits/string3.h:82 > in Ubuntu 12.10, here is the code: > __extern_always_inline void * > __NTH (memset (void *__dest, int __ch, size_t __len)) > { > if (__builtin_constant_p (__len) && __len == 0 > && (!__builtin_constant_p (__ch) || __ch != 0)) > { > __warn_memset_zero_len (); > return __dest; > } > return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest)); > } > > In oasys.c, invoking memset without checking len nonzero caused the > warning. > > Add len nonzero checking when invoke memset in oasys.c to remove the > compile warning could fix the problem. > > [YOCTO #3464] > Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> > --- > meta/recipes-devtools/binutils/binutils-2.22.inc | 3 +- > .../binutils-check-size-before-memset.patch | 43 ++++++++++++++++++++ > 2 files changed, 45 insertions(+), 1 deletion(-) > create mode 100644 meta/recipes-devtools/binutils/binutils/binutils-check-size-before-memset.patch > > diff --git a/meta/recipes-devtools/binutils/binutils-2.22.inc b/meta/recipes-devtools/binutils/binutils-2.22.inc > index 9697242..94cd17f 100644 > --- a/meta/recipes-devtools/binutils/binutils-2.22.inc > +++ b/meta/recipes-devtools/binutils/binutils-2.22.inc > @@ -1,4 +1,4 @@ > -PR = "r17" > +PR = "r18" > > LIC_FILES_CHKSUM="\ > file://src-release;endline=17;md5=4830a9ef968f3b18dd5e9f2c00db2d35\ > @@ -45,6 +45,7 @@ SRC_URI = "\ > file://0144-timer.cc-include-unistd.h.patch \ > file://0166-2012-04-27-Doug-Kwan-dougkwan-google.com.patch \ > file://0182-PR-ld-13991.patch \ > + file://binutils-check-size-before-memset.patch \ > " > > SRC_URI[md5sum] = "ee0f10756c84979622b992a4a61ea3f5" > diff --git a/meta/recipes-devtools/binutils/binutils/binutils-check-size-before-memset.patch b/meta/recipes-devtools/binutils/binutils/binutils-check-size-before-memset.patch > new file mode 100644 > index 0000000..0baf42e > --- /dev/null > +++ b/meta/recipes-devtools/binutils/binutils/binutils-check-size-before-memset.patch > @@ -0,0 +1,43 @@ > +bfd/oasys.c: check size before memset > + > +On Ubuntu 12.10 /usr/include/x86_64-linux-gnu/bits/string3.h:77 > + > +__extern_always_inline void * > +__NTH (memset (void *__dest, int __ch, size_t __len)) > +{ > + if (__builtin_constant_p (__len) && __len == 0 > + && (!__builtin_constant_p (__ch) || __ch != 0)) > + { > + __warn_memset_zero_len (); > + return __dest; > + } > + return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest)); > +} > + > +The "memset(void *s, int c, size_t n)" will warn if the "n" is zero, > +check the value of "n" before memset will fix the problem. > + > +Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> > + > +Upstream-Status: Pending > +--- > + binutils-2.22/bfd/oasys.c | 4 +++- > + 1 file changed, 3 insertions(+), 1 deletion(-) > + > +diff --git a/bfd/oasys.c b/bfd/oasys.c > +--- a/bfd/oasys.c > ++++ b/bfd/oasys.c > +@@ -908,7 +908,9 @@ oasys_write_header (bfd *abfd) > + length = sizeof (r.module_name); > + > + (void) memcpy (r.module_name, abfd->filename, length); > +- (void) memset (r.module_name + length, ' ', sizeof (r.module_name) - length); > ++ > ++ if (sizeof (r.module_name) > length) > ++ (void) memset (r.module_name + length, ' ', sizeof (r.module_name) - length); > + > + r.version_number = OASYS_VERSION_NUMBER; > + r.rev_number = OASYS_REV_NUMBER; > +-- > +1.7.10.4 > + > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-28 21:57 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-11-21 9:24 [PATCH 0/1] binutils-native:do_compile failed on Ubuntu 12.10 Hongxu Jia 2012-11-21 9:24 ` [PATCH 1/1] binutils-native: do_compile " Hongxu Jia 2012-11-28 21:43 ` Saul Wold
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox