In article <11**********************@o13g2000cwo.googlegroups .com>,
Jaspreet <js***********@gmail.com> wrote:
Danny Lu wrote: Can anyone tell me if all the .obj or .o files are compatible?
No way, they are platform dependant plus have a whole lot of other
dependencies. If they were compatiable you would be looking at a
picture similar to compiling on one platform and executing it on
another which is not true.
What you write is more or less right, but I think it gives a bit
of the wrong impression.
Different operating systems do generally use different object file
formats, sometimes supporting multiple object file formats on one
OS. But the object file format is a different question, really,
then what instruction set a particular platform supports.
Some object file formats support multiple executable portions (for
different instruction sets, or for 32 bit vs 64) within the same object
file; an example of this is Apple's announcement that object files
would share PowerPC and Intel executables.
Unix-like systems tend to adopt one of a small number of object file
formats, so that they do not need to "reinvent the wheel". Some of the
format names are "COFF" (older, use is declining); "ELF" (not as old,
but not fresh); "dwarf" (newer). gcc supports ELF and dwarf formats; I
do not know at the moment if COFF format is being maintained in gcc.
A consequence of this is that object files have a tendency to be
cross-platform compatible (in the sense that the same tool would be
able to extract debugging and link data) -- even when the
instruction set of the binaries is incompatible. The situation
is sort of like the way that most countries agree on standardized
letter and parcel sizes, so a letter can go from one country to
another, even though the -contents- of the letter might be
unintelligable to most people in the destination country.
--
Any sufficiently old bug becomes a feature.