This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bad linker behaviour


ian@cygnus.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@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]