In the three part series of the "Programming a x64 compiler from scratch", the first part confused me a bit. Per wrote bytes to a .bin file, and when he disassembled it, it was working. Seemingly, he wrote machine code without an assembler or a compiler. When I tried the same thing, the objdump program threw an error, stating that the .bin file is corrupt or invalid. How could I resolve this?
Did you try writing exact same bytes as he did, or this is your custom thing you wrote?
To diagnose why something is not working here you should open file in hexeditor and go byte by byte over it, starting from top. Look up structure descriptions that specifies how executable format is defined, and verify that your bytes are exactly what should be.
Make sure you tell objdump that the file is binary format using the switch --target=binary.
From the error message, it seems that objdump doesn't know that the file is raw machine code without headers.