x86: Ignore protected visibility in shared libraries on Solaris
On x86, the PLT entry in executable may be used as function address for
functions in shared libraries. If functions are protected, the function
address used in executable can be different from the function address
used in shared library. This will lead to incorrect run-time behavior
if function pointer equality is needed. By default, x86 linker issues
an error in this case.
On Solaris, linker issued an error for
struct tm *tb = (kind == CPP_time_kind::FIXED ? gmtime : localtime) (&tt);
where gmtime is a protected function in libc.so. Use gmtime's PLT entry
in executable as function address is safe since function pointer equality
isn't needed. Ignore protected visibility in shared libraries on Solaris
to disable linker error. If function pointer equality is needed, linker
will silently generate executable with incorrect run-time behavior on
Solaris.
PR ld/29512
* elf32-i386.c (elf_i386_scan_relocs): Ignore protected
visibility in shared libraries on Solaris.
* elf64-x86-64.c (elf_x86_64_scan_relocs): Likewise.