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: How do I link to a shared lib without having that lib's dependencies (the way MS link does)


David Wuertele <dave-gnus@bfnet.com> writes:

> ILT> I think this is a bug.  The GNU linker is reporting an error where it
> ILT> should report a warning.
> ILT> 
> ILT> Any comments on this patch?
> 
> HJL> I prefer something like this.
> 
> <snipped out undefined_symbol warning code>
> 
> Why does this even have to be a warning?  The 'link' program in
> Windows doesn't print a warning.

Obviously, it doesn't have to be a warning.  However, the linker is
trying to be helpful.  It is telling you that if you try to run your
program, it will most likely fail in the dynamic linker.

That type of warning is very helpful on an ELF system, because the ELF
dynamic linker does lazy binding for function calls.  Without such a
warning, it is possible that the program will only fail in certain
cases.  PE works rather differently, in that it uses a much simpler
type of dynamic linker.

In any case, it is possible that you should be able to turn that
warning off using --allow-shlib-undefined.  See my previous message
about my confusion about that option.  However, it is clear to me that
the ELF linker should warn about this case by default, and currently
--allow-shlib-undefined is the default.  So that simple approach will
not work either.

Ian


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