Date: Sun, 02 Feb 1997 10:39:52 -0500 From: Bakul Shah <bakul@torrentnet.com> To: "Eric J. Chet" <ejc@gargoyle.bazzle.com> Cc: Terry Lambert <terry@lambert.org>, hackers@FreeBSD.ORG Subject: Re: g++, STL and -frepo on FreeBSD-2.2-Beta Message-ID: <199702021539.KAA21607@chai.plexuscom.com> In-Reply-To: Your message of "Fri, 31 Jan 1997 23:42:36 EST." <Pine.BSF.3.95.970131231640.15472A-100000@gargoyle.bazzle.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 Type> > 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 <stl.h> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702021539.KAA21607>