[PATCH] always export the symbols for the proc_service interface

Norbert Lange
2020-01-04T20:20:45Z

Compiling GDB with '-fvisibility=hidden' will remove the
symbols that should be exported.
This patch explicitly marks them as visible.

gdb/ChangeLog

PR build/24805
* gdbsupport/gdb_proc_service.h: push/pop visibility
attribute for exported functions.
---
gdb/gdbsupport/gdb_proc_service.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/gdb/gdbsupport/gdb_proc_service.h b/gdb/gdbsupport/gdb_proc_service.h
index 8565da3286..72abb5c1c0 100644
--- a/gdb/gdbsupport/gdb_proc_service.h
+++ b/gdb/gdbsupport/gdb_proc_service.h
@@ -23,6 +23,11 @@

#ifdef HAVE_PROC_SERVICE_H

+/* ensure the symbols are public, even if the default is hidden */
+#if __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
/* glibc's proc_service.h doesn't wrap itself with extern "C". Need
to do it ourselves. */
EXTERN_C_PUSH
@@ -31,6 +36,10 @@ EXTERN_C_PUSH

EXTERN_C_POP

+#if __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
#else /* HAVE_PROC_SERVICE_H */

/* The following fallback definitions have been imported and adjusted
@@ -69,6 +78,10 @@ EXTERN_C_POP
# endif
#endif

+#if __GNUC__ >= 4
+#pragma GCC visibility push(default)
+#endif
+
EXTERN_C_PUSH

/* Functions in this interface return one of these status codes. */
@@ -168,6 +181,10 @@ extern void ps_plog (const char *fmt, ...);

EXTERN_C_POP

+#if __GNUC__ >= 4
+#pragma GCC visibility pop
+#endif
+
#endif /* HAVE_PROC_SERVICE_H */

#endif /* COMMON_GDB_PROC_SERVICE_H */
--
2.24.1