This is the mail archive of the
mailing list for the binutils project.
Re: cannot undefine with -u option to ld
- To: nickc at cambridge dot redhat dot com
- Subject: Re: cannot undefine with -u option to ld
- From: "first last" <tjf3 at prontomail dot com>
- Date: Mon, 17 Sep 2001 22:23:49 -0400
- CC: binutils at sources dot redhat dot com,bug-binutils at gnu dot org
I have resolved my immediate problem, but the
larger issue of "silent failure" should probably
Silent Failure ---
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.
How I Fixed Things ---
In my case, I do not remember exactly how I fixed
the problem, but it was definitely caused by
operator error. Possibly the symbol was spelled
differently on the ld command line than in the
module where it was defined. Possibly the
library search order was incorrect. Once all the
ducks were lined up, "ld -u" worked.
Unfortunately the silent failure of "-u"
misdirected me for several days.
In my first email, I reported that "-u" worked
for __gccmain but for no other symbol that I
tried. This was a red herring. "-u" failed with
__gccmain just as well. However,__gccmain became
defined later in the link process for other
reasons, unrelated to "-u". This lead me to
believe that "-u" worked for this one symbol but
for no others.
I would like to recommend that ld be modified to
end with an error (or at least a noticeable
warning) when a symbol is undefined with "-u" and
ld never resolves the problem.
(For reference, this thread started in
Get your email at