summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShankar Easwaran <shankare@codeaurora.org>2015-02-12 22:37:27 +0000
committerShankar Easwaran <shankare@codeaurora.org>2015-02-12 22:37:27 +0000
commit7d71622c8fd0846d99cd0fb8878ecf255848de0a (patch)
treeebe05234746c0efbaacfe4c8dc42fa5651dbe04b
parentb93569d182b784b7bf3a1347d7fcd50d11a550b1 (diff)
downloadbcm5719-llvm-7d71622c8fd0846d99cd0fb8878ecf255848de0a.tar.gz
bcm5719-llvm-7d71622c8fd0846d99cd0fb8878ecf255848de0a.zip
[ELF] Insert wrap symbols into a set.
Symbols specified by --wrap was being inserted into a vector, change this to insert into a set, so that we have unique entries. llvm-svn: 228968
-rw-r--r--lld/include/lld/ReaderWriter/ELFLinkingContext.h6
-rw-r--r--lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp5
-rw-r--r--lld/test/elf/wrap.test4
3 files changed, 9 insertions, 6 deletions
diff --git a/lld/include/lld/ReaderWriter/ELFLinkingContext.h b/lld/include/lld/ReaderWriter/ELFLinkingContext.h
index 4b6c8b9b982..190129cc57d 100644
--- a/lld/include/lld/ReaderWriter/ELFLinkingContext.h
+++ b/lld/include/lld/ReaderWriter/ELFLinkingContext.h
@@ -24,6 +24,7 @@
#include "llvm/Support/ELF.h"
#include <map>
#include <memory>
+#include <set>
namespace lld {
class DefinedAtom;
@@ -47,6 +48,7 @@ public:
class ELFLinkingContext : public LinkingContext {
public:
+ typedef std::set<StringRef>::iterator StringRefSetIterT;
/// \brief The type of ELF executable that the linker
/// creates.
@@ -305,7 +307,7 @@ public:
// --wrap option.
void addWrapForSymbol(StringRef);
- StringRefVector wrapCalls() const;
+ range<std::set<StringRef>::iterator> wrapCalls() const;
private:
ELFLinkingContext() LLVM_DELETED_FUNCTION;
@@ -346,7 +348,7 @@ protected:
StringRef _soname;
StringRefVector _rpathList;
StringRefVector _rpathLinkList;
- StringRefVector _wrapCalls;
+ std::set<StringRef> _wrapCalls;
std::map<std::string, uint64_t> _absoluteSymbols;
llvm::StringSet<> _dynamicallyExportedSymbols;
std::vector<std::unique_ptr<script::Parser>> _scripts;
diff --git a/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp b/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
index 6498e5744b5..d4f19aa3da4 100644
--- a/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
+++ b/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
@@ -258,10 +258,11 @@ std::string ELFLinkingContext::demangle(StringRef symbolName) const {
// Support --wrap option.
void ELFLinkingContext::addWrapForSymbol(StringRef symbol) {
- _wrapCalls.push_back(symbol);
+ _wrapCalls.insert(symbol);
}
-ELFLinkingContext::StringRefVector ELFLinkingContext::wrapCalls() const {
+range<ELFLinkingContext::StringRefSetIterT>
+ELFLinkingContext::wrapCalls() const {
return _wrapCalls;
}
diff --git a/lld/test/elf/wrap.test b/lld/test/elf/wrap.test
index 563df6038e9..997439f8f5b 100644
--- a/lld/test/elf/wrap.test
+++ b/lld/test/elf/wrap.test
@@ -26,9 +26,9 @@
#RUN: yaml2obj -format=elf -docnum 2 %s -o %t.wrapfoo.o
#RUN: yaml2obj -format=elf -docnum 3 %s -o %t.realfoo.o
#RUN: lld -flavor gnu -target x86_64 %t.main.o %t.wrapfoo.o %t.realfoo.o \
-#RUN: --wrap foo --noinhibit-exec --output-filetype=yaml -o %t2.out
+#RUN: --wrap foo --wrap foo --noinhibit-exec --output-filetype=yaml -o %t2.out
#RUN: lld -flavor gnu -target x86_64 %t.main.o %t.wrapfoo.o \
-#RUN: --wrap foo --noinhibit-exec --output-filetype=yaml -o %t2.out.undef 2>&1 | \
+#RUN: --wrap foo --wrap foo --noinhibit-exec --output-filetype=yaml -o %t2.out.undef 2>&1 | \
#RUN: FileCheck %s -check-prefix=CHECKUNDEF
#CHECKWRAP: - name: main
#CHECKWRAP: references:
OpenPOWER on IntegriCloud