This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Broken -frepo (was Re: PATCH: PR ld/1396: prohibited cross reference to a local symbol)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Thu, 30 Mar 2006 15:51:34 +0200
- Subject: Broken -frepo (was Re: PATCH: PR ld/1396: prohibited cross reference to a local symbol)
- References: <2734.192.168.201.6.1128350711.squirrel@pc300> <20051004195249.GB13574@lucon.org>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Oct 04, 2005 at 12:52:49PM -0700, H. J. Lu wrote:
> The patch is incorrect. Here is the right one.
> 2005-10-04 H.J. Lu <hongjiu.lu@intel.com>
>
> PR ld/1396
> * ldcref.c (check_refs): Accept asymbol *.
> (check_local_sym_xref): Pass sym to check_refs.
> (check_nocrossref): Pass NULL to check_refs.
> (check_refs_info): Add asymbol *.
> (check_refs): Add asymbol * to check_refs_info.
> (check_reloc_refs): Match relocations with proper symbols.
>
> * ldmisc.c (vfinfo): Don't add extra ":\n".
This patch broke g++ -frepo.
While previously we got output like:
a.o: In function `main':
a.C:(.text+0xd): undefined reference to `C<int>::C()'
with 2005-10-05+ binutils we now get it all on one line:
a.o: In function `main':a.C:(.text+0xd): undefined reference to `C<int>::C()'
Is that ld change desirable? If not, we need to fix it, otherwise
we should update collect2's ld output parser to handle even this.
Testcase is:
template<class T> class C
{
public:
C();
};
template<class T>
C<T>::C()
{
}
int
main(void)
{
C<int> x;
return 0;
}
g++ -c -frepo a.C
g++ -frepo -o a a.o
2006-03-30 Jakub Jelinek <jakub@redhat.com>
* tlink.c (scan_linker_output): Handle
"In function `foo'...undefined...`bar'" on one line.
--- gcc/tlink.c.jj 2006-03-30 05:00:02.000000000 -0500
+++ gcc/tlink.c 2006-03-30 08:36:57.000000000 -0500
@@ -1,7 +1,7 @@
/* Scan linker error messages for missing template instantiations and provide
them.
- Copyright (C) 1995, 1998, 1999, 2000, 2001, 2003, 2004, 2005
+ Copyright (C) 1995, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Contributed by Jason Merrill (jason@cygnus.com).
@@ -648,10 +647,11 @@ scan_linker_output (const char *fname)
sym = symbol_hash_lookup (p, false);
}
+ retry_quoted:
if (! sym && ! end)
/* Try a mangled name in quotes. */
{
- const char *oldq = q + 1;
+ const char *oldq = q + 1, *oldp;
demangled *dem = 0;
q = 0;
@@ -668,6 +668,7 @@ scan_linker_output (const char *fname)
if (q != oldq)
p = (char *)oldq;
}
+ oldp = p;
if (p)
{
@@ -699,6 +700,15 @@ scan_linker_output (const char *fname)
sym = symbol_hash_lookup (p, false);
}
}
+ /* 20051005+ GNU ld emits
+ "In function `foo':file:section: undefined reference to `bar'"
+ style error message. */
+ else if (q && (oldp - oldq) >= (int) sizeof ("In function ")
+ && strcmp (oldp - sizeof ("In function "),
+ "In function ") == 0
+ && (p = strchr (q, '`')) != NULL
+ && strchr (p, '\'') != NULL)
+ goto retry_quoted;
}
if (sym && sym->tweaked)
Jakub