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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 18 15:36:41 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL334991: [ELF] Uniquify --wrap list. (authored by MaskRay, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D48298

Files:
  lld/trunk/ELF/Driver.cpp
  lld/trunk/test/ELF/wrap.s


Index: lld/trunk/ELF/Driver.cpp
===================================================================
--- lld/trunk/ELF/Driver.cpp
+++ lld/trunk/ELF/Driver.cpp
@@ -1303,8 +1303,11 @@
     Symtab->scanVersionScript();
 
   // Create wrapped symbols for -wrap option.
-  for (auto *Arg : Args.filtered(OPT_wrap))
-    Symtab->addSymbolWrap<ELFT>(Arg->getValue());
+  std::vector<std::string> Wraps = Args.getAllArgValues(OPT_wrap);
+  llvm::sort(Wraps.begin(), Wraps.end());
+  Wraps.erase(std::unique(Wraps.begin(), Wraps.end()), Wraps.end());
+  for (StringRef Name : Wraps)
+    Symtab->addSymbolWrap<ELFT>(Name);
 
   // Do link-time optimization if given files are LLVM bitcode files.
   // This compiles bitcode files into real object files.
Index: lld/trunk/test/ELF/wrap.s
===================================================================
--- lld/trunk/test/ELF/wrap.s
+++ lld/trunk/test/ELF/wrap.s
@@ -6,6 +6,8 @@
 // RUN: llvm-objdump -d -print-imm-hex %t3 | FileCheck %s
 // RUN: ld.lld -o %t3 %t %t2 --wrap foo -wrap=nosuchsym
 // RUN: llvm-objdump -d -print-imm-hex %t3 | FileCheck %s
+// RUN: ld.lld -o %t3 %t %t2 --wrap foo --wrap foo -wrap=nosuchsym
+// RUN: llvm-objdump -d -print-imm-hex %t3 | FileCheck %s
 
 // CHECK: _start:
 // CHECK-NEXT: movl $0x11010, %edx


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48298.151807.patch
Type: text/x-patch
Size: 1280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180618/7527801c/attachment.bin>


More information about the llvm-commits mailing list