forked from OSchip/llvm-project
[ELF] Uniquify --wrap list.
Summary: For --wrap foo --wrap foo, bfd/gold wrap the symbol only once but LLD would rotate it twice. Reviewers: ruiu, espindola Subscribers: emaste, arichardson, mgrang, llvm-commits Differential Revision: https://reviews.llvm.org/D48298 llvm-svn: 334991
This commit is contained in:
parent
88bbad24c0
commit
d9c3c1cd9d
|
@ -1303,8 +1303,11 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &Args) {
|
|||
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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue