This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[RFA] Fix compilation error on FreeBSD/i386
- From: Mark Kettenis <kettenis at kettenis dot dyndns dot org>
- To: binutils at sources dot redhat dot com
- Cc: ac131313 at cygnus dot com
- Date: Sat, 19 Jan 2002 13:16:57 +0100 (CET)
- Subject: [RFA] Fix compilation error on FreeBSD/i386
- Reply-to: kettenis at gnu dot org
As already noticed by Andrew Cagney BFD doesn't compile on
FreeBSD/i386 anymore. I agree with his guess at a fix for the
problem. Here's a bit more detail:
The pr_reg member of prstatus_t is on many systems an array.
Consequently, the expression prstat.pr_reg is the address of storage.
However, on FreeBSD the pr_reg member is a struct, which leads to a
"incompatible type for argument 1" compiler error. Since
&prstat.pr_reg still evaluates to the address for the storage for
arrays, the fix below should be OK.
Ok to check this in?
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* elf.c (elfcore_write_prstatus): Make sure we pass the address of
prstat.pr_reg even if it is a struct.
Index: elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.123
diff -u -p -r1.123 elf.c
--- elf.c 2002/01/17 13:02:40 1.123
+++ elf.c 2002/01/19 12:05:26
@@ -6585,7 +6585,7 @@ elfcore_write_prstatus (abfd, buf, bufsi
memset (&prstat, 0, sizeof (prstat));
prstat.pr_pid = pid;
prstat.pr_cursig = cursig;
- memcpy (prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
+ memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
return elfcore_write_note (abfd, buf, bufsiz,
note_name, NT_PRSTATUS, &prstat, sizeof (prstat));
}