tracefs: Set visibility of parser symbols as 'internal'
PATCH 1/1 tracefs: Set visibility of parser symbols as 'internal'
From: Daniel Wagner <[email protected]>
Two declarations of an object with 'hidden' linkage refer to the same object if they are in the same shared object.
Internal visibility is like hidden visibility, but with additional processor specific semantics. Unless otherwise specified by the psABI, GCC defines internal visibility to mean that a function is never called from another module.
It was observed that an 32bit linking against libtracefs failed because the parser symbols were missing. As the parser symbols are supposed to be used only inside the library, mark them as internal.
---
Hi,
The rtla build with libtracefs failed with
[ 192s] gcc -o rtla -ggdb src/osnoise.o src/osnoise_hist.o src/osnoise_top.o src/rtla.o src/timerlat.o src/timerlat_hist.o src/timerlat_top.o src/trace.o src/utils.o $(pkg-config --libs libtracefs) -lprocps [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `my_yyinput' [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `add_from' [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `add_number' [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `add_where' [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `add_filter' [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `add_to' [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `add_cast' [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `add_compare' [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `store_str' [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `add_match' [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `add_string' [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `sql_parse_error' [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `add_field' [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `table_start' [ 196s] /usr/lib/gcc/i586-suse-linux/12/../../../../i586-suse-linux/bin/ld: /usr/lib/gcc/i586-suse-linux/12/../../../libtracefs.so: undefined reference to `add_selection'
According https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
it seems we want the internal visibilty flag here. A quick test with this
patch resolved the build issue.
Thanks,
Daniel
include/tracefs-local.h | 1 + src/tracefs-sqlhist.c | 43 +++++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 21 deletions(-)
include/tracefs-local.h +1 -0
@@ -7,6 +7,7 @@#define _TRACE_FS_LOCAL_H#define __hidden __attribute__((visibility ("hidden"))) +#define __internal __attribute__((visibility ("internal")))#define __weak __attribute__((weak))#define ARRAY_SIZE (array) (sizeof(array) / sizeof((array)[0]))
src/tracefs-sqlhist.c +22 -21
133 lines not on this page · raw message
Signature · 1 line
2.36.1
Steven Rostedt
AppliedQuoted 10 lines · On Tue, 7 Jun 2022 11:12:15 +0200 Daniel Wagner <[email protected]> wrote:
From: Daniel Wagner <[email protected]>
Two declarations of an object with 'hidden' linkage refer to the same object if they are in the same shared object.
Internal visibility is like hidden visibility, but with additional processor specific semantics. Unless otherwise specified by the psABI, GCC defines internal visibility to mean that a function is never called from another module.
Quoted 6 lines
It was observed that an 32bit linking against libtracefs failed because the parser symbols were missing. As the parser symbols are supposed to be used only inside the library, mark them as internal.
Signed-off-by Daniel Wagner <[email protected]>---
Applied. Thanks Daniel!
-- Steve