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: Ian Lance Taylor <ian at airs dot com>
- To: David Wuertele <dave-gnus at bfnet dot com>
- Cc: binutils at sources dot redhat dot com
- Date: 12 Aug 2003 09:44:28 -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>
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?
Ian
2003-08-12 Ian Lance Taylor <ian@airs.com>
* elflink.h (elf_link_output_extsym): When reporting an undefined
symbol in a shared library, make it a warning rather than an
error.
Index: elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.238
diff -u -p -r1.238 elflink.h
--- elflink.h 7 Aug 2003 08:38:10 -0000 1.238
+++ elflink.h 12 Aug 2003 16:43:41 -0000
@@ -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, FALSE)))
{
eoinfo->failed = TRUE;
return FALSE;