Fix: build failure with -fno-common
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 16 Jan 2020 19:34:47 +0000 (14:34 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 17 Jan 2020 18:57:23 +0000 (13:57 -0500)
GCC 10 will default to building with -fno-common, this inhibits the
linker from merging multiple tentative definitions of a symbol in an
archive.

I'm not sure I understand what happen with the symbols in mi-lttng.h
but a similar issue was adressed in:

  commit 4965f956f3ef47388fb4a1b2f8f504abfe31afe7
  Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
  Date:   Fri May 22 12:53:30 2015 -0400

    Fix: Mark MI and Config string declarations as extern

    This fixes a build issue with GCC 5.1 which would complain about
    these symbols being defined multiple times.

Make sure these symbols are extern and defined only in one compile unit.

For more information, see:
https://gcc.gnu.org/gcc-10/porting_to.html

Change-Id: I139c9695371836cb1011f9ce192080b602ed2fbc
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-consumerd/lttng-consumerd.h
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng-sessiond/ust-app.h
src/common/mi-lttng.h
tests/regression/tools/live/live_test.c
tests/unit/test_kernel_data.c
tests/unit/test_session.c
tests/unit/test_ust_data.c

index 6d18fdf884940c6bc8de351c025f2d6a652c8f34..dbbb83e878630c18b66d3b310e401e8b157891fe 100644 (file)
@@ -23,7 +23,7 @@
 #define NR_LTTNG_CONSUMER_READY                1
 extern int lttng_consumer_ready;
 
-const char *tracing_group_name;
+extern const char *tracing_group_name;
 
 enum lttng_consumer_type lttng_consumer_get_type(void);
 
index 63bf4648b5b6f1ade155fdaaa92917515d6814cd..d3c28883c74bea2416d9afb8a5f0db7c87c03f91 100644 (file)
 #include "notification-thread-commands.h"
 #include "rotate.h"
 
+struct lttng_ht *ust_app_ht;
+struct lttng_ht *ust_app_ht_by_sock;
+struct lttng_ht *ust_app_ht_by_notify_sock;
+
 static
 int ust_app_flush_app_session(struct ust_app *app, struct ust_app_session *ua_sess);
 
index 957d1f95d7b2bf5d82663e13cd9bb3e4ee1e9e59..45521e66b32d4a0598c1f1f7d597c478eba02125 100644 (file)
@@ -81,7 +81,7 @@ struct ust_register_msg {
  * Global applications HT used by the session daemon. This table is indexed by
  * PID using the pid_n node and pid value of an ust_app.
  */
-struct lttng_ht *ust_app_ht;
+extern struct lttng_ht *ust_app_ht;
 
 /*
  * Global applications HT used by the session daemon. This table is indexed by
@@ -89,13 +89,13 @@ struct lttng_ht *ust_app_ht;
  *
  * The 'sock' in question here is the 'command' socket.
  */
-struct lttng_ht *ust_app_ht_by_sock;
+extern struct lttng_ht *ust_app_ht_by_sock;
 
 /*
  * Global applications HT used by the session daemon. This table is indexed by
  * socket using the notify_sock_n node and notify_sock value of an ust_app.
  */
-struct lttng_ht *ust_app_ht_by_notify_sock;
+extern struct lttng_ht *ust_app_ht_by_notify_sock;
 
 /* Stream list containing ust_app_stream. */
 struct ust_app_stream_list {
index 2e4592b535902d8944176ac6d0d17f8a24ab28d4..7cac7f305805531da4089f66a8e6fcb112a95bd6 100644 (file)
@@ -111,8 +111,8 @@ extern const char * const mi_lttng_element_save;
 
 /* Strings related to load command */
 extern const char * const mi_lttng_element_load;
-LTTNG_HIDDEN const char * const mi_lttng_element_load_overrides;
-LTTNG_HIDDEN const char * const mi_lttng_element_load_override_url;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_load_overrides;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_load_override_url;
 
 /* General element of mi_lttng */
 extern const char * const mi_lttng_element_empty;
@@ -187,40 +187,40 @@ extern const char * const mi_lttng_element_snapshot_session_name;
 extern const char * const mi_lttng_element_snapshots;
 
 /* String related to track/untrack command */
-const char * const mi_lttng_element_track_untrack_all_wildcard;
+extern const char * const mi_lttng_element_track_untrack_all_wildcard;
 
-LTTNG_HIDDEN const char * const mi_lttng_element_session_name;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_session_name;
 
 /* String related to rotate command */
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotate_status;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedules;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule_periodic;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule_periodic_time_us;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule_size_threshold;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule_size_threshold_bytes;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule_result;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_schedule_results;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_state;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_local;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_local_absolute_path;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_relay;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_relay_host;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_relay_control_port;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_relay_data_port;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_relay_protocol;
-LTTNG_HIDDEN const char * const mi_lttng_element_rotation_location_relay_relative_path;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotate_status;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedule;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedules;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedule_periodic;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedule_periodic_time_us;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedule_size_threshold;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedule_size_threshold_bytes;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedule_result;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_schedule_results;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_state;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_local;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_local_absolute_path;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_relay;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_relay_host;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_relay_control_port;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_relay_data_port;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_relay_protocol;
+LTTNG_HIDDEN extern const char * const mi_lttng_element_rotation_location_relay_relative_path;
 
 /* String related to enum lttng_rotation_state */
-LTTNG_HIDDEN const char * const mi_lttng_rotation_state_str_ongoing;
-LTTNG_HIDDEN const char * const mi_lttng_rotation_state_str_completed;
-LTTNG_HIDDEN const char * const mi_lttng_rotation_state_str_expired;
-LTTNG_HIDDEN const char * const mi_lttng_rotation_state_str_error;
+LTTNG_HIDDEN extern const char * const mi_lttng_rotation_state_str_ongoing;
+LTTNG_HIDDEN extern const char * const mi_lttng_rotation_state_str_completed;
+LTTNG_HIDDEN extern const char * const mi_lttng_rotation_state_str_expired;
+LTTNG_HIDDEN extern const char * const mi_lttng_rotation_state_str_error;
 
 /* String related to enum lttng_trace_archive_location_relay_protocol_type */
-LTTNG_HIDDEN const char * const mi_lttng_rotation_location_relay_protocol_str_tcp;
+LTTNG_HIDDEN extern const char * const mi_lttng_rotation_location_relay_protocol_str_tcp;
 
 /* String related to add-context command */
 LTTNG_HIDDEN extern const char * const mi_lttng_element_context_symbol;
index 217c72af422b9286d8b38fe60ed4c4132f1532cb..151e23fb6eb60089df712efcc51eacba017283af 100644 (file)
@@ -51,9 +51,6 @@
 #define NUM_TESTS 11
 #define mmap_size 524288
 
-int ust_consumerd32_fd;
-int ust_consumerd64_fd;
-
 static int control_sock;
 struct live_session *session;
 
index 412e4004f9d09fcea583d2a79a5dba773f974bf7..132488051324ad7aa9fed5a5167d9c4b8fd8e042 100644 (file)
 int lttng_opt_quiet = 1;
 int lttng_opt_verbose;
 int lttng_opt_mi;
-struct notification_thread_handle *notification_thread_handle;
-
-int ust_consumerd32_fd;
-int ust_consumerd64_fd;
 
 static const char alphanum[] =
        "0123456789"
index 4e659d5242b6af9f1fdf5ee91ac5e711159d33e7..507f665e02e13fdbb4f24565286b7929af8d8372 100644 (file)
@@ -44,7 +44,6 @@
 /* Number of TAP tests in this file */
 #define NUM_TESTS 11
 
-struct health_app *health_sessiond;
 static struct ltt_session_list *session_list;
 
 /* For error.h */
@@ -52,9 +51,6 @@ int lttng_opt_quiet = 1;
 int lttng_opt_verbose = 0;
 int lttng_opt_mi;
 
-int ust_consumerd32_fd;
-int ust_consumerd64_fd;
-
 static const char alphanum[] =
        "0123456789"
        "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
index b4e927c9d4ea8212284fee020ce6bc3f81acc8cd..a900d1274e44effe84f50de7a9691e2fcdf1cec3 100644 (file)
@@ -47,13 +47,6 @@ int lttng_opt_quiet = 1;
 int lttng_opt_verbose;
 int lttng_opt_mi;
 
-int ust_consumerd32_fd;
-int ust_consumerd64_fd;
-
-/* Global variables required by sessiond objects being linked-in */
-struct lttng_ht *agent_apps_ht_by_sock;
-struct notification_thread_handle *notification_thread_handle;
-
 static const char alphanum[] =
        "0123456789"
        "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
This page took 0.033192 seconds and 4 git commands to generate.