This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] bi-arch for x86-64 corefile.


On 10/30/2012 08:21 AM, H.J. Lu wrote:
diff --git a/bfd/configure.in b/bfd/configure.in
>index 530bbcb..5ed3ac2 100644
>--- a/bfd/configure.in
>+++ b/bfd/configure.in
>@@ -331,6 +331,9 @@ changequote(,)dnl
>  changequote([,])dnl
>         COREFILE=trad-core.lo
>         TRAD_HEADER='"hosts/i386linux.h"'
>+       if test x${want64} = xtrue ; then
>+       CORE_HEADER='"hosts/x86-64linux.h"'
>+       fi
>         ;;
Please use "else" for CORE_HEADER=.


H.J, thanks for the review. A few questions below,


I don't see the point of using "else" here, am I missing something here?

>+    int pr_fpvalid;                    /* True if math copro being used.  */
>+#if __WORDSIZE == 32
>+    char pad[4];
>+#endif
>+  };
This is wrong. There should be no pad.  Please properly copy the
64-bit elf_prstatus.


Without this pad, the size of 'struct elf_prstatus64' on 32-bit(332) is not equal to the size of 'struct elf_prstatus' on 64-bit(336). IIUC, the goal of defining 'elf_prstatus64' is to emulate 64-bit 'elf_prstatus' on 32-bit machine. The field 'pad' is for tail padding, as the size of this struct should be multiple of 8.


>  struct elf_prpsinfo32
>    {
>      char pr_state;                     /* Numeric process state.  */
>@@ -179,6 +208,24 @@ struct elf_prpsinfo32
>      char pr_psargs[ELF_PRARGSZ];       /* Initial part of arg list.  */
>    };
>
>+struct elf_prpsinfo64
>+  {
>+    char pr_state;                     /* Numeric process state.  */
>+    char pr_sname;                     /* Char for pr_state.  */
>+    char pr_zomb;                      /* Zombie.  */
>+    char pr_nice;                      /* Nice val.  */
>+#if __WORDSIZE == 32
>+    char pad[4];
>+#endif
>+    uint64_t pr_flag;          /* Flags.  */
>+    unsigned int pr_uid;
>+    unsigned int pr_gid;
>+    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
>+    /* Lots missing */
>+    char pr_fname[16];                 /* Filename of executable.  */
>+    char pr_psargs[ELF_PRARGSZ];       /* Initial part of arg list.  */
>+  };
>+
This is wrong. There should be no pad.  Please properly copy the
64-bit elf_prpsinfo64.

Likewise, this field 'pad' is for internal padding, as field 'pr_flag' is 8-byte aligned.

--
Yao


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]