RFC: Add 32bit x86-64 support to binutils

David Daney ddaney@caviumnetworks.com
Thu Dec 30 19:40:00 GMT 2010


On 12/30/2010 10:59 AM, H.J. Lu wrote:
> On Thu, Dec 30, 2010 at 10:42 AM, Joseph S. Myers
> <joseph@codesourcery.com>  wrote:
>> On Thu, 30 Dec 2010, H.J. Lu wrote:
>>
>>> Hi,
>>>
>>> This patch adds 32bit x86-64 support to binutils. Support in compiler,
>>> library and OS is required to use it.  It can be used to implement the
>>> new 32bit OS for x86-64.  Any comments?
>>
>> Do you have a public psABI document?  I think the psABI at the ELF level
>> needs to come before the binutils bits, at the function call level needs
>> to come before the GCC bits, etc.
>
> The psABI is the same as x86-64 psABI, except for 32bit ELF instead of
> 64bit.
>
>> You appear (judging by the support for Linux targets in the binutils
>> patch) to envisage Linux support for this ABI.  How do you plan to avoid
>
> I enabled it for Linux so that I can run ILP32 binutils tests on Linux/x86-64.
>
>> the problems that have plagued the MIPS n32 syscall ABI, which seems like
>> a similar case?
>
> Can you describe MIPS n32 problems?
>

I can.  As Joseph indicated, any syscall that passes data in memory 
(ioctl, {set,get}sockopt, etc) potentially must have a translation done 
between kernel and user ABIs.

Currently this is done in kernel/compat.c fs/compat_binfmt_elf.c and 
fs/compat_ioctl.c as well as a bunch of architecture specific ad hoc 
code.  Look at the change history for those files to see that there is 
an unending flow of bugs being fixed due to this ABI mismatch.

Even today there are many obscure ioctls that don't work on MIPS n32. 
Most of the code works most of the time, but then someone tries 
something new, and BAM! ABI mismatch hits anew.

My suggestion:  Since people already spend a great deal of effort 
maintaining the existing i386 compatible Linux syscall infrastructure, 
make your new 32-bit x86-64 Linux syscall ABI identical to the existing 
i386 syscall ABI.  This means that the psABI must use the same size and 
alignment rules for in-memory structures as the i386 does.

David Daney



More information about the Binutils mailing list