Implemented by building an ELF file in memory.
The -b formats 'elf', 'default', and 'binary' match gold behavior.
This is needed for a bunch of kernel drivers in FreeBSD.
Differential D24060
[lld][ELF] Add support for -b binary Bigcheese on Aug 30 2016, 3:44 PM. Authored by
Details Implemented by building an ELF file in memory. The -b formats 'elf', 'default', and 'binary' match gold behavior. This is needed for a bunch of kernel drivers in FreeBSD.
Diff Detail Event Timeline
Comment Actions I still thing that writing an ELF to read it back is a bad design, but the refactoring needed to avoid it is non-trivial. We are almost there for symbols, but sections require more work. So please upload a last version with the linux build fixed, the symbol names changes and the nit in this comment. With that, it probably LGTM and will try to refactor it afterwards.
Comment Actions LGTM
Comment Actions One issue remains in using this for the FreeBSD kernel module build -- we don't specify the output format / emulation right now, because we build GNU ld with the output target compiled-in. This results in an error (see D24348 for my suggested improvement to the error message). I think it's much better if we don't have to build the linker multiple times though (once for each supported target). The right thing for us to do is make the build pass in -m. Comment Actions
That change is now in review for FreeBSD, https://reviews.freebsd.org/D7837
|
I still don't like this file name. SimpleELFWriter sounds like it is for -o binary instead of -b. Can you rename BinaryFile.cpp?