This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
It is ok to have undefined hidden symbols in a .o file
- To: loewis at informatik dot hu-berlin dot de
- Subject: It is ok to have undefined hidden symbols in a .o file
- From: "H . J . Lu" <hjl at valinux dot com>
- Date: Mon, 5 Jun 2000 12:58:44 -0700
- Cc: Ulrich Drepper <drepper at cygnus dot com>,binutils at sourceware dot cygnus dot com
Where there are
1. foo is undefined, hidden in bar.o
2. foo is defined in foo.o.
both
# gcc -shared -o libfoo.so bar.o foo.o
# gcc -shared -o libfoo.so foo.o bar.o
should work. This patch fixes it. I'd like to check it in if it
is ok with everyone.
--
H.J. Lu (hjl@gnu.org)
--
2000-06-05 H.J. Lu <hjl@gnu.org>
* elflink.c (_bfd_elf_link_record_dynamic_symbol): Don't flag
an error when seeing an undefined symbol with hidden/internal
attributes. It is handled in *_relocate_section ().
Index: elflink.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elflink.c,v
retrieving revision 1.4
diff -u -p -r1.4 elflink.c
--- elflink.c 2000/05/30 19:32:42 1.4
+++ elflink.c 2000/06/05 19:50:49
@@ -226,21 +226,8 @@ _bfd_elf_link_record_dynamic_symbol (inf
{
case STV_INTERNAL:
case STV_HIDDEN:
- /* This symbol must be defined in the shared object or
- executable. */
- if (h->root.type == bfd_link_hash_undefined)
- {
- bfd * abfd = h->root.u.undef.abfd;
- const char * name = h->root.root.string;
-
- (*info->callbacks->undefined_symbol)
- (info, name, abfd, bfd_und_section_ptr, 0, true);
-
- /* We have flaged a fatal error. We now treat this as
- a normal symbol to avoid further error messages. */
- h->other ^= ELF_ST_VISIBILITY (h->other);
- }
- else if (h->root.type != bfd_link_hash_undefweak)
+ if (h->root.type != bfd_link_hash_undefined
+ && h->root.type != bfd_link_hash_undefweak)
{
h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
return true;