different x86_64 ABIs

Andrew Haley aph@redhat.com
Mon Oct 16 17:03:00 GMT 2006


Sebastian Biallas writes:
 > Andrew Haley wrote:
 > > Sebastian Biallas writes:
 > >  > Hello everyone,
 > >  > 
 > >  > I'm working on a x86_64 project which has mixed C and assembly code. The
 > >  > program should (ultimatively) run on all major x86_64 platforms but
 > >  > currently I'm facing the problem that x86_64 has a completely different
 > >  > ABI on e.g. Linux and Windows. This makes interfacing between C and
 > >  > assembler impossible in a portable manner.
 > >  > 
 > >  > So I either need to provide the assembly files in different flavours or
 > >  > (which is why I ask here) gcc provides some __attribute__((elf_abi)) or
 > >  > __attribute__((linux_abi)) or something like that.
 > >  > 
 > >  > Is the already such an attribute or is it planned? Or this there another
 > >  >  solution for the problem?
 > > 
 > > Make life easy for yourself: Write different assembly code.  
 > 
 > Well, actually it would be much easier for me if gcc could handle
 > this :)

Mostly it can.  That's what inline asm is for.

 > Keeping 2500 lines of assembly code in sync is not really easy.

I would have thought it'd be easier to fix that by not using so much
assembler code, but I don't know your application area.

 > > The ABI is different, and to work fully with gcc, assembly code
 > > really needs DWARF2 unwinder data, and that makes no sense at all
 > > to Windows.
 > 
 > Huh? I thought unwind data is only needed for C++-Exceptions, isn't it?

We use it everywhere, even for C code.  You can probably get away
without it.

Andrew.



More information about the Gcc-help mailing list