diff options
author | Clément Chigot <clement.chigot@atos.net> | 2021-11-15 10:37:36 +0100 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-11-15 23:07:11 +1030 |
commit | eae06bb301512a21277dd48a4bff025c4dceda9e (patch) | |
tree | 4f5fcc18608ee39d0a4c08d065c9706deeae164e /bfd | |
parent | f9402ccaa9fac7858713a7672fae5760ae3d5ce7 (diff) | |
download | gdb-eae06bb301512a21277dd48a4bff025c4dceda9e.zip gdb-eae06bb301512a21277dd48a4bff025c4dceda9e.tar.gz gdb-eae06bb301512a21277dd48a4bff025c4dceda9e.tar.bz2 |
COFF: avoid modifications over C_FILE filename aux entries.
Commit e86fc4a5bc37 ("PR 28447: implement multiple parameters for .file
on XCOFF") introduces C_FILE entries which can store additional
information.
However, some modifications are needed by them but not by the original
C_FILE entries, usually representing the filename.
This patch ensures that filename entries are kept as is, in order to
protect targets not supporting the additional entries.
* coffgen.c (coff_write_symbol): Protect filename entries
(coff_write_symbols): Likewise.
(coff_print_symbol): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/coffgen.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 40f1ac7..5474f6c 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -1036,7 +1036,10 @@ coff_write_symbol (bfd *abfd, { BFD_ASSERT (! (native + j + 1)->is_sym); - if (native->u.syment.n_sclass == C_FILE && j > 0) + /* Adjust auxent only if this isn't the filename + auxiliary entry. */ + if (native->u.syment.n_sclass == C_FILE + && (native + j + 1)->u.auxent.x_file.x_ftype) coff_write_auxent_fname (abfd, (char *) (native + j + 1)->extrap, &(native + j + 1)->u.auxent, string_size_p); @@ -1423,6 +1426,11 @@ coff_write_symbols (bfd *abfd) char *str; size_t str_length; + /* Add strings from aux entries only if this isn't the + filename auxiliary entry. */ + if (!c_symbol->native[j + 1].u.auxent.x_file.x_ftype) + continue; + if (c_symbol->native[j + 1].u.auxent.x_file.x_n.x_fname[0] != 0) continue; @@ -2207,7 +2215,7 @@ coff_print_symbol (bfd *abfd, fprintf (file, "File "); /* Add additional information if this isn't the filename auxiliary entry. */ - if (aux) + if (auxp->u.auxent.x_file.x_ftype) fprintf (file, "ftype %d fname \"%s\"", auxp->u.auxent.x_file.x_ftype, (char *) auxp->u.auxent.x_file.x_n.x_n.x_offset); |