From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 1/8] gdb/xcoffread: remove name computation
Date: Thu, 8 Jan 2026 14:33:19 -0500 [thread overview]
Message-ID: <20260108193507.553779-2-simon.marchi@efficios.com> (raw)
In-Reply-To: <20260108193507.553779-1-simon.marchi@efficios.com>
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
---
gdb/xcoffread.c | 40 +++++-----------------------------------
1 file changed, 5 insertions(+), 35 deletions(-)
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index ef78a4c9e594..d46b4eb23f3d 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -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
--
2.52.0
next prev parent reply other threads:[~2026-01-08 19:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 19:33 [PATCH 0/8] More xcoffread cleanups Simon Marchi
2026-01-08 19:33 ` Simon Marchi [this message]
2026-01-08 20:32 ` [PATCH 1/8] gdb/xcoffread: remove name computation Tom Tromey
2026-01-08 19:33 ` [PATCH 2/8] gdb/xcoffread: remove read of .debug section Simon Marchi
2026-01-08 20:32 ` Tom Tromey
2026-01-08 19:33 ` [PATCH 3/8] gdb/xcoffread: remove XCOFF_DATA macro Simon Marchi
2026-01-08 20:34 ` Tom Tromey
2026-01-08 19:33 ` [PATCH 4/8] gdb/xcoffread: remove xcoff_symfile_info::{symtbl, symtbl_num_syms} Simon Marchi
2026-01-08 20:36 ` Tom Tromey
2026-01-08 21:24 ` Simon Marchi
2026-01-08 22:17 ` Tom Tromey
2026-01-09 2:05 ` Simon Marchi
2026-01-08 19:33 ` [PATCH 5/8] gdb/xcoffread: allocate symbol table using vector in scan_xcoff_symtab Simon Marchi
2026-01-08 20:37 ` Tom Tromey
2026-01-08 19:33 ` [PATCH 6/8] gdb/xcoffread: simplify xcoff_secnum_to_sections Simon Marchi
2026-01-08 20:39 ` Tom Tromey
2026-01-08 19:33 ` [PATCH 7/8] gdb/xcoffread: replace 2 switches with if Simon Marchi
2026-01-08 20:40 ` Tom Tromey
2026-01-08 19:33 ` [PATCH 8/8] gdb/xcoffread: stylistic cleanup Simon Marchi
2026-01-08 20:41 ` Tom Tromey
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=20260108193507.553779-2-simon.marchi@efficios.com \
--to=simon.marchi@efficios.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