Best reference for understanding ELF format

Carlos O'Donell carlos@systemhalted.org
Tue Apr 20 16:51:43 GMT 2021


On Tue, Apr 20, 2021 at 12:39 PM Jeffrey Walton via Libc-help
<libc-help@sourceware.org> wrote:
>
> On Tue, Apr 20, 2021 at 12:29 PM Peng Yu via Libc-help
> <libc-help@sourceware.org> wrote:
> > ...
> > People don't usually directly call ld to generate object, executable
> > or shared library files.
> >
> > Instead, gcc/clang are called. So there is nothing wrong to say those
> > files are produced by gcc/clang, at least at a superficially level.
> > You can say that gcc/clang don't directly produce the ELF files.
> > Nevertheless, this doesn't add too much to the topic of this thread.
>
> I think Clang can produce object files directly. Clang has an
> integrated assembler.

Conceptually the point is the same though.

The compiler relies on an assembler and static linker to generate the
object files.

Whether that assembler is a library and the invocation is a library
call, or it's a secondary process via a pipe, the concept being
discussed is the same.

The compiler itself (language front end, or driver) doesn't produce
ELF format object files. Technical clarity around these distinctions
helps at a later stage when we're trying to explain other concepts
where the distinction matters or where the distinction is muddled e.g.
LTO, ThinLTO etc.

Cheers,
Carlos.


More information about the Libc-help mailing list