[binutils-gdb] Remove sym_fns::sym_new_init
Tom Tromey
tromey@sourceware.org
Thu Jan 8 13:42:22 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4e5dd0cfff786b6385622080bb436a9dc926d2d3
commit 4e5dd0cfff786b6385622080bb436a9dc926d2d3
Author: Tom Tromey <tom@tromey.com>
Date: Mon Jan 5 15:08:24 2026 -0700
Remove sym_fns::sym_new_init
sym_fns::sym_new_init has long been weird. There's even a comment in
symfile.c saying this.
After some recent changes, nothing needs this any more. So, this
patch removes it entirely.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diff:
---
gdb/coffread.c | 7 -------
gdb/elfread.c | 10 ----------
gdb/machoread.c | 6 ------
gdb/symfile-debug.c | 13 -------------
gdb/symfile.c | 10 ----------
gdb/symfile.h | 6 ------
gdb/xcoffread.c | 8 --------
7 files changed, 60 deletions(-)
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 82849146164..da45c4195bf 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -717,11 +717,6 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
}
}
-static void
-coff_new_init (struct objfile *ignore)
-{
-}
-
/* Perform any local cleanups required when we are done with a
particular objfile. I.E, we are in the process of discarding all
symbol information for an objfile, freeing up all memory held for
@@ -2106,8 +2101,6 @@ coff_read_enum_type (int index, int length, int lastsym,
static const struct sym_fns coff_sym_fns =
{
- coff_new_init, /* sym_new_init: init anything gbl to
- entire symtab */
coff_symfile_init, /* sym_init: read initial info, setup
for sym_read() */
coff_symfile_read, /* sym_read: read a symbol file into
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 2ad5e4e3201..7367007bf6e 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -1279,15 +1279,6 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
objfile->object_format_has_copy_relocs = true;
}
-/* Initialize anything that needs initializing when a completely new symbol
- file is specified (not just adding some symbols from another file, e.g. a
- shared library). */
-
-static void
-elf_new_init (struct objfile *ignore)
-{
-}
-
/* Perform any local cleanups required when we are done with a particular
objfile. I.E, we are in the process of discarding all symbol information
for an objfile, freeing up all memory held for it, and unlinking the
@@ -1338,7 +1329,6 @@ static const struct sym_probe_fns elf_probe_fns =
static const struct sym_fns elf_sym_fns =
{
- elf_new_init, /* init anything gbl to entire symtab */
elf_symfile_init, /* read initial info, setup for sym_read() */
elf_symfile_read, /* read a symbol file into symtab */
elf_symfile_finish, /* finished with file, cleanup */
diff --git a/gdb/machoread.c b/gdb/machoread.c
index cbdf4750266..b6454922700 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -72,11 +72,6 @@ struct oso_el
unsigned int nbr_syms;
};
-static void
-macho_new_init (struct objfile *objfile)
-{
-}
-
static void
macho_symfile_init (struct objfile *objfile)
{
@@ -929,7 +924,6 @@ macho_symfile_offsets (struct objfile *objfile,
}
static const struct sym_fns macho_sym_fns = {
- macho_new_init, /* init anything gbl to entire symtab */
macho_symfile_init, /* read initial info, setup for sym_read() */
macho_symfile_read, /* read a symbol file into symtab */
macho_symfile_finish, /* finished with file, cleanup */
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index f48443cd2f2..2ede106fd6f 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -708,18 +708,6 @@ static const struct sym_probe_fns debug_sym_probe_fns =
/* Debugging version of struct sym_fns. */
-static void
-debug_sym_new_init (struct objfile *objfile)
-{
- const struct debug_sym_fns_data *debug_data
- = symfile_debug_objfile_data_key.get (objfile);
-
- gdb_printf (gdb_stdlog, "sf->sym_new_init (%s)\n",
- objfile_debug_name (objfile));
-
- debug_data->real_sf->sym_new_init (objfile);
-}
-
static void
debug_sym_init (struct objfile *objfile)
{
@@ -833,7 +821,6 @@ install_symfile_debug_logging (struct objfile *objfile)
(to)->debug_sf.name = func; \
} while (0)
- COPY_SF_PTR (real_sf, debug_data, sym_new_init, debug_sym_new_init);
COPY_SF_PTR (real_sf, debug_data, sym_init, debug_sym_init);
COPY_SF_PTR (real_sf, debug_data, sym_read, debug_sym_read);
COPY_SF_PTR (real_sf, debug_data, sym_finish, debug_sym_finish);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 2b42138bf37..01467a9adc4 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -935,8 +935,6 @@ syms_from_objfile_1 (struct objfile *objfile,
If the user wants to get rid of them, they should do "symbol-file"
without arguments first. Not sure this is the best behavior
(PR 2207). */
-
- (*objfile->sf->sym_new_init) (objfile);
}
/* Convert addr into an offset rather than an absolute address.
@@ -2618,14 +2616,6 @@ reread_symbols (int from_tty)
build_objfile_section_table (&objfile);
- /* What the hell is sym_new_init for, anyway? The concept of
- distinguishing between the main file and additional files
- in this way seems rather dubious. */
- if (&objfile == current_program_space->symfile_object_file)
- {
- (*objfile.sf->sym_new_init) (&objfile);
- }
-
(*objfile.sf->sym_init) (&objfile);
clear_complaints ();
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 9ca17c3c597..8d9399ad7e9 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -117,12 +117,6 @@ struct sym_probe_fns
struct sym_fns
{
- /* Initializes anything that is global to the entire symbol table.
- It is called during symbol_file_add, when we begin debugging an
- entirely new program. */
-
- void (*sym_new_init) (struct objfile *);
-
/* Reads any initial information from a symbol file, and initializes
the struct sym_fns SF in preparation for sym_read(). It is
called every time we read a symbol file for any reason. */
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 74ce92bace0..a9ea574b3d5 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -100,8 +100,6 @@ static void scan_xcoff_symtab (struct objfile *);
static void xcoff_symfile_init (struct objfile *);
-static void xcoff_new_init (struct objfile *);
-
static void xcoff_symfile_finish (struct objfile *);
/* Search all BFD sections for the section whose target_index is
@@ -171,11 +169,6 @@ find_linenos (struct bfd *abfd, struct bfd_section *asect, void *vpinfo)
info->max_lineno_offset = maxoff;
}
-static void
-xcoff_new_init (struct objfile *objfile)
-{
-}
-
/* Do initialization in preparation for reading symbols from OBJFILE.
We will only be called if this is an XCOFF or XCOFF-like file.
@@ -499,7 +492,6 @@ static const struct sym_fns xcoff_sym_fns =
xcoffread.c reads all the symbols and does in fact randomly access them
(in C_BSTAT and line number processing). */
- xcoff_new_init, /* init anything gbl to entire symtab */
xcoff_symfile_init, /* read initial info, setup for sym_read() */
xcoff_initial_scan, /* read a symbol file into symtab */
xcoff_symfile_finish, /* finished with file, cleanup */
More information about the Gdb-cvs
mailing list