This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ demangler horrors


On Sat, Jun 28, 2003 at 07:59:00AM -0700, H. J. Lu wrote:
> On Sat, Jun 28, 2003 at 11:37:17AM +0200, Gabriel Dos Reis wrote:
> > "H. J. Lu" <hjl@lucon.org> writes:
> > 
> > | Ironically, this mini <vector> is not needed by binutils nor gdb. It is
> > | used to build the target libiberty for gcc since libiberty is built before
> > | libstdc++ which contains a <vector>. My approach may not be as elegant as
> > | some people want, but it works and doesn't require another <vector>. I am
> > | not sure which one is worse.
> > 
> > If it is not necessary then there is no need to add it.
> > 
> 
> My patch doesn't requrie it. But some people don't like the way I solved
> the problem with
> 
> ar -d ....
> ar rc ....
> 
> in the new demangler Makefile to replace the old demangler in libiberty.a.
> I can change my patch to do the following:
> 
> 1. Add a new target in libiberty Makefile, demangler, which does:
> 
> 	a. Symlink the new demangler
> 	b. Build it.
> 	c. Replace the old one with
> 
> 		ar -d libiberty.a cp-demangle.o
> 		ar rc libiberty.a demangle.o
> 
> 2. Change the new demangler configure file to do
> 
> 	a. If there is no libiberty directory, build the standalone demangler.
> 	b. Otherwise, create a Makefile file simple does
> 
> 		all:
> 			$(MAKE) -C ../libiberty demangler
> 
> 		.DEFAILT:
> 			@true
> 
> 3. Change the top level dependency such that targets which used to depend on
> libiberty, now depend on demangler, demangler depends on libiberty and
> libstdc++ if it is needed. Please keep in mind that only demangler for target
> needs libstdc++ for target. I don't believe it has much impact on parallel
> build.
> 
> The difference between my original patch and this one is the real work is
> moved from demangler to libiberty.
> 

One main reason for a separate demangler directory is to work around
the dependencies among libiberty and libstdc++. If we want tighter
integration between libiberty and demangler, we can add

DEMANGLER=

replace cp-demangle.o with $(DEMANGLER) in libiberty's Makefile. We
also add 2 targets:

new_demangler:
	$(MAKE) DEMANGLER=demangle.o

old_demangler:
	$(MAKE) DEMANGLER=cp-demangle.o

The new demangler configure will figure out which one should be used
and create appropriate Makefile with

all:
	$(MAKE) -C ../libiberty [new_demangler|old_demangler]


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]