[Python-Dev] Linux Python linking with G++?

"Martin v. Löwis" martin at v.loewis.de
Sun Jul 10 19:53:31 CEST 2005


David Abrahams wrote:
>>I well remember that gcc 2.5.8 on Linux a.out required this sort of
>>setup. 
> 
> 
> Sorry, a.out?  Isn't that the default name a C compiler gives to the
> executable it builds on Unix?  Is it also (part of) the name of an OS?

Yes, and somewhat. It is also the name of a binary format, see
/usr/include/a.out.h (*). There are different types of object files:
OMAGIC (.o), NMAGIC,ZMAGIC,QMAGIC (executable), CMAGIC (core file). The
Linux inplementation is now called binfmt_aout, but it used to be the
only binary format that Linux supported up to Linux 1.2 (which
introduced ELF in 1.1.52). Originally, a.out did not support shared
libraries, but was extended to do so by allocating fixed virtual
addresses to well-known shared libraries, so that no relocation was
necessary (the a.out dynamic loader did not support either dynamic
relocation nor PIC code on Linux; the SunOS dynamic linker did support
relocation AFAIR).

Even after Linux implemented ELF, it took some time for distributions
to switch to ELF. Because of the startup overhead, there was some
reluctance that ELF is "slower"; it also created larger executables.
Only when developers realized how powerful dynamic linking and
shared libraries are, they gave up their concerns.

> Understood, and I retract my former incredulity.  I believe HP-UX
> requires it, and I believe that some systems where you have to link in
> extension modules explicitly require it.  But the "--with-cxx if
> configure says you can get away with it" behavior is hurting on a
> major platform: ELF Linux.

Indeed.

Regards,
Martin

(*) Actually, the format is called this way *because* it is the format
of the compiler output file.


More information about the Python-Dev mailing list