A symbol visibility problem

H. J. Lu hjl@lucon.org
Mon Jan 26 22:02:00 GMT 2004

I got

cc -O -g -B./ -fPIC -c main.c
cc -shared -o libfoo.so -O -g -B./ shared.c
cc -O -g -B./ -fPIC -c bar.c
cc -O -g -B./ -fPIC -c protected.c
cc -o foo -O -g -B./ main.o libfoo.so bar.o protected.o -Wl,-rpath,.
/usr/local/bin/ld: BFD 20040114 assertion fail

The problem is there are

      /* If the new symbol with non-default visibility comes from a
         relocatable file and the old definition comes from a dynamic
         object, we remove the old definition.  */
      if ((*sym_hash)->root.type == bfd_link_hash_indirect)
        h = *sym_hash;
      h->root.type = bfd_link_hash_new;
      h->root.u.undef.abfd = NULL;
If the new entry with non-default visibility is undefined, set the
type to bfd_link_hash_new will lead to the assertion. Should we use

	h->root.type = bfd_link_hash_undefined;

instead and let _bfd_generic_link_add_one_symbol take care of it?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug.tar.gz
Type: application/x-gzip
Size: 511 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20040126/50fc1a21/attachment.bin>

More information about the Binutils mailing list