From: jont AT harlequin DOT co DOT uk (Jon Thackray) Subject: Re: Bad linker behaviour 7 Oct 1997 13:55:10 -0700 Message-ID: <199710070945.KAA09363.cygnus.gnu-win32@zaphod.long.harlequin.co.uk> References: <199710061729 DOT NAA29946 AT tweedledumb DOT cygnus DOT com> To: gnu-win32 AT cygnus DOT com ian AT cygnus DOT com writes: > >Ah well, it turns out that this is caused by C++ attempted name > >mangling, and only happens in the case where the symbols can't be > >matched (which is the case in my example above, although it wasn't > >meant to be). So, the end result is that for symbols which get name > >mangled like this, the error messages from ld are rubbish. Is there > >any way of getting ld to give the real error message, instead of the > >message after the name mangling? > > No, I'm afraid ld always demangles symbol names in error messages. > The place to fix this is the function demangle in ld/ldmisc.c. Well, the obvious fix is:- res = cplus_demangle (string, DMGL_ANSI | DMGL_PARAMS); return res ? res : xstrdup (string); becomes return xstrdup (string); This means that all link failures will report the actual symbol name, which may not be so good for C++ but will work better for all other users of ld. If ld is invoked standalone, this is definitely the way it should behave (I also object to it stripping a leading _ from the names it reports, this is making an assumption that the object files I've linked have come from a C compiler which is untrue in my case). If ld wishes to be more sophisticated in the cases where it is invoked from gcc or g++, then it should be given additional command line information requesting this behaviour, rather than doing this by default. - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".