We're in the process of importing lld into FreeBSD (along with our
Clang 3.9 update project). For now I've removed all but the ELF
linker[1]. We have no need for COFF and Mach-O, and we have a bespoke
build system for all of our contrib code. I didn't bother adding build
support for the source files for non-ELF linkers.
Is this something that'd be reasonable / desirable to have extended
and implemented upstream, in the CMake build and perhaps a bit of an
#ifdef mess in tools/lld/lld.cpp::main()?
[1] [base] Revision 305070
What’s the motivation to not build COFF and Mach-O parts? If you don’t need it, you could just leave it. Are you trying to reduce the executable size?
It was just easier to remove coff::link() and mach_o::link() from
lld.cpp than to add them to our own build infrastructure
https://svnweb.freebsd.org/base/projects/clang390-import/usr.bin/clang/lld/Makefile?view=markup
We get a slightly faster build and a slightly smaller binary, but I
was motivated more by laziness than those factors. That is, it would
have taken more work to include features that would be unused.
My understanding is that FreeBSD is using some build process other than the standard CMake and thus you needed to write your own Makefile to build LLD, and you want to minimize this effort by just compiling the ELF part of the linker. Is this correct? If your motivation is to make non-standard build process easy, my feeling is that it is not strong enough to justify to separate them out.
My understanding is that FreeBSD is using some build process other than the
standard CMake and thus you needed to write your own Makefile to build LLD,
and you want to minimize this effort by just compiling the ELF part of the
linker. Is this correct?
Correct.
If your motivation is to make non-standard build
process easy, my feeling is that it is not strong enough to justify to
separate them out.
Ok. It's easy enough to carry our small patch in FreeBSD until we
either start building everything with our own build process, or we
migrate to the stock build process.