Abraham
Abraham

Reputation: 93

What is the format of .o Object Files?

I've been learning low-level stuff for a while now and I'm quite familiar with PE files and how they work. But I've been unable to find any documentation of their precursor .o files. I'm looking for a deep-dive on the actual byte-by-byte structure of them.

What does the format of .o files depend on? Is it even platform specific at all? Perhaps compiler-specific? Where can I find documentation on the file format of .o files? Mostly interested in Windows.

Upvotes: 1

Views: 1219

Answers (1)

Brecht Sanders
Brecht Sanders

Reputation: 7287

.o files as produced by GCC and LLVM when using Windows (MinGW) are COFF files (see https://wiki.osdev.org/COFF). On certain other platforms the ELF format is used.

The Windows PE format (used for .dll and .exe files) is actualy a subset of the COFF format.

Upvotes: 2

Related Questions