This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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: question about ABI


amulya rattan <talk2amulya@gmail.com> writes:

> As easy as it just might be, the concept of ABI has always baffled me.
> According to wikipedia, ABI is a low-level interface between an
> application and an operating system or another application..Hmm, thats
> easy enough. Next it says it deals with data type, size, alignment,
> calling conventions etc. Easy enough too. Then I search more about it
> and i find there is a C++ ABI, there is a processor ABI(IA64 ABI),
> there is an OS ABI. How could there be so many entities defining ABI?
> Shouldnt there be one, maybe just an OS ABI which is written in
> conjuction with processor guys.
> I guess what i am interested in understanding is, where does it start?
> My guess is first processor has an ABI, then OS defines its ABI on top
> of processor's ABI and so on. Where should i start learning about it
> from? If this question doesnt qualify for here, can someone just tell
> me how and which ABI is GCC defined for? Any info in this is much
> appreciated!

There are different ABIs because programs work at different levels.

Typically there is a processor ABI.  This describes function calls and
data types for the processor.  Most processors have just one processor
ABI but some unfortunately have more than one.  E.g, x86_64 has one
for Microsoft and one for everybody else.

Then there is an operating system ABI.  This is naturally different
for each operating system.  That is, Windows works one way, GNU/Linux
works a different way, FreeBSD works yet another way.

Then there is a C++ ABI.  The base processor ABI just tells you how C
works.  The C++ ABI tells you how C++ code works in terms of the
processor ABI.  gcc uses a single C++ ABI for all systems.  Several
other compilers use that ABI as well, but, e.g., the Microsoft
compiler uses a different one.

gcc supports quite a few different ABIs.

Ian


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