This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: How do I link to a shared lib without having that lib's dependencies (the way MS link does)
"Don Woodward" <woodward@woodward.org> writes:
> We're not even talking about an undefined symbol at all.
> The shared lib linked fine without any warnings or errors,
> How can linking to the shared lib produce warnings?
>
> To me it's very clear cut:
> If A dynamically links to B, but not C, and B dynamically links to C,
> then A should have no linkage dependencies on C - it's not using
> C's symbols, B is and B has already linked.
If C no longer exists, then when you try to run A, it may fail.
Moreover, if the undefined reference in B is a function call to a
function defined in C, then running A will not fail immediately. It
may run quite for a long time until it calls the function in B which
tries to call the function in C. When the function in C is called,
the program will fail.
It is this prospect for delayed failure that makes it imperative for
the ELF linker to at least issue a warning, and possibly an error. In
Windows, I believe the program will fail immediately.
I suspect that at one point the --allow-shlib-undefined option turned
off the error. However, I suspect the behaviour mutated over time,
until right now it's not entirely clear what the behaviour is at all.
Ian