One nasty dependency of my C compiler used to be NASM. It handled both assembling and outputting an ELF file for me.
However, I decided it is one too many dependencies, so to eliminate NASM I wrote my own dynamic x86 64-bit instruction encoder and linkable ELF file writer.
The outputted instructions and ELF, as shown in screenshot, execute and disassemble well, and the ELF is fully linkable with LD (gcc linker used here for glibc linking).
The ELF writer also outputs relocations from "labels" generated by the backend, and constructs a .symtab section. This is how printf is linked in, in the example shown.
There are a few more features added since my last update here, like designated initializers. But full list of features is in the repo as always.