[cfe-dev] absolute locations of functions?

David Chisnall csdavec at swan.ac.uk
Tue Jun 7 11:29:13 PDT 2011


No, the default output from nm shows the location, type, and name of every symbol in a binary.  No additional flags are required.

David

On 7 Jun 2011, at 19:19, ret val wrote:

> Is there a separate flag to use so locations are printed in nm? The only relevant flag I have seen in the man page is -cppgen=functions and that does not show addresses.
> 
> Thanks again
> 
> On Tue, Jun 7, 2011 at 1:41 PM, David Chisnall <csdavec at swan.ac.uk> wrote:
> On 7 Jun 2011, at 18:11, ret val wrote:
> 
> > 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.
> 
> 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.
> 
> 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.
> 
> David
> 





More information about the cfe-dev mailing list