This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: cannot undefine with -u option to ld
- To: "first last" <tjf3 at prontomail dot com>
- Subject: Re: cannot undefine with -u option to ld
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- Date: 18 Sep 2001 10:50:24 +0100
- Cc: binutils at sources dot redhat dot com, bug-binutils at gnu dot org
- References: <D5AC04D736246624A8ED8969EBCBCBD5@tjf3.prontomail.com>
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