www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/08/29/14:16:48

X-Authentication-Warning: acp3bf.physik.rwth-aachen.de: broeker owned process doing -bs
Date: Sun, 29 Aug 1999 20:09:48 +0200 (MET DST)
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
X-Sender: broeker AT acp3bf
To: djgpp-workers AT delorie DOT com
Subject: Re: gcc-2.95.1
In-Reply-To: <Pine.SUN.3.91.990829133833.9438G-100000@is>
Message-ID: <Pine.LNX.3.93.990829195916.1731C-100000@acp3bf>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 29 Aug 1999, Eli Zaretskii wrote:

> But this would disable collect2 unconditionally, right?

AFAIK: Yes.

> What is collect2 *really* needed for?

Essentially, it's for handling of 'template instantiation'. That's a C++
feature where the compiler cannot know, by it's own, which special cases
of a code template have to be compiled into a particular .o file, because
it doesn't know what gets compiled into other .o files of the project. 

There are three principal solutions to this: 

1) If in doubt, don't compile them in. This will generate error messages
from the linker because of undefined references. That's where 'collect2'
jumps in. It collects these error message (thus the name), and calls the
compiler again to generate the missing code. 

2) If in doubt, compile it in. This can generate linker errors because of
multiple definitions of these templated symbols. To get around that,
'weak' symbols are needed to be supported by the binutils, which are
allowed to be defined multiply. Up to now (binutils-2.9.1), this was not
the case for COFF format files, but 2.10 will change that situation. 

3) Careful explicit instantiation is forced into the programmers' hands. 
That's the '#pragma interface'/'#pragma implementation' stuff used in
gcc-2.7. Problem with it is that this method is an unportable change of
the programming language, effectively. It was also very cumbersome to use,
or so it seems from reading the docs. 

Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019