From: "H.J. Lu" <hjl.tools@gmail.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org
Subject: Re: PATCH: Check bfd_mach_x64_32 to set tdesc for x32 binary
Date: Mon, 14 May 2012 19:02:00 -0000 [thread overview]
Message-ID: <CAMe9rOq=Vn4St4Y7vjN0gThEPZTJO8eF5T6petbeXSE6f_WOpg@mail.gmail.com> (raw)
In-Reply-To: <201205141842.q4EIgXAV016110@glazunov.sibelius.xs4all.nl>
On Mon, May 14, 2012 at 11:42 AM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> Date: Fri, 11 May 2012 16:13:04 -0700
>> From: "H.J. Lu" <hjl.tools@gmail.com>
>>
>> On Fri, May 11, 2012 at 1:20 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> >> Hi,
>> >>
>> >> This patch checks bfd_mach_x64_32 to set tdesc for x32 binary. Tested
>> >> on Linux/x86-64. OK to install?
>> >>
>> >> Thanks.
>> >>
>> >>
>> >> H.J.
>> >> ---
>> >> * amd64-linux-tdep.c: Include features/i386/x32-linux.c
>> >> and features/i386/x32-avx-linux.c.
>> >> (amd64_linux_init_abi): Check bfd_mach_x64_32 for x32 process.
>> >> (_initialize_amd64_linux_tdep): Register bfd_mach_x64_32. Call
>> >> initialize_tdesc_x32_linux and initialize_tdesc_x32_avx_linux.
>> >>
>> >> * amd64-linux-tdep.h (tdesc_x32_linux): New.
>> >> (tdesc_x32_avx_linux): Likewise.
>> >>
>> >> diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
>> >> index acc7303..601ce20 100644
>> >> --- a/gdb/amd64-linux-tdep.c
>> >> +++ b/gdb/amd64-linux-tdep.c
>> >> @@ -1545,8 +1578,12 @@ _initialize_amd64_linux_tdep (void)
>> >> {
>> >> gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
>> >> GDB_OSABI_LINUX, amd64_linux_init_abi);
>> >> + gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x64_32,
>> >> + GDB_OSABI_LINUX, amd64_linux_init_abi);
>> >
>> > Instead of doing this, you should introduce an
>> > amd64_x32_linux_init_abi() function, make that call amd64_linix_init_abi() and ovverride the bits that are different for X32.
>>
>> I don't think I should override tdep->tdesc. Here is a different approach.
>> I updated amd64_linux_init_abi to take amd64_linux_tdesc and fetch_func.
>> I also added amd64_lp64_linux_init_abi and amd64_ilp32_linux_init_abi
>> to pass the right ones to amd64_linux_init_abi. Tested on Linux/x86-64.
>> OK to install?
>
> No. Sorry, but you missed my point. I want you to introduce a
> seperate function such that it will be easy to override stuff
> specifically for x32 without adding lots of if statements that turn
> the code into spaghetti.
>
The current amd64_linux_init_abi has
if (! tdesc_has_registers (tdesc))
tdesc = tdesc_amd64_linux;
tdep->tdesc = tdesc;
If tdesc_has_registers is false, and tdesc field is set to
tdesc_amd64_linux, how can x32 override it safely since it
can be set to something else if tdesc_has_registers is
true?
Thanks.
--
H.J.
next prev parent reply other threads:[~2012-05-14 19:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-11 19:30 H.J. Lu
2012-05-11 20:20 ` Mark Kettenis
2012-05-11 23:13 ` H.J. Lu
2012-05-14 18:10 ` H.J. Lu
2012-05-14 18:42 ` Mark Kettenis
2012-05-14 19:02 ` H.J. Lu [this message]
2012-05-11 20:31 ` Mark Kettenis
2012-05-11 20:56 ` H.J. Lu
2012-05-12 1:38 ` Yao Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAMe9rOq=Vn4St4Y7vjN0gThEPZTJO8eF5T6petbeXSE6f_WOpg@mail.gmail.com' \
--to=hjl.tools@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox