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


I have resolved my immediate problem, but the
larger issue of "silent failure" should probably
be addressed.

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.

Recommendation ---
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
binutils@sources.redhat.com.)

________________________________________
Get your email at 
http://www.prontomail.com 


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