From yergeau@localhost.Stanford.EDU  Thu Apr  2 17:59:28 1998
Received: from localhost.Stanford.EDU (sjx-ca81-15.ix.netcom.com [207.94.112.47])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA25507
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 2 Apr 1998 17:59:26 -0800 (PST)
          (envelope-from yergeau@localhost.Stanford.EDU)
Received: (from yergeau@localhost) by localhost.Stanford.EDU (8.8.7/8.8.2) id RAA06174; Thu, 2 Apr 1998 17:59:19 -0800 (PST)
Message-Id: <199804030159.RAA06174@localhost.Stanford.EDU>
Date: Thu, 2 Apr 1998 17:59:19 -0800 (PST)
From: yergeau@gloworm.stanford.edu
Reply-To: yergeau@gloworm.stanford.edu
To: FreeBSD-gnats-submit@freebsd.org
Cc: yergeau@gloworm.stanford.edu
Subject: /bin/ld's demangling of C++ names breaks -frepo feature of egcs
X-Send-Pr-Version: 3.2

>Number:         6198
>Category:       bin
>Synopsis:       demangling C++ names breaks the Cygnus -frepo hack
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr  2 18:00:01 PST 1998
>Closed-Date:    Fri Aug 20 00:32:57 PDT 1999
>Last-Modified:  Fri Aug 20 00:34:36 PDT 1999
>Originator:     Dan Yergeau
>Release:        FreeBSD 2.2.5-RELEASE i386
>Organization:
>Environment:

FreeBSD 2.2.5-RELEASE
gcc-2.7.2.x  with the gcc-2.7.2-repo-bsd.patch
or egcs-1.0.2 with tlink.c replaced by the one from the above patch

>Description:

If /usr/bin/ld demangles C++ names, the automatic template
instantiation feature added by the Cygnus -frepo/tlink hack (also in
egcs) breaks.  The -frepo/tlink hack relies on raw encoded names
being reported as missing symbols so that collect2 knows what needs
to be recompiled in order to instantiate templates.

>How-To-Repeat:

>Fix:

Although it is nice to have the names demangled automatically, ld is
probably not the best place to do it (or, at least not as a
compiled-in default).  I'll suggest either 

 1) altering the current hardcoded demangling to be selectable by a
    ld option or an environment variable (off by default, but would
    be turned on by the /usr/bin/{gcc,c++,g++} drivers).

 2) disabling the current hardcoded demangling and just alter the
    compiler driver to pipe ld output through c++filt (or redirect
    to a file and filter that file).  The only potential gotcha is
    in handling stdout vs. stderr.

No other ld that I know of tries to demangle C++ names.  Compilers
that appear to do so (e.g. Sun's SC4.x CC) seem to use the second
approach.

I'm a little suprised that neither FSF nor Cygnus have implemented
demangling ld errors.


Dan

>Release-Note:
>Audit-Trail:

From: <jkoshy@FreeBSD.org>
To: freebsd-gnats-submit@freebsd.org
Cc: yergeau@gloworm.stanford.edu
Subject: Re: bin/6198: demangling C++ names breaks the Cygnus -frepo hack
Date: Thu, 19 Aug 1999 00:59:54 -0700 (PDT)

 Since the ELF move, FreeBSD's ld(1) is the stock GNU binutils ld. 
 
 This change will need to be taken up with the GNU folks.
 
 Regards,
 Koshy
 <jkoshy@freebsd.org>
 

From: Dan Yergeau <yergeau@gloworm.Stanford.EDU>
To: freebsd-gnats-submit@freebsd.org, yergeau@gloworm.Stanford.EDU
Cc: jkoshy@freebsd.org
Subject: Re: bin/6198: demangling C++ names breaks the Cygnus -frepo hack
Date: Thu, 19 Aug 1999 11:03:36 -0700

 The stock (ELF) ld under 3.x works properly.
 
 Note that it was the functionality of demangling names that had been
 *added* to the 2.2.x ld that broke the -frepo feature.
 
 Symbol demangling functionality does not belong in ld.  Third-party
 compilers may need to scan the raw output.
 
 BTW, collect2 does symbol demangling.  If collect2 were used with the
 stock C++ compiler in FreeBSD (AFAICT, collect2 is still disabled as of
 3.2-RELEASE), there would have been no need to add the demangling
 misfeature to ld.
 
 As far as I'm concerned, this PR is closed (at least for 3.x and above),
 though there may be a need to reopen it if someone gets the misguided
 idea to reintegrate the demangling functionality in the ELF ld.
 
 Regards,
 Dan
 
State-Changed-From-To: open->closed 
State-Changed-By: jkoshy 
State-Changed-When: Fri Aug 20 00:32:57 PDT 1999 
State-Changed-Why:  
At submitters request; problem no longer exists in 3.X. 
>Unformatted:
