]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove sym_fns::sym_new_init
authorTom Tromey <tom@tromey.com>
Mon, 5 Jan 2026 22:08:24 +0000 (15:08 -0700)
committerTom Tromey <tom@tromey.com>
Thu, 8 Jan 2026 13:40:44 +0000 (06:40 -0700)
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>
gdb/coffread.c
gdb/elfread.c
gdb/machoread.c
gdb/symfile-debug.c
gdb/symfile.c
gdb/symfile.h
gdb/xcoffread.c

index 8284914616452abf044b27c6319a092c0e409520..da45c4195bf22ba7832b1e70c893a62f966a0749 100644 (file)
@@ -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
index 2ad5e4e32015eaf2a2e1004ddd19e3b827dd0f11..7367007bf6ebb85703f9c5524357afa04ac445e2 100644 (file)
@@ -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 */
index cbdf4750266df7c67a12a64eba92bffd5628f2bd..b6454922700d6e3478120c11856d4fe567daff9c 100644 (file)
@@ -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 */
index f48443cd2f2fb70a406816e498526d79b6415230..2ede106fd6f4500bf6f68d7a24303e147a74fea5 100644 (file)
@@ -708,18 +708,6 @@ static const struct sym_probe_fns debug_sym_probe_fns =
 \f
 /* 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);
index 2b42138bf37a4c1ab9cefbc5caf573f4bac771ee..01467a9adc494314a614b5a1b47b6090bc30f140 100644 (file)
@@ -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 ();
 
index 9ca17c3c59755cb828a5bedbcd84a86866bd0c9f..8d9399ad7e9a71df326a2a9e10964bbab2afba55 100644 (file)
@@ -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.  */
index 74ce92bace0236990e2b6b48dda67974b3a78332..a9ea574b3d5068302f6acc2f06bcaacfee13fd7c 100644 (file)
@@ -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 */