As discussed in PR c++/51910, my patch from last summer
http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01368.html
to make HAVE_LD_DEMANGLE the default when using GNU ld exposed a bug in
collect2's link-time -frepo handling -- it depends on the linker passing
back mangled names of undefined symbols to collect2. This patch fixes
that by explicitly adding --no-demangle to the options passed to the
linker in the repository-processing loop. Then the original settings
are restored for the final link, so that (for instance) if the user
requested a map file or if there are messages for real link errors, they
respect the user-specified demangling options. This patch therefore
adds two extra link steps to the case where HAVE_LD_DEMANGLE is defined,
there is repository information, and recompilation is necessary to
resolve undefined symbols from the repository. In other cases it adds
no overhead.
Bootstrapped and regression-tested on i636 linux. OK to check in?
-Sandra
2012-01-29 Sandra Loosemore <san...@codesourcery.com>
Jason Merrill <ja...@redhat.com>
Jakub Jelinek <ja...@redhat.com>
PR c++/51910
gcc/
* tlink.c (do_tlink): Explicitly pass --no-demangle to linker
for repo processing when HAVE_LD_DEMANGLE is defined.
gcc/testsuite/
* g++.dg/torture/pr51910.C: New testcase.