This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch] Fix BSD build regression on core file's PID
On Thu, 12 May 2011 03:30:51 +0200, Alan Modra wrote:
> I think the code would be clearer without these two new macros.
> ie. Keep with existing practice in elfcore_grok_psinfo and use
> #if defined (HAVE_PSINFO_T_PR_PID) || defined (HAVE_PRPSINFO_T_PR_PID)
> and
> #if defined (HAVE_PSINFO32_T_PR_PID) || defined (HAVE_PRPSINFO32_T_PR_PID)
> instead.
done.
> OK with that change.
Checked in.
Thanks,
Jan
http://sourceware.org/ml/binutils-cvs/2011-05/msg00070.html
--- src/bfd/ChangeLog 2011/05/10 06:13:05 1.5339
+++ src/bfd/ChangeLog 2011/05/12 07:41:37 1.5340
@@ -1,3 +1,15 @@
+2011-05-12 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ * config.in: Regenerated.
+ * configure: Regenerated.
+ * configure.in: New tests for HAVE_PRPSINFO_T_PR_PID,
+ HAVE_PRPSINFO32_T_PR_PID, HAVE_PSINFO_T_PR_PID and
+ HAVE_PSINFO32_T_PR_PID.
+ * elf.c (elfcore_grok_psinfo): Protect reading psinfo.pr_pid by
+ HAVE_PRPSINFO_T_PR_PID, HAVE_PRPSINFO32_T_PR_PID, HAVE_PSINFO_T_PR_PID
+ and HAVE_PSINFO32_T_PR_PID.
+ * hosts/x86-64linux.h (HAVE_PRPSINFO32_T_PR_PID): New redefinition.
+
2011-05-10 Jan Kratochvil <jan.kratochvil@redhat.com>
* elf.c (elfcore_grok_psinfo): Initialize CORE_PID for both native and
--- src/bfd/configure.in 2011/03/28 11:18:26 1.291
+++ src/bfd/configure.in 2011/05/12 07:41:42 1.292
@@ -488,9 +488,13 @@
BFD_HAVE_SYS_PROCFS_TYPE(pxstatus_t)
BFD_HAVE_SYS_PROCFS_TYPE(pstatus32_t)
BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo_t)
+ BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prpsinfo_t, pr_pid)
BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo32_t)
+ BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prpsinfo32_t, pr_pid)
BFD_HAVE_SYS_PROCFS_TYPE(psinfo_t)
+ BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(psinfo_t, pr_pid)
BFD_HAVE_SYS_PROCFS_TYPE(psinfo32_t)
+ BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(psinfo32_t, pr_pid)
BFD_HAVE_SYS_PROCFS_TYPE(lwpstatus_t)
BFD_HAVE_SYS_PROCFS_TYPE(lwpxstatus_t)
BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_context)
--- src/bfd/elf.c 2011/05/10 06:13:07 1.535
+++ src/bfd/elf.c 2011/05/12 07:41:42 1.536
@@ -8000,7 +8000,9 @@
memcpy (&psinfo, note->descdata, sizeof (psinfo));
+#if defined (HAVE_PSINFO_T_PR_PID) || defined (HAVE_PRPSINFO_T_PR_PID)
elf_tdata (abfd)->core_pid = psinfo.pr_pid;
+#endif
elf_tdata (abfd)->core_program
= _bfd_elfcore_strndup (abfd, psinfo.pr_fname,
sizeof (psinfo.pr_fname));
@@ -8017,7 +8019,9 @@
memcpy (&psinfo, note->descdata, sizeof (psinfo));
+#if defined (HAVE_PSINFO32_T_PR_PID) || defined (HAVE_PRPSINFO32_T_PR_PID)
elf_tdata (abfd)->core_pid = psinfo.pr_pid;
+#endif
elf_tdata (abfd)->core_program
= _bfd_elfcore_strndup (abfd, psinfo.pr_fname,
sizeof (psinfo.pr_fname));
--- src/bfd/hosts/x86-64linux.h 2011/04/09 14:26:13 1.3
+++ src/bfd/hosts/x86-64linux.h 2011/05/12 07:41:43 1.4
@@ -41,6 +41,8 @@
#undef HAVE_PRPSINFO32_T
#define HAVE_PRPSINFO32_T
+#undef HAVE_PRPSINFO32_T_PR_PID
+#define HAVE_PRPSINFO32_T_PR_PID
#undef HAVE_PRSTATUS32_T
#define HAVE_PRSTATUS32_T