mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
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>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
(cherry picked from commit dacdbf7088)
62 lines
1.1 KiB
C
62 lines
1.1 KiB
C
#ifndef _UTILS_H
|
|
#define _UTILS_H
|
|
#include <stdbool.h>
|
|
#include <string.h>
|
|
#include <stdint.h>
|
|
|
|
#include <xen-tools/libs.h>
|
|
|
|
/* Is A == B ? */
|
|
#define streq(a,b) (strcmp((a),(b)) == 0)
|
|
|
|
/* Does A start with B ? */
|
|
#define strstarts(a,b) (strncmp((a),(b),strlen(b)) == 0)
|
|
|
|
/* Does A end in B ? */
|
|
static inline bool strends(const char *a, const char *b)
|
|
{
|
|
if (strlen(a) < strlen(b))
|
|
return false;
|
|
|
|
return streq(a + strlen(a) - strlen(b), b);
|
|
}
|
|
|
|
void barf(const char *fmt, ...) __attribute__((noreturn));
|
|
void barf_perror(const char *fmt, ...) __attribute__((noreturn));
|
|
|
|
extern void (*xprintf)(const char *fmt, ...);
|
|
|
|
#define eprintf(_fmt, _args...) xprintf("[ERR] %s" _fmt, __FUNCTION__, ##_args)
|
|
|
|
/*
|
|
* Mux errno values onto returned pointers.
|
|
*/
|
|
|
|
static inline void *ERR_PTR(long error)
|
|
{
|
|
return (void *)error;
|
|
}
|
|
|
|
static inline long PTR_ERR(const void *ptr)
|
|
{
|
|
return (long)ptr;
|
|
}
|
|
|
|
static inline long IS_ERR(const void *ptr)
|
|
{
|
|
return ((unsigned long)ptr > (unsigned long)-1000L);
|
|
}
|
|
|
|
|
|
#endif /* _UTILS_H */
|
|
|
|
/*
|
|
* Local variables:
|
|
* mode: C
|
|
* c-file-style: "linux"
|
|
* indent-tabs-mode: t
|
|
* c-basic-offset: 8
|
|
* tab-width: 8
|
|
* End:
|
|
*/
|