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)
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com, dave-gnus at bfnet dot com
- Date: Tue, 12 Aug 2003 10:39:50 -0700
- Subject: Re: How do I link to a shared lib without having that lib's dependencies (the way MS link does)
- References: <m38ypz1udy.fsf@bfnet.com> <m38ypybzbn.fsf@gossamer.airs.com>
On Tue, Aug 12, 2003 at 09:44:28AM -0700, Ian Lance Taylor wrote:
> David Wuertele <dave-gnus@bfnet.com> writes:
>
> > I want to create a dynamic library, libA, that links with libB. Then
> > I want to create an executable that links with libA. But I don't want
> > to have to have libB around at compile time. But gcc/ld complains if
> > libB.so is not there! Why is that? My executable only makes calls to
> > libA. The dynamic loader should take care of libB, not the linker!
> >
> > In windows, you can do what I want. I've constructed two scripts, one
> > for Linux using gcc/ld, and one for windows using cl/link, to
> > demonstrate what I want to do and what is going wrong in Linux. Can
> > anyone tell me how to achieve this with gcc/ld?
>
> I think this is a bug. The GNU linker is reporting an error where it
> should report a warning.
>
> Any comments on this patch?
>
I prefer something like this.
H.J.
----
--- bfd/elflink.h.undef 2003-08-07 09:04:31.000000000 -0700
+++ bfd/elflink.h 2003-08-12 10:38:32.000000000 -0700
@@ -4380,7 +4380,7 @@ elf_link_output_extsym (struct elf_link_
{
if (! ((*finfo->info->callbacks->undefined_symbol)
(finfo->info, h->root.root.string, h->root.u.undef.abfd,
- NULL, 0, TRUE)))
+ NULL, 0, ! finfo->info->allow_shlib_undefined)))
{
eoinfo->failed = TRUE;
return FALSE;