aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog12
-rw-r--r--bfd/config.in12
-rwxr-xr-xbfd/configure148
-rw-r--r--bfd/configure.in4
-rw-r--r--bfd/elf.c4
-rw-r--r--bfd/hosts/x86-64linux.h2
6 files changed, 182 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 526dd83..53dcb8f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/config.in b/bfd/config.in
index b0b97a2..98157e1 100644
--- a/bfd/config.in
+++ b/bfd/config.in
@@ -144,9 +144,15 @@
/* Define if <sys/procfs.h> has prpsinfo32_t. */
#undef HAVE_PRPSINFO32_T
+/* Define if <sys/procfs.h> has prpsinfo32_t.pr_pid. */
+#undef HAVE_PRPSINFO32_T_PR_PID
+
/* Define if <sys/procfs.h> has prpsinfo_t. */
#undef HAVE_PRPSINFO_T
+/* Define if <sys/procfs.h> has prpsinfo_t.pr_pid. */
+#undef HAVE_PRPSINFO_T_PR_PID
+
/* Define if <sys/procfs.h> has prstatus32_t. */
#undef HAVE_PRSTATUS32_T
@@ -162,9 +168,15 @@
/* Define if <sys/procfs.h> has psinfo32_t. */
#undef HAVE_PSINFO32_T
+/* Define if <sys/procfs.h> has psinfo32_t.pr_pid. */
+#undef HAVE_PSINFO32_T_PR_PID
+
/* Define if <sys/procfs.h> has psinfo_t. */
#undef HAVE_PSINFO_T
+/* Define if <sys/procfs.h> has psinfo_t.pr_pid. */
+#undef HAVE_PSINFO_T_PR_PID
+
/* Define if <sys/procfs.h> has pstatus32_t. */
#undef HAVE_PSTATUS32_T
diff --git a/bfd/configure b/bfd/configure
index d587593..ac147ba 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -14379,6 +14379,43 @@ $as_echo "#define HAVE_PRPSINFO_T 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_procfs_type_prpsinfo_t" >&5
$as_echo "$bfd_cv_have_sys_procfs_type_prpsinfo_t" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for prpsinfo_t.pr_pid in sys/procfs.h" >&5
+$as_echo_n "checking for prpsinfo_t.pr_pid in sys/procfs.h... " >&6; }
+ if test "${bfd_cv_have_sys_procfs_type_member_prpsinfo_t_pr_pid+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
+#include <sys/procfs.h>
+int
+main ()
+{
+prpsinfo_t avar; void* aref = (void*) &avar.pr_pid
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ bfd_cv_have_sys_procfs_type_member_prpsinfo_t_pr_pid=yes
+else
+ bfd_cv_have_sys_procfs_type_member_prpsinfo_t_pr_pid=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_member_prpsinfo_t_pr_pid = yes; then
+
+$as_echo "#define HAVE_PRPSINFO_T_PR_PID 1" >>confdefs.h
+
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_procfs_type_member_prpsinfo_t_pr_pid" >&5
+$as_echo "$bfd_cv_have_sys_procfs_type_member_prpsinfo_t_pr_pid" >&6; }
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for prpsinfo32_t in sys/procfs.h" >&5
$as_echo_n "checking for prpsinfo32_t in sys/procfs.h... " >&6; }
if test "${bfd_cv_have_sys_procfs_type_prpsinfo32_t+set}" = set; then :
@@ -14416,6 +14453,43 @@ $as_echo "#define HAVE_PRPSINFO32_T 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_procfs_type_prpsinfo32_t" >&5
$as_echo "$bfd_cv_have_sys_procfs_type_prpsinfo32_t" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for prpsinfo32_t.pr_pid in sys/procfs.h" >&5
+$as_echo_n "checking for prpsinfo32_t.pr_pid in sys/procfs.h... " >&6; }
+ if test "${bfd_cv_have_sys_procfs_type_member_prpsinfo32_t_pr_pid+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
+#include <sys/procfs.h>
+int
+main ()
+{
+prpsinfo32_t avar; void* aref = (void*) &avar.pr_pid
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ bfd_cv_have_sys_procfs_type_member_prpsinfo32_t_pr_pid=yes
+else
+ bfd_cv_have_sys_procfs_type_member_prpsinfo32_t_pr_pid=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_member_prpsinfo32_t_pr_pid = yes; then
+
+$as_echo "#define HAVE_PRPSINFO32_T_PR_PID 1" >>confdefs.h
+
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_procfs_type_member_prpsinfo32_t_pr_pid" >&5
+$as_echo "$bfd_cv_have_sys_procfs_type_member_prpsinfo32_t_pr_pid" >&6; }
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for psinfo_t in sys/procfs.h" >&5
$as_echo_n "checking for psinfo_t in sys/procfs.h... " >&6; }
if test "${bfd_cv_have_sys_procfs_type_psinfo_t+set}" = set; then :
@@ -14453,6 +14527,43 @@ $as_echo "#define HAVE_PSINFO_T 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_procfs_type_psinfo_t" >&5
$as_echo "$bfd_cv_have_sys_procfs_type_psinfo_t" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for psinfo_t.pr_pid in sys/procfs.h" >&5
+$as_echo_n "checking for psinfo_t.pr_pid in sys/procfs.h... " >&6; }
+ if test "${bfd_cv_have_sys_procfs_type_member_psinfo_t_pr_pid+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
+#include <sys/procfs.h>
+int
+main ()
+{
+psinfo_t avar; void* aref = (void*) &avar.pr_pid
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ bfd_cv_have_sys_procfs_type_member_psinfo_t_pr_pid=yes
+else
+ bfd_cv_have_sys_procfs_type_member_psinfo_t_pr_pid=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_member_psinfo_t_pr_pid = yes; then
+
+$as_echo "#define HAVE_PSINFO_T_PR_PID 1" >>confdefs.h
+
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_procfs_type_member_psinfo_t_pr_pid" >&5
+$as_echo "$bfd_cv_have_sys_procfs_type_member_psinfo_t_pr_pid" >&6; }
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for psinfo32_t in sys/procfs.h" >&5
$as_echo_n "checking for psinfo32_t in sys/procfs.h... " >&6; }
if test "${bfd_cv_have_sys_procfs_type_psinfo32_t+set}" = set; then :
@@ -14490,6 +14601,43 @@ $as_echo "#define HAVE_PSINFO32_T 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_procfs_type_psinfo32_t" >&5
$as_echo "$bfd_cv_have_sys_procfs_type_psinfo32_t" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for psinfo32_t.pr_pid in sys/procfs.h" >&5
+$as_echo_n "checking for psinfo32_t.pr_pid in sys/procfs.h... " >&6; }
+ if test "${bfd_cv_have_sys_procfs_type_member_psinfo32_t_pr_pid+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#define _SYSCALL32
+/* Needed for new procfs interface on sparc-solaris. */
+#define _STRUCTURED_PROC 1
+#include <sys/procfs.h>
+int
+main ()
+{
+psinfo32_t avar; void* aref = (void*) &avar.pr_pid
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ bfd_cv_have_sys_procfs_type_member_psinfo32_t_pr_pid=yes
+else
+ bfd_cv_have_sys_procfs_type_member_psinfo32_t_pr_pid=no
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+ if test $bfd_cv_have_sys_procfs_type_member_psinfo32_t_pr_pid = yes; then
+
+$as_echo "#define HAVE_PSINFO32_T_PR_PID 1" >>confdefs.h
+
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $bfd_cv_have_sys_procfs_type_member_psinfo32_t_pr_pid" >&5
+$as_echo "$bfd_cv_have_sys_procfs_type_member_psinfo32_t_pr_pid" >&6; }
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lwpstatus_t in sys/procfs.h" >&5
$as_echo_n "checking for lwpstatus_t in sys/procfs.h... " >&6; }
if test "${bfd_cv_have_sys_procfs_type_lwpstatus_t+set}" = set; then :
diff --git a/bfd/configure.in b/bfd/configure.in
index eaba44c..713edea 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -488,9 +488,13 @@ changequote([,])dnl
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)
diff --git a/bfd/elf.c b/bfd/elf.c
index 966ada0..33a3a7d 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -8000,7 +8000,9 @@ elfcore_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
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 @@ elfcore_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
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));
diff --git a/bfd/hosts/x86-64linux.h b/bfd/hosts/x86-64linux.h
index 3bd2f8d..093af61 100644
--- a/bfd/hosts/x86-64linux.h
+++ b/bfd/hosts/x86-64linux.h
@@ -41,6 +41,8 @@ typedef unsigned int uint32_t;
#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