* [XEN PATCH] tools/xenstore: mark variable in header as extern
@ 2020-05-20 16:39 Anthony PERARD
2020-05-20 16:59 ` Andrew Cooper
2020-05-20 17:20 ` Ian Jackson
0 siblings, 2 replies; 3+ messages in thread
From: Anthony PERARD @ 2020-05-20 16:39 UTC (permalink / raw)
To: xen-devel; +Cc: Anthony PERARD, Ian Jackson, Wei Liu
This patch fix "multiple definition of `xprintf'" (or xgt_handle)
build error with GCC 10.1.0.
These are the error reported:
gcc xs_tdb_dump.o utils.o tdb.o talloc.o -o xs_tdb_dump
/usr/bin/ld: utils.o:./utils.h:27: multiple definition of `xprintf'; xs_tdb_dump.o:./utils.h:27: first defined here
[...]
gcc xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xenstored_control.o xs_lib.o talloc.o utils.o tdb.o hashtable.o xenstored_posix.o -lsystemd -Wl,-rpath-link=... ../libxc/libxenctrl.so -lrt -o xenstored
/usr/bin/ld: xenstored_watch.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
/usr/bin/ld: xenstored_domain.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
/usr/bin/ld: xenstored_transaction.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
/usr/bin/ld: xenstored_control.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
/usr/bin/ld: xenstored_posix.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
A difference that I noticed with earlier version of the build chain is
that before, I had:
$ nm xs_tdb_dump.o | grep xprintf
0000000000000008 C xprintf
And now, it's:
0000000000000000 B xprintf
With the patch apply, the symbol isn't in xs_tdb_dump.o anymore.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
tools/xenstore/utils.h | 2 +-
tools/xenstore/xenstored_core.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/xenstore/utils.h b/tools/xenstore/utils.h
index 522c3594a2ba..6a1b5de9bdc1 100644
--- a/tools/xenstore/utils.h
+++ b/tools/xenstore/utils.h
@@ -24,7 +24,7 @@ static inline bool strends(const char *a, const char *b)
void barf(const char *fmt, ...) __attribute__((noreturn));
void barf_perror(const char *fmt, ...) __attribute__((noreturn));
-void (*xprintf)(const char *fmt, ...);
+extern void (*xprintf)(const char *fmt, ...);
#define eprintf(_fmt, _args...) xprintf("[ERR] %s" _fmt, __FUNCTION__, ##_args)
diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_core.h
index 56a279cfbb47..c4c32bc88f0c 100644
--- a/tools/xenstore/xenstored_core.h
+++ b/tools/xenstore/xenstored_core.h
@@ -204,7 +204,7 @@ void finish_daemonize(void);
/* Open a pipe for signal handling */
void init_pipe(int reopen_log_pipe[2]);
-xengnttab_handle **xgt_handle;
+extern xengnttab_handle **xgt_handle;
int remember_string(struct hashtable *hash, const char *str);
--
Anthony PERARD
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [XEN PATCH] tools/xenstore: mark variable in header as extern
2020-05-20 16:39 [XEN PATCH] tools/xenstore: mark variable in header as extern Anthony PERARD
@ 2020-05-20 16:59 ` Andrew Cooper
2020-05-20 17:20 ` Ian Jackson
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2020-05-20 16:59 UTC (permalink / raw)
To: Anthony PERARD, xen-devel; +Cc: Ian Jackson, Wei Liu
On 20/05/2020 17:39, Anthony PERARD wrote:
> This patch fix "multiple definition of `xprintf'" (or xgt_handle)
> build error with GCC 10.1.0.
>
> These are the error reported:
> gcc xs_tdb_dump.o utils.o tdb.o talloc.o -o xs_tdb_dump
> /usr/bin/ld: utils.o:./utils.h:27: multiple definition of `xprintf'; xs_tdb_dump.o:./utils.h:27: first defined here
> [...]
> gcc xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xenstored_control.o xs_lib.o talloc.o utils.o tdb.o hashtable.o xenstored_posix.o -lsystemd -Wl,-rpath-link=... ../libxc/libxenctrl.so -lrt -o xenstored
> /usr/bin/ld: xenstored_watch.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
> /usr/bin/ld: xenstored_domain.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
> /usr/bin/ld: xenstored_transaction.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
> /usr/bin/ld: xenstored_control.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
> /usr/bin/ld: xenstored_posix.o:./xenstored_core.h:207: multiple definition of `xgt_handle'; xenstored_core.o:./xenstored_core.h:207: first defined here
>
> A difference that I noticed with earlier version of the build chain is
> that before, I had:
> $ nm xs_tdb_dump.o | grep xprintf
> 0000000000000008 C xprintf
> And now, it's:
> 0000000000000000 B xprintf
> With the patch apply, the symbol isn't in xs_tdb_dump.o anymore.
>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Ah - this will be a side effect of defaulting to -fno-common now.
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [XEN PATCH] tools/xenstore: mark variable in header as extern
2020-05-20 16:39 [XEN PATCH] tools/xenstore: mark variable in header as extern Anthony PERARD
2020-05-20 16:59 ` Andrew Cooper
@ 2020-05-20 17:20 ` Ian Jackson
1 sibling, 0 replies; 3+ messages in thread
From: Ian Jackson @ 2020-05-20 17:20 UTC (permalink / raw)
To: Anthony PERARD; +Cc: xen-devel, Wei Liu
Anthony PERARD writes ("[XEN PATCH] tools/xenstore: mark variable in header as extern"):
> This patch fix "multiple definition of `xprintf'" (or xgt_handle)
> build error with GCC 10.1.0.
Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-20 17:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 16:39 [XEN PATCH] tools/xenstore: mark variable in header as extern Anthony PERARD
2020-05-20 16:59 ` Andrew Cooper
2020-05-20 17:20 ` Ian Jackson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).