Tim Kientzle <[EMAIL PROTECTED]> writes:

: Does anyone know how to get crunchgen to play nicely with C++ programs?

M. Warner Losh asks:

What's the problem.

Using crunchgen directly gives the expected linkage problems:

# cat test.conf
srcdirs /usr/src/sbin
progs devd
libs -ll
# crunchgen -q test.conf
Run "make -f test.mk" to build crunched binary.
# make -f test.mk
(cd /usr/src/sbin/devd && make depend && make devd.o token.o parse.o)
`devd.o' is up to date.
`token.o' is up to date.
`parse.o' is up to date.
cc -O -pipe -mcpu=pentiumpro -c test.c
echo "int _crunched_devd_stub(int argc, char **argv, char **envp){return main(argc,argv,envp);}" >devd_stub.c
cc -O -pipe -mcpu=pentiumpro -c devd_stub.c
ld -dc -r -o devd.lo devd_stub.o /usr/src/sbin/devd/devd.o /usr/src/sbin/devd/token.o /usr/src/sbin/devd/parse.o
crunchide -k _crunched_devd_stub devd.lo
cc -static -o test test.o devd.lo -ll
devd.lo: In function `event_proc::~event_proc()':
devd.lo(.text+0x223): undefined reference to `operator delete(void*)'
devd.lo: In function `action::action(char const*)':
devd.lo(.text+0x347): undefined reference to `std::string::string(char const*, std::allocator<char> const&)'
devd.lo: In function `action::action(char const*)':
.... 230 additional lines of errors deleted ...

Attempting to re-link with c++ instead of cc
gives just one error (this would be the obvious
change to 'crunchgen' if it worked):

# c++ -static -o test test.o devd.lo -ll
/usr/lib/libstdc++.a(locale-inst.o): In function `std::money_get<char, std::istreambuf_iterator<char, std::char_traits<char> > >::do_get(std::istreambuf_iterator<char, std::char_traits<char> >, std::istreambuf_iterator<char, std::char_traits<char> >, bool, std::ios_base&, std::_Ios_Iostate&, std::string&) const':
locale-inst.o(.gnu.linkonce.t._ZNKSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_bRSt8ios_baseRSt12_Ios_IostateRSs+0xa44): undefined reference to `unsigned const& std::min<unsigned>(unsigned const&, unsigned const&)'

For the record,
cd /usr/src/sbin/devd && make clean && make
works just fine on this machine, so I'm reasonably
confident that the compiler, libs, etc, are all
correctly installed.

This one has me stumped. Any ideas?

Tim


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to