From owner-freebsd-hackers Thu Jan 2 21:25:31 2003 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6084D37B401 for ; Thu, 2 Jan 2003 21:25:29 -0800 (PST) Received: from clover.kientzle.com (user-112uh9a.biz.mindspring.com [66.47.69.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6EC2F43EC5 for ; Thu, 2 Jan 2003 21:25:28 -0800 (PST) (envelope-from kientzle@acm.org) Received: from acm.org (c43 [66.47.69.43]) by clover.kientzle.com (8.11.3/8.11.3) with ESMTP id h035PBE36660; Thu, 2 Jan 2003 21:25:11 -0800 (PST) (envelope-from kientzle@acm.org) Message-ID: <3E151EB7.2050003@acm.org> Date: Thu, 02 Jan 2003 21:25:11 -0800 From: Tim Kientzle Reply-To: kientzle@acm.org User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:0.9.6) Gecko/20011206 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "M. Warner Losh" Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: devd, crunchgen, C++, and /rescue References: <3E134AB2.8030401@acm.org> <20030102.195102.106545644.imp@bsdimp.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > Tim Kientzle 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 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 > >::do_get(std::istreambuf_iterator >, std::istreambuf_iterator >, 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 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 majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message