This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [Proposed binutils PATCH] Re: Diagnosing an intricate C++ problem
- To: Gerald Pfeifer <pfeifer at dbai dot tuwien dot ac dot at>
- Subject: Re: [Proposed binutils PATCH] Re: Diagnosing an intricate C++ problem
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Sat, 2 Sep 2000 11:35:13 -0700
- Cc: rittle at rsch dot comm dot mot dot com, gcc-patches at gcc dot gnu dot org,binutils at sources dot redhat dot com
- References: <200007250811.DAA35595@latour.rsch.comm.mot.com> <Pine.BSF.4.21.0009021957530.89194-100000@taygeta.dbai.tuwien.ac.at>
On Sat, Sep 02, 2000 at 08:08:04PM +0200, Gerald Pfeifer wrote:
> On Tue, 25 Jul 2000, Loren James Rittle wrote:
> > In light of this analysis, the warning feature you desire would be in
> > GNU ld not gcc. I have no idea if it is practical but, we C++
> > programmers would want the linker to check that all pruned functions
> > are indeed identical copies.
>
> That sounds great!
>
> > 2000-07-25 Loren J. Rittle <ljrittle@acm.org>
> >
> > * ldlang.c (section_already_linked): Implement check for
> > the SEC_LINK_DUPLICATES_SAME_CONTENTS case.
> >
> > 2000-07-25 Loren J. Rittle <ljrittle@acm.org>
> >
> > * elf.c (_bfd_elf_make_section_from_shdr): Enable the checking
> > of the section contents.
>
> I built binutils 2.10 with these two patches and, on top of that,
> GCC mainline on FreeBSD 4.1.
>
> That toolchain nicely diagnoses my original problem, but this one seems
> to be more serious than I originally thought, the problem being standard
> libraries like libstdc++.
>
> > I can also imagine that the linking process could slow down under
> > heavily-templated code. However, for all the small, multi-file STL
> > examples that I had lying around, (1) I found no measurable slowdown
> > and (2) no false warnings unless I compiled some files with
> > -fomit-frame-pointer and some without (interestingly, even adding -O
> > didn't change the linkonce sections as I expected it might).
> >
> > Gerald, I'm sure you have some production-strength, heavily-templated
> > code. Have at it and please report your findings.
>
> Yes (and sorry that it took that long): My production stuff linked
> successfully, but produced tons of warnings.
>
> Here is a minimal test case
>
> ---- cut: x.cc ----
> #include <string>
> #include <vector>
>
> main() {
> vector<string> w;
>
> w.push_back("Hello");
> }
> ---- cut: x.cc----
>
> for which a simple `g++ x.cc` generates the following warnings:
>
I cannot duplicated it under Linux with the Linux binutils 2.10.0.24.
FWIW, as far as I know, binutils 2.10 is too old and so many bugs
have been fixed since then.
H.J.