aboutsummaryrefslogtreecommitdiff
path: root/bfd/bfd.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-08-27 11:37:38 -0600
committerTom Tromey <tom@tromey.com>2023-11-07 17:47:12 -0700
commitc6d6a048f5a6f422e470c7c4bdb21a0c59d7c8fd (patch)
tree6059da9eaca725a1e8582e4ae8c919f34019b430 /bfd/bfd.c
parent426931be4b538078c89c09d89ae3ecbab3146f46 (diff)
downloadgdb-c6d6a048f5a6f422e470c7c4bdb21a0c59d7c8fd.zip
gdb-c6d6a048f5a6f422e470c7c4bdb21a0c59d7c8fd.tar.gz
gdb-c6d6a048f5a6f422e470c7c4bdb21a0c59d7c8fd.tar.bz2
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.
Diffstat (limited to 'bfd/bfd.c')
-rw-r--r--bfd/bfd.c12
1 files changed, 7 insertions, 5 deletions
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 <<bfd_perror>>.
+ The BFD error is thread-local.
+
SUBSECTION
Type <<bfd_error_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.