This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
A patch to only warn undefined symbol in DSO to be built
- To: fjh at cs dot mu dot oz dot au, binutils at sourceware dot cygnus dot com
- Subject: A patch to only warn undefined symbol in DSO to be built
- From: "H . J . Lu" <hjl at valinux dot com>
- Date: Tue, 6 Feb 2001 23:50:40 -0800
- Cc: Ian Lance Taylor <ian at zembu dot com>
Here is a patch.
--
H.J. Lu (hjl@valinux.com)
---
2001-02-06 H.J. Lu <hjl@gnu.org>
* elflink.h (elf_link_output_extsym): Only warn undefined
symbol in the shared library to be built.
Index: elflink.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elflink.h,v
retrieving revision 1.49
diff -u -p -r1.49 elflink.h
--- elflink.h 2001/02/06 17:27:06 1.49
+++ elflink.h 2001/02/07 07:45:43
@@ -5101,11 +5101,13 @@ elf_link_output_extsym (h, data)
linker will complain that the symbol is undefined when the
program is run. We don't have to worry about symbols that are
referenced by regular files, because we will already have issued
- warnings for them. */
+ warnings for them. If we are creating a shared library, we only
+ warn the undefined symbol in the shared library to be built. */
if (! finfo->info->relocateable
&& ! finfo->info->allow_shlib_undefined
- && ! (finfo->info->shared
- && !finfo->info->no_undefined)
+ && (!finfo->info->shared
+ || (finfo->info->no_undefined
+ && finfo->output_bfd == h->root.u.undef.abfd))
&& h->root.type == bfd_link_hash_undefined
&& (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) != 0
&& (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) == 0)