[lldb-dev] Proposal: Using LLD in tests

Pavel Labath via lldb-dev lldb-dev at lists.llvm.org
Thu Apr 19 06:42:17 PDT 2018

Hello all,

currently we have a couple of tests, in-tree or under review, which are
very close to being host-independent. The only part they are missing is the
ability to link a intermediate object file:
- the ppc64 test in https://reviews.llvm.org/D44437 needs a linker to
resolve relocations in the debug info (*)
- the PDB tests under lit/SymbolFile/PDB need a linker to produce the
program database.

I think it would be great if everyone were able to run these tests and
verify they don't regress them before they actually push a patch.

Apart from that, I have started looking at writing some non-execution debug
info (**) tests as a part of adding DWARF v5 accelerator table support to
lldb (both to test the new implementation, and to make sure I don't regress
existing ones). Ideally I'd like to make sure that everyone is able to run
them, regardless of their primary (or only) development platform. For this,
I also need a linker capable of running everywhere (*)

To achieve these goals, I'd like to propose that we add LLD as a (optional,
but strongly recommended) dependency for running tests and start using it
in the tests I mention. Doing this would optional in the sense that the
tests would be marked "REQUIRED: lld", and simply skipped if lld is not
available (so the tests would still be green). I say "strongly recommended"
because not having lld checked out should not be an excuse for breaking the
test, and the patch author should pro-actively revert a patch which breaks
such tests and investigate.

I hope this proposal is not too controversial. LLD is already required on
windows to run dotest tests. Also, all monorepo users likely have it
already, or it is very easy for them to enable it. For non-monorepo users
it should be a matter of checking out one extra repository. Please Let me
know what you think.


(*) our ELF parser has very limited support for applying debug info
relocations -- it only works for x86, and only a couple of relocations are
currently implemented. It would be possible to remove the linker dependency
by implementing these (essentially, doing the link ourselves -- this is
what llvm does), but given the large number of architectures and relocation
types, combined with the long term goal of reusing the llvm's ELF parser,
this does not seem like a worthwhile goal. Also, it does not help the
windows situation, as in the PDB model it's the linker who produces the

(**) I'll write a separate email about this, but what I'm essentially
thinking of is producing a stand-alone module (either from .yaml, .s, .ll,
or .c), hitting it with various FindXXX methods, and dumping the results.

More information about the lldb-dev mailing list