* [Buildroot] [PATCH 1/1] package/memcached: fix build with gcc 10
@ 2021-12-25 19:38 Fabrice Fontaine
2021-12-26 10:51 ` Thomas Petazzoni
0 siblings, 1 reply; 5+ messages in thread
From: Fabrice Fontaine @ 2021-12-25 19:38 UTC (permalink / raw)
To: buildroot; +Cc: Fabrice Fontaine
Fix the following build failure raised since bump to version 1.6.12 in
commit f727b6da04c21732bbd07d8c70aa814bc56014a1:
logger.c: In function '_logger_parse_cce':
logger.c:297:13: error: 'rport' may be used uninitialized in this function [-Werror=maybe-uninitialized]
297 | total = snprintf(scratch, LOGGER_PARSE_SCRATCH,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
298 | "ts=%d.%d gid=%llu type=conn_close rip=%s rport=%hu transport=%s reason=%s cfd=%d\n",
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
299 | (int) e->tv.tv_sec, (int) e->tv.tv_usec, (unsigned long long) e->gid,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
300 | rip, rport, transport_map[le->transport],
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
301 | reason_map[le->reason], le->sfd);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fixes:
- http://autobuild.buildroot.org/results/7a46ac38d10b1859034017e0294961daa8f48dd2
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
.../0001-logger.c-initialize-rport.patch | 55 +++++++++++++++++++
1 file changed, 55 insertions(+)
create mode 100644 package/memcached/0001-logger.c-initialize-rport.patch
diff --git a/package/memcached/0001-logger.c-initialize-rport.patch b/package/memcached/0001-logger.c-initialize-rport.patch
new file mode 100644
index 0000000000..5fb13d5eee
--- /dev/null
+++ b/package/memcached/0001-logger.c-initialize-rport.patch
@@ -0,0 +1,55 @@
+From b3431c4fcaf65e66fda80ef89b79ff3da1912b4f Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Sat, 25 Dec 2021 20:05:29 +0100
+Subject: [PATCH] logger.c: initialize rport
+
+Fix the following build failure raised since version 1.6.11 and
+https://github.com/memcached/memcached/commit/617d7cd64d04698b76fee74882627690017e20ad:
+
+logger.c: In function '_logger_parse_cce':
+logger.c:297:13: error: 'rport' may be used uninitialized in this function [-Werror=maybe-uninitialized]
+ 297 | total = snprintf(scratch, LOGGER_PARSE_SCRATCH,
+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 298 | "ts=%d.%d gid=%llu type=conn_close rip=%s rport=%hu transport=%s reason=%s cfd=%d\n",
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 299 | (int) e->tv.tv_sec, (int) e->tv.tv_usec, (unsigned long long) e->gid,
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 300 | rip, rport, transport_map[le->transport],
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 301 | reason_map[le->reason], le->sfd);
+ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Fixes:
+ - http://autobuild.buildroot.org/results/7a46ac38d10b1859034017e0294961daa8f48dd2
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+[Upstream status: not sent yet]
+---
+ logger.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/logger.c b/logger.c
+index 667f3c7..394adae 100644
+--- a/logger.c
++++ b/logger.c
+@@ -269,7 +269,7 @@ static int _logger_parse_extw(logentry *e, char *scratch) {
+
+ static int _logger_parse_cne(logentry *e, char *scratch) {
+ int total;
+- unsigned short rport;
++ unsigned short rport = 0;
+ char rip[64];
+ struct logentry_conn_event *le = (struct logentry_conn_event *) e->data;
+ const char * const transport_map[] = { "local", "tcp", "udp" };
+@@ -286,7 +286,7 @@ static int _logger_parse_cne(logentry *e, char *scratch) {
+
+ static int _logger_parse_cce(logentry *e, char *scratch) {
+ int total;
+- unsigned short rport;
++ unsigned short rport = 0;
+ char rip[64];
+ struct logentry_conn_event *le = (struct logentry_conn_event *) e->data;
+ const char * const transport_map[] = { "local", "tcp", "udp" };
+--
+2.33.0
+
--
2.33.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [Buildroot] [PATCH 1/1] package/memcached: fix build with gcc 10
2021-12-25 19:38 [Buildroot] [PATCH 1/1] package/memcached: fix build with gcc 10 Fabrice Fontaine
@ 2021-12-26 10:51 ` Thomas Petazzoni
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2021-12-26 10:51 UTC (permalink / raw)
To: Fabrice Fontaine; +Cc: buildroot
On Sat, 25 Dec 2021 20:38:16 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> Fix the following build failure raised since bump to version 1.6.12 in
> commit f727b6da04c21732bbd07d8c70aa814bc56014a1:
>
> logger.c: In function '_logger_parse_cce':
> logger.c:297:13: error: 'rport' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 297 | total = snprintf(scratch, LOGGER_PARSE_SCRATCH,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 298 | "ts=%d.%d gid=%llu type=conn_close rip=%s rport=%hu transport=%s reason=%s cfd=%d\n",
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 299 | (int) e->tv.tv_sec, (int) e->tv.tv_usec, (unsigned long long) e->gid,
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 300 | rip, rport, transport_map[le->transport],
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 301 | reason_map[le->reason], le->sfd);
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Fixes:
> - http://autobuild.buildroot.org/results/7a46ac38d10b1859034017e0294961daa8f48dd2
>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> .../0001-logger.c-initialize-rport.patch | 55 +++++++++++++++++++
> 1 file changed, 55 insertions(+)
> create mode 100644 package/memcached/0001-logger.c-initialize-rport.patch
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] [PATCH 1/1] package/memcached: fix build with gcc 10
@ 2020-09-06 21:04 Fabrice Fontaine
2020-09-07 19:34 ` Thomas Petazzoni
2020-09-11 20:40 ` Peter Korsgaard
0 siblings, 2 replies; 5+ messages in thread
From: Fabrice Fontaine @ 2020-09-06 21:04 UTC (permalink / raw)
To: buildroot
Fixes:
- http://autobuild.buildroot.org/results/ba8dcdece193b91845a30cd31d3574674ec30068
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
...ash-fix-build-failure-against-gcc-10.patch | 56 +++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 package/memcached/0003-hash-fix-build-failure-against-gcc-10.patch
diff --git a/package/memcached/0003-hash-fix-build-failure-against-gcc-10.patch b/package/memcached/0003-hash-fix-build-failure-against-gcc-10.patch
new file mode 100644
index 0000000000..564b191c1b
--- /dev/null
+++ b/package/memcached/0003-hash-fix-build-failure-against-gcc-10.patch
@@ -0,0 +1,56 @@
+From 0447ae4cbbebb87d3f28bb92f7e219a47263b889 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Thu, 23 Jan 2020 22:16:36 +0000
+Subject: [PATCH] hash: fix build failure against gcc-10
+
+On gcc-10 (and gcc-9 -fno-common) build fails as:
+
+```
+gcc -g -O2 -pthread -pthread -Wall -Werror -pedantic -Wmissing-prototypes \
+ -Wmissing-declarations -Wredundant-decls -o memcached ... -levent
+ld: memcached-hash.o:memcached/hash.h:5:
+ multiple definition of `hash'; memcached-memcached.o:memcached/hash.h:5: first defined here
+```
+
+gcc-10 will change the default from -fcommon to fno-common:
+https://gcc.gnu.org/PR85678.
+
+The error also happens if CFLAGS=-fno-common passed explicitly.
+
+Reported-by: Brian Evans
+Bug: https://bugs.gentoo.org/706196
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+[Retrieved from:
+https://github.com/memcached/memcached/commit/0447ae4cbbebb87d3f28bb92f7e219a47263b889]
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ hash.c | 2 ++
+ hash.h | 2 +-
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/hash.c b/hash.c
+index a0c30369f..b5ff28ae4 100644
+--- a/hash.c
++++ b/hash.c
+@@ -4,6 +4,8 @@
+ #include "jenkins_hash.h"
+ #include "murmur3_hash.h"
+
++hash_func hash;
++
+ int hash_init(enum hashfunc_type type) {
+ switch(type) {
+ case JENKINS_HASH:
+diff --git a/hash.h b/hash.h
+index 059d1e2a6..3b2a98478 100644
+--- a/hash.h
++++ b/hash.h
+@@ -2,7 +2,7 @@
+ #define HASH_H
+
+ typedef uint32_t (*hash_func)(const void *key, size_t length);
+-hash_func hash;
++extern hash_func hash;
+
+ enum hashfunc_type {
+ JENKINS_HASH=0, MURMUR3_HASH
--
2.28.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-26 10:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-25 19:38 [Buildroot] [PATCH 1/1] package/memcached: fix build with gcc 10 Fabrice Fontaine
2021-12-26 10:51 ` Thomas Petazzoni
-- strict thread matches above, loose matches on Subject: below --
2020-09-06 21:04 Fabrice Fontaine
2020-09-07 19:34 ` Thomas Petazzoni
2020-09-11 20:40 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox