unsigned int pointer_equality_needed : 1;
/* Symbol is a unique global symbol. */
unsigned int unique_global : 1;
- /* Symbol is defined with non-default visibility. */
+ /* Symbol is defined by a shared library with non-default visibility
+ in a read/write section. */
unsigned int protected_def : 1;
/* String table index in .dynstr if this is a dynamic symbol. */
static void
elf_merge_st_other (bfd *abfd, struct elf_link_hash_entry *h,
- const Elf_Internal_Sym *isym,
+ const Elf_Internal_Sym *isym, asection *sec,
bfd_boolean definition, bfd_boolean dynamic)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
if (symvis - 1 < hvis - 1)
h->other = symvis | (h->other & ~ELF_ST_VISIBILITY (-1));
}
- else if (definition && ELF_ST_VISIBILITY (isym->st_other) != STV_DEFAULT)
+ else if (definition
+ && ELF_ST_VISIBILITY (isym->st_other) != STV_DEFAULT
+ && (sec->flags & SEC_READONLY) == 0)
h->protected_def = 1;
}
/* Merge st_other. If the symbol already has a dynamic index,
but visibility says it should not be visible, turn it into a
local symbol. */
- elf_merge_st_other (abfd, h, sym, newdef, newdyn);
+ elf_merge_st_other (abfd, h, sym, sec, newdef, newdyn);
if (h->dynindx != -1)
switch (ELF_ST_VISIBILITY (h->other))
{
}
/* Merge st_other field. */
- elf_merge_st_other (abfd, h, isym, definition, dynamic);
+ elf_merge_st_other (abfd, h, isym, sec, definition, dynamic);
/* We don't want to make debug symbol dynamic. */
if (definition && (sec->flags & SEC_DEBUGGING) && !info->relocatable)
ehdest->target_internal = ehsrc->target_internal;
isym.st_other = ehsrc->other;
- elf_merge_st_other (abfd, ehdest, &isym, TRUE, FALSE);
+ elf_merge_st_other (abfd, ehdest, &isym, NULL, TRUE, FALSE);
}
/* Append a RELA relocation REL to section S in BFD. */