Add empty plug-in hooks to prevent their elimination by the linker
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 2 Feb 2017 22:03:12 +0000 (17:03 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 21 Feb 2017 02:46:49 +0000 (21:46 -0500)
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 2e4003ca45807c9acf6c9d6ce0811c487c1941b6..f74384eff49db840fe1b7b4f1b7e9021efeef2c3 100644 (file)
@@ -76,6 +76,12 @@ static int opt_stream_intersection;
 
 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)
 {
@@ -703,6 +709,15 @@ error_iter:
        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;
@@ -711,6 +726,8 @@ int main(int argc, char **argv)
        struct bt_context *ctx;
        int i;
 
+       call_plugins_hooks();
+
        opt_input_paths = g_ptr_array_new();
 
        ret = parse_options(argc, argv);
index 6192e88807570602fe31813f8a3303fa8c8858e4..65f2308145d1722c3845223f25326981be624b83 100644 (file)
 #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)
 {
index a5a74c3178db8d8a3c0a7f709563719a5505203b..a47fd36579c6b9fb659385143a6aa03b13fcc346 100644 (file)
@@ -54,6 +54,14 @@ struct bt_format ctf_metadata_format = {
        .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)
index cc22336ca5d33af0fe07c6c7b577b5e999a9a021..017f31113f0f442672339f66958cefa994bdb59c 100644 (file)
@@ -139,6 +139,14 @@ struct ctf_callsite_dups *ctf_trace_callsite_lookup(struct ctf_trace *trace,
                        (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 */
index 324b9f8e10b5059af7220421b107e70feca9718c..d6d078f5386308ee26db4a58a2cd2d03681f896c 100644 (file)
@@ -157,6 +157,14 @@ struct bt_format ctf_format = {
        .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
 uint64_t ctf_timestamp_begin(struct bt_trace_descriptor *descriptor,
                struct bt_trace_handle *handle, enum bt_clock_type type)
index a1fbb9e826efc903009e777a70dc0fd7522004c4..dfabb986922341d1ea72bc004d190113a221c774 100644 (file)
 
 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;
This page took 0.0278 seconds and 4 git commands to generate.