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

Yao Qi yao@codesourcery.com
Tue Oct 30 04:29:00 GMT 2012


[add binutils@sourceware.org back to CC]

On 10/30/2012 10:51 AM, H.J. Lu wrote:
>  >>> >+    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.
>
> It won't work for x32.
>

H.J, I am confused here.  I assume you mean x32 as target.  Now, both 
'prstatus64_t' and 'prpsinfo64_t' are only used in 
elf64-x86-64.c:elf_x86_64_write_core_note ([1] and [2] as annotated below),

elf_x86_64_write_core_note (....)
{
   switch (note_type)
     case NT_PRPSINFO:
       if (bed->s->elfclass == ELFCLASS32)
	{
	  prpsinfo32_t data;  <--- [3]
	}
       else
	{
	  prpsinfo64_t data;  <---- [1]
	}
     case NT_PRSTATUS:
       if (bed->s->elfclass == ELFCLASS32)
	{
	  if (bed->elf_machine_code == EM_X86_64)
	    {
	      prstatusx32_t prstat;  <--- [4]
	    }
	  else
	    {
	      prstatus32_t prstat;
	    }
	}
       else
	{
	  prstatus64_t prstat;   <--- [2]
	}
     }
}

x32 will go the path [3] and [4], unreachable to [1] and [2].  so this 
patch shouldn't affect x32 as target.

-- 
Yao



More information about the Binutils mailing list