I like objcopy for this. Here is an example command:
objcopy --input binary --output elf64-x86-64 myfile.txt myfile.o objcopy --input binary --output elf64-x86-64 myfile.txt myfile.oNo comments yet.