From c6d6a048f5a6f422e470c7c4bdb21a0c59d7c8fd Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 27 Aug 2023 11:37:38 -0600 Subject: Make various error-related globals thread-local This changes bfd_error et al to be thread-local. * Makefile.in: Regenerate. * aclocal.m4: Include ax_tls.m4. * ax_tls.m4: New file. * bfd.c: (bfd_error, input_error, input_bfd, _bfd_error_buf): Now thread-local. (bfd_asprintf): Update docs. * config.in, configure: Regenerate. * configure.ac: Call AX_TLS. * po/bfd.pot: Regenerate. --- bfd/bfd.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'bfd/bfd.c') diff --git a/bfd/bfd.c b/bfd/bfd.c index 08980ae..2cf8361 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -691,6 +691,8 @@ SECTION The easiest way to report a BFD error to the user is to use <>. + The BFD error is thread-local. + SUBSECTION Type <> @@ -728,10 +730,10 @@ CODE_FRAGMENT . */ -static bfd_error_type bfd_error; -static bfd_error_type input_error; -static bfd *input_bfd; -static char *_bfd_error_buf; +static TLS bfd_error_type bfd_error; +static TLS bfd_error_type input_error; +static TLS bfd *input_bfd; +static TLS char *_bfd_error_buf; const char *const bfd_errmsgs[] = { @@ -920,7 +922,7 @@ DESCRIPTION Primarily for error reporting, this function is like libiberty's xasprintf except that it can return NULL on no memory and the returned string should not be freed. Uses a - single malloc'd buffer managed by libbfd, _bfd_error_buf. + thread-local malloc'd buffer managed by libbfd, _bfd_error_buf. Be aware that a call to this function frees the result of any previous call. bfd_errmsg (bfd_error_on_input) also calls this function. -- cgit v1.1