* [PATCH] gdb: fix build errors in coffread.c and xcoffread.c
@ 2021-11-10 8:45 Tiezhu Yang
2021-11-15 20:28 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Tiezhu Yang @ 2021-11-10 8:45 UTC (permalink / raw)
To: gdb-patches
There exist the following build errors in gdb/coffread.c:
CXX coffread.o
/home/loongson/gdb.git/gdb/coffread.c: In function ‘const char* coff_getfilename(internal_auxent*)’:
/home/loongson/gdb.git.bak/gdb/coffread.c:1343:29: error: ‘union internal_auxent::<unnamed struct>::<unnamed>’ has no member named ‘x_zeroes’
if (aux_entry->x_file.x_n.x_zeroes == 0)
^~~~~~~~
/home/loongson/gdb.git/gdb/coffread.c:1345:53: error: ‘union internal_auxent::<unnamed struct>::<unnamed>’ has no member named ‘x_offset’
if (strlen (stringtab + aux_entry->x_file.x_n.x_offset) >= BUFSIZ)
^~~~~~~~
/home/loongson/gdb.git/gdb/coffread.c:1347:57: error: ‘union internal_auxent::<unnamed struct>::<unnamed>’ has no member named ‘x_offset’
strcpy (buffer, stringtab + aux_entry->x_file.x_n.x_offset);
^~~~~~~~
/home/loongson/gdb.git/gdb/coffread.c:1351:42: error: ‘struct internal_auxent::<unnamed>’ has no member named ‘x_fname’; did you mean ‘x_ftype’?
strncpy (buffer, aux_entry->x_file.x_fname, FILNMLEN);
^~~~~~~
x_ftype
make[2]: *** [Makefile:1665: coffread.o] Error 1
make[2]: Leaving directory '/home/loongson/build/gdb'
make[1]: *** [Makefile:11730: all-gdb] Error 2
make[1]: Leaving directory '/home/loongson/build'
make: *** [Makefile:903: all] Error 2
Similar problems exist in gdb/xcoffread.c, just fix them according to the
definition of struct x_file in include/coff/internal.h:
struct
{
union {
...
char x_fname[20];
struct
{
long x_zeroes;
long x_offset;
} x_n;
} x_n;
unsigned char x_ftype;
} x_file;
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
gdb/coffread.c | 8 ++++----
gdb/xcoffread.c | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 225e0e2..4723662 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -1340,15 +1340,15 @@ coff_getfilename (union internal_auxent *aux_entry)
static char buffer[BUFSIZ];
const char *result;
- if (aux_entry->x_file.x_n.x_zeroes == 0)
+ if (aux_entry->x_file.x_n.x_n.x_zeroes == 0)
{
- if (strlen (stringtab + aux_entry->x_file.x_n.x_offset) >= BUFSIZ)
+ if (strlen (stringtab + aux_entry->x_file.x_n.x_n.x_offset) >= BUFSIZ)
internal_error (__FILE__, __LINE__, _("coff file name too long"));
- strcpy (buffer, stringtab + aux_entry->x_file.x_n.x_offset);
+ strcpy (buffer, stringtab + aux_entry->x_file.x_n.x_n.x_offset);
}
else
{
- strncpy (buffer, aux_entry->x_file.x_fname, FILNMLEN);
+ strncpy (buffer, aux_entry->x_file.x_n.x_fname, FILNMLEN);
buffer[FILNMLEN] = '\0';
}
result = buffer;
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index a854d4d..067f6fe 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1678,12 +1678,12 @@ coff_getfilename (union internal_auxent *aux_entry, struct objfile *objfile)
{
static char buffer[BUFSIZ];
- if (aux_entry->x_file.x_n.x_zeroes == 0)
+ if (aux_entry->x_file.x_n.x_n.x_zeroes == 0)
strcpy (buffer, (XCOFF_DATA (objfile)->strtbl
- + aux_entry->x_file.x_n.x_offset));
+ + aux_entry->x_file.x_n.x_n.x_offset));
else
{
- strncpy (buffer, aux_entry->x_file.x_fname, FILNMLEN);
+ strncpy (buffer, aux_entry->x_file.x_n.x_fname, FILNMLEN);
buffer[FILNMLEN] = '\0';
}
return (buffer);
--
2.1.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] gdb: fix build errors in coffread.c and xcoffread.c
2021-11-10 8:45 [PATCH] gdb: fix build errors in coffread.c and xcoffread.c Tiezhu Yang
@ 2021-11-15 20:28 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2021-11-15 20:28 UTC (permalink / raw)
To: Tiezhu Yang; +Cc: gdb-patches
>>>>> ">" == Tiezhu Yang <yangtiezhu@loongson.cn> writes:
>> There exist the following build errors in gdb/coffread.c:
>> CXX coffread.o
Thank you for the patch.
I didn't see a response to your email, but I think this was fixed in the
same way by commit b08625a ("adjust x_file fields on COFF readers").
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-15 20:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 8:45 [PATCH] gdb: fix build errors in coffread.c and xcoffread.c Tiezhu Yang
2021-11-15 20:28 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).