]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/xcoffread: remove name computation
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 8 Jan 2026 19:33:19 +0000 (14:33 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Fri, 9 Jan 2026 02:04:55 +0000 (21:04 -0500)
It is no longer necessary to get names of symbols.  The only thing we
are interested in is the symbol to get the TOC offset, for which the
name doesn't matter.

Change-Id: I47e6009ed7600ea9c412fb25ed21a295cd0fec49
Approved-By: Tom Tromey <tom@tromey.com>
gdb/xcoffread.c

index ef78a4c9e594835fa5837a952b99c65ee80f31bb..d46b4eb23f3d9bfa546be7c896c7c964879357e0 100644 (file)
@@ -38,9 +38,6 @@
 \f
 struct xcoff_symfile_info
   {
-    /* Pointer to the string table.  */
-    char *strtbl = nullptr;
-
     /* Pointer to debug section.  */
     char *debugsec = nullptr;
 
@@ -141,40 +138,15 @@ xcoff_symfile_init (struct objfile *objfile)
   xcoff_objfile_data_key.emplace (objfile);
 }
 
-/* Swap raw symbol at *RAW and put the name in *NAME, the symbol in
-   *SYMBOL, the first auxent in *AUX.  Advance *RAW and *SYMNUMP over
-   the symbol and its auxents.  */
+/* Swap raw symbol at *RAW.  Put the symbol in *SYMBOL and the first auxent in
+   *AUX.  Advance *RAW and *SYMNUMP over the symbol and its auxents.  */
 
 static void
 swap_sym (struct internal_syment *symbol, union internal_auxent *aux,
-         const char **name, char **raw, unsigned int *symnump,
-         struct objfile *objfile)
+         char **raw, unsigned int *symnump, struct objfile *objfile)
 {
   bfd_coff_swap_sym_in (objfile->obfd.get (), *raw, symbol);
-  if (symbol->n_zeroes)
-    {
-      /* If it's exactly E_SYMNMLEN characters long it isn't
-        '\0'-terminated.  */
-      if (symbol->n_name[E_SYMNMLEN - 1] != '\0')
-       {
-         /* FIXME: wastes memory for symbols which we don't end up putting
-            into the minimal symbols.  */
-         *name = obstack_strndup (&objfile->objfile_obstack,
-                                   symbol->n_name, E_SYMNMLEN);
-       }
-      else
-       /* Point to the unswapped name as that persists as long as the
-          objfile does.  */
-       *name = ((struct external_syment *) *raw)->e.e_name;
-    }
-  else if (symbol->n_sclass & 0x80)
-    {
-      *name = XCOFF_DATA (objfile)->debugsec + symbol->n_offset;
-    }
-  else
-    {
-      *name = XCOFF_DATA (objfile)->strtbl + symbol->n_offset;
-    }
+
   ++*symnump;
   *raw += coff_data (objfile->obfd)->local_symesz;
   if (symbol->n_numaux > 0)
@@ -192,7 +164,6 @@ scan_xcoff_symtab (struct objfile *objfile)
 {
   CORE_ADDR toc_offset = 0;    /* toc offset value in data section.  */
 
-  const char *namestring;
   bfd *abfd;
   asection *bfd_sect = nullptr;
   int ignored;
@@ -224,8 +195,7 @@ scan_xcoff_symtab (struct objfile *objfile)
            /* The CSECT auxent--always the last auxent.  */
            union internal_auxent csect_aux;
 
-           swap_sym (&symbol, &main_aux[0], &namestring, &sraw_symbol,
-                     &ssymnum, objfile);
+           swap_sym (&symbol, &main_aux[0], &sraw_symbol, &ssymnum, objfile);
            if (symbol.n_numaux > 1)
              {
                bfd_coff_swap_aux_in