[llvm-dev] Backend Plugins?

Kenneth Adam Miller via llvm-dev llvm-dev at lists.llvm.org
Thu May 17 16:52:27 PDT 2018


On Thu, May 17, 2018 at 6:01 PM, <paul.robinson at sony.com> wrote:

> Kenneth Adam Miller wrote:
> > By address, I mean the selected location in the binary. I need the
> > ground truth for other static analyses.
>
> That's not determined until instructions are encoded for the object
> file, which is pretty deep down in MC.  I can imagine a couple of ways
> to get the info you want, but it's not pretty.  You could emit a label
> for every instruction, and then work out the label offsets later on;
> you might also be able to collect section offsets as the encoded
> instructions are emitted to the object file.
>
> But really, it seems easier to do a disassembly on the object file,
> instead of trying to collect the information during compilation.
> --paulr
>
>
Disassembly is undecidable, that's why the ground truth from the compiler
is so desireable. Even with debug symbols, there can be code fragments that
exist beyond the visible terminator of a function boundary, or functions
that are not aligned so that linear sweep can have false negatives. It's
hard to validate binary corpora against anything else, because even with
symbol information, all you can get is the function entrance. The dwarf
debug info is even harder to retrieve as a list of addresses, because
that's such an arbitrary and skeletal API that is used by different
languages very very differently.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180517/e1189033/attachment.html>


More information about the llvm-dev mailing list