Add empty plug-in hooks to prevent their elimination by the linker
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 14 Sep 2016 17:42:03 +0000 (13:42 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 14 Sep 2016 18:03:50 +0000 (14:03 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
converter/babeltrace.c
formats/bt-dummy/bt-dummy.c
formats/ctf-metadata/ctf-metadata.c
formats/ctf-text/ctf-text.c
formats/ctf/ctf.c
formats/lttng-live/lttng-live-plugin.c

index d61c245e9141bc23cd4a73dd41600bf64cd23954..14d165ad915849ec7f407a0acc7a1fd9ce5a1f06 100644 (file)
@@ -76,6 +76,12 @@ static int opt_stream_intersection;
 
 static struct bt_format *fmt_read;
 
 
 static struct bt_format *fmt_read;
 
+void bt_dummy_hook(void);
+void bt_lttng_live_hook(void);
+void bt_ctf_hook(void);
+void bt_ctf_text_hook(void);
+void bt_ctf_metadata_hook(void);
+
 static
 void strlower(char *str)
 {
 static
 void strlower(char *str)
 {
@@ -703,6 +709,15 @@ error_iter:
        return ret;
 }
 
        return ret;
 }
 
+void call_plugins_hooks(void)
+{
+       bt_dummy_hook();
+       bt_lttng_live_hook();
+       bt_ctf_hook();
+       bt_ctf_text_hook();
+       bt_ctf_metadata_hook();
+}
+
 int main(int argc, char **argv)
 {
        int ret, partial_error = 0, open_success = 0;
 int main(int argc, char **argv)
 {
        int ret, partial_error = 0, open_success = 0;
@@ -711,6 +726,8 @@ int main(int argc, char **argv)
        struct bt_context *ctx;
        int i;
 
        struct bt_context *ctx;
        int i;
 
+       call_plugins_hooks();
+
        opt_input_paths = g_ptr_array_new();
 
        ret = parse_options(argc, argv);
        opt_input_paths = g_ptr_array_new();
 
        ret = parse_options(argc, argv);
index 2f866dc95e3a6cd04e08043fd3576ff8763d56da..fd10ccad39e3f79a500ddf12a87124ec135380ca 100644 (file)
 #include <unistd.h>
 #include <stdlib.h>
 
 #include <unistd.h>
 #include <stdlib.h>
 
+void bt_dummy_hook(void)
+{
+       /*
+        * Dummy function to prevent the linker from discarding this format as
+        * "unused" in static builds.
+        */
+}
+
 static
 int bt_dummy_write_event(struct bt_stream_pos *ppos, struct ctf_stream_definition *stream)
 {
 static
 int bt_dummy_write_event(struct bt_stream_pos *ppos, struct ctf_stream_definition *stream)
 {
index ff65306f764aed49b3b1d614b0ebf3f30505d693..a6397ec0b18d7b5f11d526567c29469bccacdd3e 100644 (file)
@@ -54,6 +54,14 @@ struct bt_format ctf_metadata_format = {
        .close_trace = ctf_metadata_close_trace,
 };
 
        .close_trace = ctf_metadata_close_trace,
 };
 
+void bt_ctf_metadata_hook(void)
+{
+       /*
+        * Dummy function to prevent the linker from discarding this format as
+        * "unused" in static builds.
+        */
+}
+
 static
 int ctf_metadata_trace_pre_handler(struct bt_stream_pos *ppos,
                        struct bt_trace_descriptor *td)
 static
 int ctf_metadata_trace_pre_handler(struct bt_stream_pos *ppos,
                        struct bt_trace_descriptor *td)
index a0b423c2254d4793b5298131a262d4d458b5e478..f6151617450c760e2e9fe354aa64c497e39d6a54 100644 (file)
@@ -139,6 +139,14 @@ struct ctf_callsite_dups *ctf_trace_callsite_lookup(struct ctf_trace *trace,
                        (gpointer) (unsigned long) callsite_name);
 }
 
                        (gpointer) (unsigned long) callsite_name);
 }
 
+void bt_ctf_text_hook(void)
+{
+       /*
+        * Dummy function to prevent the linker from discarding this format as
+        * "unused" in static builds.
+        */
+}
+
 int print_field(struct bt_definition *definition)
 {
        /* Print all fields in verbose mode */
 int print_field(struct bt_definition *definition)
 {
        /* Print all fields in verbose mode */
index 9b5302199e17391e0ec73b90d078f44bf0680e27..597e8d25f9e97baf2852d468a2422d3ae7aa377a 100644 (file)
@@ -159,6 +159,14 @@ struct bt_format ctf_format = {
        .convert_index_timestamp = ctf_convert_index_timestamp,
 };
 
        .convert_index_timestamp = ctf_convert_index_timestamp,
 };
 
+void bt_ctf_hook(void)
+{
+       /*
+        * Dummy function to prevent the linker from discarding this format as
+        * "unused" in static builds.
+        */
+}
+
 static
 int ctf_timestamp_begin(struct bt_trace_descriptor *descriptor,
                struct bt_trace_handle *handle, enum bt_clock_type type,
 static
 int ctf_timestamp_begin(struct bt_trace_descriptor *descriptor,
                struct bt_trace_handle *handle, enum bt_clock_type type,
index 35f0f48a428854412f19fdd68a34bf5c44bec25a..f2c7536ec0d4e6223f21d68985fa9fcbb0665b3b 100644 (file)
 
 static volatile int should_quit;
 
 
 static volatile int should_quit;
 
+void bt_lttng_live_hook(void)
+{
+       /*
+        * Dummy function to prevent the linker from discarding this format as
+        * "unused" in static builds.
+        */
+}
+
 int lttng_live_should_quit(void)
 {
        return should_quit;
 int lttng_live_should_quit(void)
 {
        return should_quit;
This page took 0.028102 seconds and 4 git commands to generate.