Categories
Linux Mastering Development

What is necessary and sufficient condition for an ELF object file to be a shared library or a relocatable object file?

Stephen Kitt wrote in https://unix.stackexchange.com/a/448943

any ELF object with an entry point can be an executable, regardless of its other properties.

and ld.so is both an executable (because of having an entry point) and a shared library.

What is the necessary and sufficient condition for an ELF object file to be a shared library?

What is the necessary and sufficient condition for an ELF object file to be a relocatable object file?

The following quote says that a shared library is a relocatable object file.

Is an executable file also a relocatable object file?

Is an executable a shared library?

CSAPP says

7.3 Object Files

Object files come in three forms:

Relocatable object file. Contains binary code and data in a form that
can be combined with other relocatable object files at compile time to
create an executable object file.

Executable object file. Contains binary code and data in a form that
can be copied directly into memory and executed.

Shared object file. A special type of relocatable object file that can
be loaded into memory and linked dynamically, at either load time or
run time.

Leave a Reply

Your email address will not be published. Required fields are marked *