Linux – Different formats of object files in Linux

elffile formatlinux

I was wondering what are some formats of object files in Linux?

There are two types of object files that I know:

  1. executable, which has ELF format
  2. object files that are generated by gcc after compilation but before linkage.

    what is the format of such object files?

    Or are they also ELF format but with some different sub-formats than executables?

    Is the job of a linker to convert the format of this type of object files into the format of executables?

  3. Are there other types of object files?

Best Answer

Core dumps are also object files, of a sort, and usually in ELF format, too. Running this program will probably produce a file named "core":

int
main(int ac, char **av)
{
        char *p = 0;
        *p = 'a';
        return 0;
}

My file command says:

core: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4-style, from './dump'