Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between an assembly file, object file, and binary file?

I am using the Clang compiler and always get confused between an assembly file (.s) , object file (.o) , and binary file (.bc). Can anyone explain their difference?

like image 699
wad Avatar asked Oct 26 '25 18:10

wad


1 Answers

An assembly file (.s) contains machine instructions in human readable form, known as assembly language. An object file contains the same instructions in machine-readable, binary form. Assembly files can be translated to object files by the assembler (as).

An LLVM bitcode file (.bc) contains LLVM instructions in binary form. It can be translated to machine code by the LLVM compiler (llc) or executed directly using the LLVM interpreter (lli).

Not listed in your question are LLVM assembly files (.ll). These contain the same instructions as bitcode files, but in human readable form. They can be turned into bitcode files using the LLVM assembler (llvm-as).

like image 65
sepp2k Avatar answered Oct 29 '25 02:10

sepp2k