[rfc] bi-arch for x86-64 corefile.
H.J. Lu
hjl.tools@gmail.com
Tue Oct 30 07:21:00 GMT 2012
On Mon, Oct 29, 2012 at 9:29 PM, Yao Qi <yao@codesourcery.com> wrote:
> [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.
>
I am checking in this. But sourceware.org times out for me. Please
give it a try.
--
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: core.patch
Type: application/octet-stream
Size: 7910 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20121030/fe7a3db0/attachment.obj>
More information about the Binutils
mailing list