2018-06-03 Jim Wilson PR ld/22756 * elfnn-riscv.c (riscv_relax_delete_bytes): Add versioned_hidden check to code that ignores duplicate symbols. Index: binutils-2.30/bfd/elfnn-riscv.c =================================================================== --- binutils-2.30.orig/bfd/elfnn-riscv.c +++ binutils-2.30/bfd/elfnn-riscv.c @@ -2666,9 +2666,12 @@ riscv_relax_delete_bytes (bfd *abfd, ase call to SYMBOL as well. Since both __wrap_SYMBOL and SYMBOL reference the same symbol (which is __wrap_SYMBOL), but still exist as two different symbols in 'sym_hashes', we don't want to adjust - the global symbol __wrap_SYMBOL twice. - This check is only relevant when symbols are being wrapped. */ - if (link_info->wrap_hash != NULL) + the global symbol __wrap_SYMBOL twice. */ + /* The same problem occurs with symbols that are versioned_hidden, as + foo becomes an alias for foo@BAR, and hence they need the same + treatment. */ + if (link_info->wrap_hash != NULL + || sym_hash->versioned == versioned_hidden) { struct elf_link_hash_entry **cur_sym_hashes;