From: Jérémie Galarneau Date: Wed, 14 Sep 2016 17:42:03 +0000 (-0400) Subject: Add empty plug-in hooks to prevent their elimination by the linker X-Git-Tag: v2.0.0-pre1~913 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=7e3e3582f6fc79c97b07fad7fa7019e8a80aeb0e Add empty plug-in hooks to prevent their elimination by the linker Signed-off-by: Jérémie Galarneau --- diff --git a/converter/babeltrace.c b/converter/babeltrace.c index d61c245e..14d165ad 100644 --- a/converter/babeltrace.c +++ b/converter/babeltrace.c @@ -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); diff --git a/formats/bt-dummy/bt-dummy.c b/formats/bt-dummy/bt-dummy.c index 2f866dc9..fd10ccad 100644 --- a/formats/bt-dummy/bt-dummy.c +++ b/formats/bt-dummy/bt-dummy.c @@ -38,6 +38,14 @@ #include #include +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) { diff --git a/formats/ctf-metadata/ctf-metadata.c b/formats/ctf-metadata/ctf-metadata.c index ff65306f..a6397ec0 100644 --- a/formats/ctf-metadata/ctf-metadata.c +++ b/formats/ctf-metadata/ctf-metadata.c @@ -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) diff --git a/formats/ctf-text/ctf-text.c b/formats/ctf-text/ctf-text.c index a0b423c2..f6151617 100644 --- a/formats/ctf-text/ctf-text.c +++ b/formats/ctf-text/ctf-text.c @@ -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 */ diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 9b530219..597e8d25 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -159,6 +159,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 int ctf_timestamp_begin(struct bt_trace_descriptor *descriptor, struct bt_trace_handle *handle, enum bt_clock_type type, diff --git a/formats/lttng-live/lttng-live-plugin.c b/formats/lttng-live/lttng-live-plugin.c index 35f0f48a..f2c7536e 100644 --- a/formats/lttng-live/lttng-live-plugin.c +++ b/formats/lttng-live/lttng-live-plugin.c @@ -41,6 +41,14 @@ 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;