From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [PATCH 05/10] Remove redundant nlist_bfd_global
Date: Fri, 16 Jan 2026 12:11:33 -0700 [thread overview]
Message-ID: <20260116-coffread-cleanups-v1-5-4d46090fad69@adacore.com> (raw)
In-Reply-To: <20260116-coffread-cleanups-v1-0-4d46090fad69@adacore.com>
coffread.c has two BFD globals: nlist_bfd_global and symfile_bfd.
There's no need for both, and since symfile_bfd is set early (in
coff_symfile_read, the entry point), this removes nlist_bfd_global and
replaces all the uses.
---
gdb/coffread.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/gdb/coffread.c b/gdb/coffread.c
index c8c9c6409ea..b75721d2577 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -32,10 +32,10 @@
static struct objfile *coffread_objfile;
-/* The addresses of the symbol table stream and number of symbols
- of the object file we are reading (as copied into core). */
+/* The BFD for this file -- only good while we're actively reading
+ symbols into a psymtab or a symtab. */
-static bfd *nlist_bfd_global;
+static bfd *symfile_bfd;
/* Pointers to scratch storage, used for reading raw symbols and
auxents. */
@@ -278,11 +278,6 @@ coff_read_minsyms (file_ptr symtab_offset, unsigned int nsyms,
}
}
-/* The BFD for this file -- only good while we're actively reading
- symbols into a psymtab or a symtab. */
-
-static bfd *symfile_bfd;
-
/* Read a symbol file, after initialization by coff_symfile_init. */
static void
@@ -394,7 +389,6 @@ coff_symtab_read (minimal_symbol_reader &reader,
objfile_name (objfile), bfd_errmsg (bfd_get_error ()));
coffread_objfile = objfile;
- nlist_bfd_global = objfile->obfd.get ();
while (symnum < nsyms)
{
@@ -538,7 +532,7 @@ read_one_sym (struct coff_symbol *cs)
bfd_size_type bytes;
internal_syment sym;
- bytes = bfd_read (temp_sym, local_symesz, nlist_bfd_global);
+ bytes = bfd_read (temp_sym, local_symesz, symfile_bfd);
if (bytes != local_symesz)
error (_("%s: error reading symbols"), objfile_name (coffread_objfile));
bfd_coff_swap_sym_in (symfile_bfd, temp_sym, &sym);
@@ -548,7 +542,7 @@ read_one_sym (struct coff_symbol *cs)
/* We don't need aux entries, read past them. */
for (i = 0; i < cs->c_naux; i++)
{
- bytes = bfd_read (temp_aux, local_auxesz, nlist_bfd_global);
+ bytes = bfd_read (temp_aux, local_auxesz, symfile_bfd);
if (bytes != local_auxesz)
error (_("%s: error reading symbols"),
objfile_name (coffread_objfile));
--
2.52.0
next prev parent reply other threads:[~2026-01-16 19:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 19:11 [PATCH 00/10] More coffread cleanups Tom Tromey
2026-01-16 19:11 ` [PATCH 01/10] Constify coffread.c:getsymname Tom Tromey
2026-01-16 19:11 ` [PATCH 02/10] Clean up a comment in coffread.c Tom Tromey
2026-01-16 19:11 ` [PATCH 03/10] Fix indentation " Tom Tromey
2026-01-17 3:54 ` Simon Marchi
2026-01-20 15:47 ` Tom Tromey
2026-01-16 19:11 ` [PATCH 04/10] Change coffread.c:pe_file to bool Tom Tromey
2026-01-16 19:11 ` Tom Tromey [this message]
2026-01-16 19:11 ` [PATCH 06/10] Use symfile_bfd in more places Tom Tromey
2026-01-17 4:09 ` Simon Marchi
2026-01-17 4:19 ` Simon Marchi
2026-01-17 4:10 ` Simon Marchi
2026-01-16 19:11 ` [PATCH 07/10] Use coffread_objfile throughout coffread.c Tom Tromey
2026-01-16 19:11 ` [PATCH 08/10] Remove coff_symfile_init Tom Tromey
2026-01-17 4:13 ` Simon Marchi
2026-01-20 15:54 ` Tom Tromey
2026-01-16 19:11 ` [PATCH 09/10] Remove all globals from coffread.c Tom Tromey
2026-01-16 19:11 ` [PATCH 10/10] Change is_import_fixup_symbol to return bool Tom Tromey
2026-01-17 4:20 ` [PATCH 00/10] More coffread cleanups Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260116-coffread-cleanups-v1-5-4d46090fad69@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox