The end goal for this(and another post to this list) is to general a file that contains all functions and the function calls they make, along with the addresses(of each) in the binary. Having names would be great for debugging. I figured at the very least I can get the function calls as a plugin.<br>
<br>Originally I was trying to modify the dot-callgraph pass, but modying the GraphWriter to be more generic than a dot file was a bit tricky. As a plugin seems more convent also.<br><br><div class="gmail_quote">On Thu, Jun 9, 2011 at 2:07 PM, David Chisnall <span dir="ltr"><<a href="mailto:csdavec@swan.ac.uk">csdavec@swan.ac.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Clang doesn't have this information. I think you can use the Object stuff in LLVM to get it after the binary has been generated, but it's not trivial, because this doesn't happen until after the linker has run, and in nontrivial cases the linker is not run by the same program invocation as the compiler.<br>
<br>
What problem are you actually trying to solve?<br>
<font color="#888888"><br>
David<br>
</font><div><div></div><div class="h5"><br>
On 9 Jun 2011, at 19:04, ret val wrote:<br>
<br>
> Is there a direct way to get the location in the binary, as a plugin? I think that would be a nicer form for me, if possible.<br>
><br>
> Thanks<br>
><br>
> On Tue, Jun 7, 2011 at 1:41 PM, David Chisnall <<a href="mailto:csdavec@swan.ac.uk">csdavec@swan.ac.uk</a>> wrote:<br>
> On 7 Jun 2011, at 18:11, ret val wrote:<br>
><br>
> > Is there anyway to write a pass/plugin so I can print the locations of all functions? Can anything run after the linker? I'm not sure what I should be reading up on to tackle this.<br>
><br>
> If you mean their location in the resulting binary, then you don't need a plugin to do this: the nm utility will do it for you. It will print the location of all symbols, but you can use the example clang plugin to print the names of all functions and then use this to filter the output of nm.<br>
><br>
> If you mean that location in the address space of a running program, then this is not possible with a clang plugin, because this location is not defined until after the program / library has been loaded, and on modern systems will be randomised on each program run as a security precaution.<br>
><br>
> David<br>
><br>
<br>
</div></div></blockquote></div><br>