This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: fix visibility assignment to st_other
- From: Richard Henderson <rth at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Thu, 21 Nov 2002 10:53:25 -0800
- Subject: Re: fix visibility assignment to st_other
- References: <20021119194204.A2134@redhat.com>
One more place we scrog the arch's st_other bits.
r~
* elflink.h (elf_link_add_object_symbols): Don't overwrite the
arch's st_other bits when merging visibilities.
(elf_link_output_extsym): Tidy clearing of visibility field.
Index: elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.196
diff -c -p -d -r1.196 elflink.h
*** elflink.h 12 Nov 2002 07:55:43 -0000 1.196
--- elflink.h 21 Nov 2002 18:50:38 -0000
*************** elf_link_add_object_symbols (abfd, info)
*** 1938,1956 ****
might be needed here. */
if (isym->st_other != 0)
{
! /* Combine visibilities, using the most constraining one. */
! unsigned char hvis = ELF_ST_VISIBILITY (h->other);
! unsigned char symvis = ELF_ST_VISIBILITY (isym->st_other);
! if (symvis && (hvis > symvis || hvis == 0))
! h->other = isym->st_other;
! /* If neither has visibility, use the st_other of the
! definition. This is an arbitrary choice, since the
! other bits have no general meaning. */
! if (!symvis && !hvis
! && (definition || h->other == 0))
! h->other = isym->st_other;
}
/* Set a flag in the hash table entry indicating the type of
--- 1938,1954 ----
might be needed here. */
if (isym->st_other != 0)
{
! unsigned char hvis, symvis, other;
! /* Take the balance of OTHER from the definition. */
! other = (definition ? isym->st_other : h->other);
! other &= ~ ELF_ST_VISIBILITY (-1);
! /* Combine visibilities, using the most constraining one. */
! hvis = ELF_ST_VISIBILITY (h->other);
! symvis = ELF_ST_VISIBILITY (isym->st_other);
!
! h->other = other | (hvis > symvis ? hvis : symvis);
}
/* Set a flag in the hash table entry indicating the type of
*************** elf_link_output_extsym (h, data)
*** 6389,6399 ****
sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info));
}
! /* If a symbol is not defined locally, we clear the visibility
! field. */
if (! finfo->info->relocateable
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
! sym.st_other ^= ELF_ST_VISIBILITY (sym.st_other);
/* If this symbol should be put in the .dynsym section, then put it
there now. We already know the symbol index. We also fill in
--- 6387,6396 ----
sym.st_info = ELF_ST_INFO (bindtype, ELF_ST_TYPE (sym.st_info));
}
! /* If a symbol is not defined locally, we clear the visibility field. */
if (! finfo->info->relocateable
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
! sym.st_other &= ~ ELF_ST_VISIBILITY (-1);
/* If this symbol should be put in the .dynsym section, then put it
there now. We already know the symbol index. We also fill in