gcc - C++ Find and remove references to little-used library -
i'm modifying large collection of legacy c++ code has few dependencies on old commoncpp library. want replace commoncpp more modern (e.g. boost).
first need find places commoncpp-provided functions , methods used. obvious brute force methods take time (especially "lazy" programmers me believe computers should tedious work :-).
i'm looking ideas on how speed process.
if ld
had flag said "continue looking external references , spit out missing references" might needed.
our code spread on many directories, hierarchal, recursive makefiles, if makes difference proposed solution.
environment freebsd gnu compiler chain.
i tagged c well, since solutions solve kind of problem c should solve c++ also.
(guess can't format comments)
using --cxref
in build, , pipeline:
% egrep 'ccgnu2|ccext2' output.txt | sort | uniq
gets me this:
on-virtual thunk ost::ttystream::~ttystream() ../../lib/libccext2.so non-virtual thunk ost::unixstream::~unixstream() ../../lib/libccext2.so ost::crc16digest::getsize() ../../lib/libccext2.so ost::crc16digest::initdigest() ../../lib/libccext2.so ost::crc16digest::~crc16digest() ../../lib/libccext2.so ost::crc32digest::getsize() ../../lib/libccext2.so
i wonder if can useful above need.
from the ld
man page :
--warn-unresolved-symbols
if linker going report unresolved symbol (see option --unresolved-symbols) generate error. option makes generate warning instead.
all need compile without linking actual library.
on machine:
~/workspace/jos$ make 2>&1 | grep reference lib/spawn.c:129: warning: undefined reference `copy_shared_pages' user/primes.c:25: warning: undefined reference `fork' . . .
Comments
Post a Comment