From owner-freebsd-hackers Sun Feb 2 07:40:56 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id HAA22880 for hackers-outgoing; Sun, 2 Feb 1997 07:40:56 -0800 (PST) Received: from chai.plexuscom.com (chai.plexuscom.com [207.87.46.100]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id HAA22874 for ; Sun, 2 Feb 1997 07:40:52 -0800 (PST) Received: from chai.plexuscom.com (localhost [127.0.0.1]) by chai.plexuscom.com (8.8.4/8.6.12) with ESMTP id KAA21607; Sun, 2 Feb 1997 10:39:52 -0500 (EST) Message-Id: <199702021539.KAA21607@chai.plexuscom.com> To: "Eric J. Chet" Cc: Terry Lambert , hackers@FreeBSD.ORG Subject: Re: g++, STL and -frepo on FreeBSD-2.2-Beta In-reply-to: Your message of "Fri, 31 Jan 1997 23:42:36 EST." Date: Sun, 02 Feb 1997 10:39:52 -0500 From: Bakul Shah Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Terry Lambert writes: > > g++ -frepo -c x.cc <========== this succeeds > > g++ -frepo -o x x.o <========== this fails ... > Clearly, the template class definition > > template > class list ... { > ... > }; > > is not in scope. The header files you have included are apparently > not sufficient. If this were the case the compile phase would fail but it does not. The file includes a file where the list template is defined. > The -frepo patches don't work on our version of the g++ and > ld. I assume ld is the problem. I haven't had the time to take a look > to see what needs to be changed. The -frepo patch from Cygnus when > applied, should create a set of *.ii one for each source file complied > from g++. The *.ii files specify all templates that need to be > instantiated before linking can take place. I believe there is a collect2 > module that performs the instantiations task. I started with the *stock* gcc-2.7.2 distribution (+ 2.7.2-2.7.2.1 diff), not the one in the FreeBSD source tree. The -frepo patch generates a .rpo file. In the test case I posted this .rpo file contains lines like A -frepo -c ... O distance_type__FRCQ2t4list1Zi8iterator O splice__t4list1ZiGQ2t4list1Zi8iteratorRt4list1ZiT1T1 O splice__t4list1ZiGQ2t4list1Zi8iteratorRt4list1ZiT1 O splice__t4list1ZiGQ2t4list1Zi8iteratorRt4list1Zi ... The ld in /usr/local/lib/gcc-lib/i386-unknown-freebsd2.2/2.7.2.1/ is apparently the collect2 module, which, I presume, looks at the .rpo files to find out what classes need to be instantiated. At I indicated earlier, g++ -v shows this is the ld called. Perhaps this ld fails? That is where I will look next. > I do know that if you build g++ with John Polstra's ELF patches > and the -frepo patches. Then template repository works as advertised. Where do I find John's ELF patches? > On the other hand, the only thing you lose by not having the > repository with our native compiler is executable size. The compiler > will instantiated every template used in a object file and include it in > that object file. Meaning, you can have duplicate template instantiations > across different object files. This appears not to be the case. Are there any flags which make this possible? Does libg++-2.7.1 have to be compiled with any special flags or defines? Thanks for your responses. -- bakul