aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorAditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>2024-01-26 02:19:52 -0600
committerTom Tromey <tom@tromey.com>2024-01-31 17:30:25 -0700
commit49346fa79442ba6f0be832c2c5af4360e52f070a (patch)
treef35762eeb12117683df413823fcba61da533b6fb /gdb/utils.c
parent3d4b08fb895826ec5f0f6c36a3be98f955aa74ea (diff)
downloadbinutils-49346fa79442ba6f0be832c2c5af4360e52f070a.zip
binutils-49346fa79442ba6f0be832c2c5af4360e52f070a.tar.gz
binutils-49346fa79442ba6f0be832c2c5af4360e52f070a.tar.bz2
Fix AIX build break.
A recent commit broke AIX build. The thread_local type defined functions were being considered a weak symbol and hence while creating the binary these symbols were not visible. This patch is a fix for the same.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index b326033..702c3f1 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -128,7 +128,26 @@ show_pagination_enabled (struct ui_file *file, int from_tty,
}
+/* Warning hook pointer. This has to be 'static' to avoid link
+ problems with thread-locals on AIX. */
+static thread_local void (*warning_hook) (const char *, va_list);
+
+/* See utils.h. */
+
+warning_hook_handler
+get_warning_hook_handler ()
+{
+ return warning_hook;
+}
+
+/* See utils.h. */
+
+scoped_restore_warning_hook::scoped_restore_warning_hook
+ (warning_hook_handler new_handler)
+ : m_save (make_scoped_restore (&warning_hook, new_handler))
+{
+}
/* Print a warning message. The first argument STRING is the warning
message, used as an fprintf format string, the second is the
@@ -139,8 +158,8 @@ show_pagination_enabled (struct ui_file *file, int from_tty,
void
vwarning (const char *string, va_list args)
{
- if (deprecated_warning_hook)
- (*deprecated_warning_hook) (string, args);
+ if (warning_hook != nullptr)
+ warning_hook (string, args);
else
{
std::optional<target_terminal::scoped_restore_terminal_state> term_state;