Re: Audit Use of Global Variables in C++ Shared Object (GCC Warning?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeffrey Walton <noloader@xxxxxxxxx> writes:

> I'm interested in finding references to global variables in a compilation unit.
>
> I've found "nm [-D] ..." is helpful for archives and shared objects,
> but its only useful if combined with grep and variable naming
> conventions. For example, if naming conventions are punned, then "nm
> -D mycoollib | grep g_" is useless.

nm -D dumps dynamic symbols.  I would recommend instead something like
  objdump -t -j .data | grep ' g   '
That should give you all the global symbols defined in the .data
section.  You may want to add a few more sections.

> Does gcc have such a warning?

I don't think so.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux