Re: different x86_64 ABIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sebastian Biallas writes:
 > -----BEGIN PGP SIGNED MESSAGE-----
 > Hash: SHA1
 > 
 > Andrew Haley wrote:
 > > 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.
 > 
 > Well, I haven't told the whole story. Actually it's some sort of JIT
 > which generated tons of machine code, which also wants to interface with
 > C code.

Fair enough.  

 > >  > 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, 
 > 
 > I know. But in this case it's really necessary to have this support code
 > in assembler (because I have to rely on certain things).
 > 
 > > 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.
 > 
 > Some pointer for further reading?

It's in the ABI spec at
http://www.x86-64.org/documentation/abi-0.92.pdf.  We always generate
unwinder data in gcc because, among other things, we want to be able
to unwind().  If you're not called by anything else, you probably
don't need to worry.

Andrew.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux