This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Feature request: undefined-symbol hints


Indeed this is the same problem faced by me earlier. When I was
using my gcc(retargeted) to compile some floating point C code, I
got linker errors of some unresolved symbols. These unresolved
symbols are implicit in the compiler, they do not come up with
the library.

Share more thoughts on this.

-Banit Agrawal

-----Original Message-----
From: binutils-owner@sources.redhat.com
[mailto:binutils-owner@sources.redhat.com]On Behalf Of Martin v. Löwis
Sent: Saturday, August 10, 2002 3:12 PM
To: binutils@sources.redhat.com
Subject: Feature request: undefined-symbol hints


In C++, the compiler emits a number of implicit symbols (vtable,
typeinfo). To avoid code duplication, these are only defined together
with some user-defined symbol (the first virtual function in a class).

If the user fails to define that symbol, the implicit symbols are not
defined, either. Users are often confused by the linker error messages
in these cases.

Some compilers (SunPRO) diagnose the problem with a text like "make
sure you've implemented the first virtual function" While this is
helpful, the user often still has difficulties to correct the problem,
since it may not be obvious which this first function is.

Instead, I'd like to see a message like "Make sure you've implemented
foo::bar". When emitting a reference to these symbols, the compiler
has knowledge which function needs to be implemented, so it could
emit a pseudo-op like

  .undefined_hint __foo_vtable, "Make sure you've implemented foo::bar"

(To make this more compact,

  .undefined_hint __foo_vtable, __foo__bar

might be better) (Adjust name namgling for your compiler in these
examples)

To make such warnings work, support would be needed in the assembler
and the linker (atleast for ELF targets perhaps). I'd like to request
that binutils provides such a feature.

What do you think?

Regards,
Martin


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