From b78363ea4bb7ae82bd3cd4e8fa404385765c8776 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 7 May 2019 12:25:05 -0400 Subject: [PATCH] Fix: duplicate symbol with clang linker MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit On MacOs with the clang linker, the build fails with: duplicate symbol _bt_ctf_value_null in: trace-ir/.libs/libtrace-ir.a(trace.o) trace-ir/.libs/libtrace-ir.a(trace-class.o) Make the pointers extern. Signed-off-by: Michael Jeanson Change-Id: I679dc5b647de235a19a958331f7f975c0cb0a08f Reviewed-on: https://review.lttng.org/c/babeltrace/+/1267 Reviewed-by: Jérémie Galarneau Reviewed-by: Simon Marchi --- include/babeltrace/ctf-writer/values-internal.h | 4 ++-- lib/ctf-writer/values.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/babeltrace/ctf-writer/values-internal.h b/include/babeltrace/ctf-writer/values-internal.h index ca87255a..4cd74e1b 100644 --- a/include/babeltrace/ctf-writer/values-internal.h +++ b/include/babeltrace/ctf-writer/values-internal.h @@ -52,7 +52,7 @@ enum bt_ctf_value_status _bt_ctf_value_freeze(struct bt_ctf_value *object); # define bt_ctf_value_freeze(_value) #endif /* BT_DEV_MODE */ -struct bt_ctf_value *bt_ctf_value_null; +extern struct bt_ctf_value *const bt_ctf_value_null; enum bt_ctf_value_type { /// Null value object. @@ -190,7 +190,7 @@ enum bt_ctf_value_status bt_ctf_value_map_extend( struct bt_ctf_value; struct bt_ctf_private_value; -struct bt_ctf_private_value *bt_ctf_private_value_null; +extern struct bt_ctf_private_value *const bt_ctf_private_value_null; static inline struct bt_ctf_value *bt_ctf_private_value_as_value( diff --git a/lib/ctf-writer/values.c b/lib/ctf-writer/values.c index e67d8b59..dc84b769 100644 --- a/lib/ctf-writer/values.c +++ b/lib/ctf-writer/values.c @@ -88,8 +88,8 @@ struct bt_ctf_value bt_ctf_value_null_instance = { .frozen = BT_TRUE, }; -struct bt_ctf_value *bt_ctf_value_null = &bt_ctf_value_null_instance; -struct bt_ctf_private_value *bt_ctf_private_value_null = +struct bt_ctf_value *const bt_ctf_value_null = &bt_ctf_value_null_instance; +struct bt_ctf_private_value *const bt_ctf_private_value_null = (void *) &bt_ctf_value_null_instance; struct bt_ctf_value_bool { -- 2.34.1