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

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


MaskRay updated this revision to Diff 151806.
MaskRay marked an inline comment as done.
MaskRay added a comment.

Update test


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D48298

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


Index: test/ELF/wrap.s
===================================================================
--- test/ELF/wrap.s
+++ 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
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ 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.


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


More information about the llvm-commits mailing list