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]

Re: cannot undefine with -u option to ld


Hi,

> It appears that when "-u" is used, ld will
> attempt to define the symbol in the usual way
> (library searches, etc), but , if it cannot, it
> fails silently.  It inserts the symbol in the
> symbol table, annotates it with UND (to indicate
> that it is undefined), but then completes without
> indicating a warning or an error.

This is actually the accepted behaviour and probably should not be
changed.  (There can be quite a few undefined symbol references even
in a fully resolved link).

If you need to force a symbol to be resolved, simply place it into an
object file and then include it on the link command line.  eg to force
a reference to "foo":

  % cat foo.c
  int foo_ref asm ("foo");

  % gcc -c foo.c

  % gcc myprog.o foo.o


Cheers
        Nick


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