forked from OSchip/llvm-project
[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
This commit is contained in:
parent
b93569d182
commit
7d71622c8f
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue