Search code examples
assemblycompilationterminologyobject-fileslinkingobjects

Is there a name for converting machine code to object files?


I appreciate this might be a really dumb question. Is there a name for the process in which machine code gets laid out in an ELF file or Mach-O file?

I’d like to know more about that process, but I’m unsure what to search for.

‘Linking’ seems to be the wrong word because building object files happens before that.


Solution

  • Are you talking about starting with a flat binary file and using objcopy to create a .o with that code as the .text section? I'm not aware of a standard term for that, so pick something descriptive like "wrapping it in object-file metadata".

    If you mean starting with asm source, then that's just part of assembling. So if you want to be specific, you'd say "assembling into an object file", instead of "assemble into a flat binary".

    In fact, assembling into a flat binary basically involves linking if the machine code references any absolute addresses (like mov edi, symbol in NASM syntax, for nasm -fbin). Instead of just creating relocation entries for symbols, the assembler has to choose an absolute address as a reference point to figure out the absolute address of every label in the file. That's normally the linker's job.