[PATCH] D48298: [ELF] Uniquify --wrap list.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 20 22:46:50 PDT 2018


MaskRay added a comment.

For the record, what bfd and gold do is to record the wrapped symbols. When it later iterates the symbols in some order, it checks whether the symbol has been wrapped, and if true, wrap the symbol.

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob_plain;f=ld/ldmain.c;hb=0d0b0ea29af6abc0790d22f843a3d0cb09424a3a

  /* Record a symbol to be wrapped, from the --wrap option.  */
  
  void
  add_wrap (const char *name)
  {
    if (link_info.wrap_hash == NULL)
      {
        link_info.wrap_hash
  	= (struct bfd_hash_table *) xmalloc (sizeof (struct bfd_hash_table));
        if (!bfd_hash_table_init_n (link_info.wrap_hash,
  				  bfd_hash_newfunc,
  				  sizeof (struct bfd_hash_entry),
  				  61))
  	einfo (_("%F%P: bfd_hash_table_init failed: %E\n"));
      }
  
    if (bfd_hash_lookup (link_info.wrap_hash, name, TRUE, TRUE) == NULL)
      einfo (_("%F%P: bfd_hash_lookup failed: %E\n"));
  }


Repository:
  rL LLVM

https://reviews.llvm.org/D48298





More information about the llvm-commits mailing list