This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: PATCH: Check bfd_mach_x64_32 to set tdesc for x32 binary


> 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.


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