class ELFLinkingContext : public LinkingContext {
public:
- typedef std::set<StringRef>::iterator StringRefSetIterT;
-
/// \brief The type of ELF executable that the linker
/// creates.
enum class OutputMagic : uint8_t {
}
// --wrap option.
- void addWrapForSymbol(StringRef);
+ void addWrapForSymbol(StringRef sym) { _wrapCalls.insert(sym); }
- range<std::set<StringRef>::iterator> wrapCalls() const;
+ const llvm::StringSet<> &wrapCalls() const { return _wrapCalls; }
private:
ELFLinkingContext() LLVM_DELETED_FUNCTION;
StringRef _soname;
StringRefVector _rpathList;
StringRefVector _rpathLinkList;
- std::set<StringRef> _wrapCalls;
+ llvm::StringSet<> _wrapCalls;
std::map<std::string, uint64_t> _absoluteSymbols;
llvm::StringSet<> _dynamicallyExportedSymbols;
std::vector<std::unique_ptr<script::Parser>> _scripts;
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Object/ELF.h"
#include "llvm/Object/ObjectFile.h"
// c) All references to the symbol specified by wrap should point to
// __wrap_<symbolname>
// d) All references to __real_symbol should point to the <symbol>
- for (auto wrapsym : _ctx.wrapCalls()) {
+ for (auto &wrapsym : _ctx.wrapCalls()) {
+ StringRef wrapStr = wrapsym.getKey();
// Create a undefined symbol fror the wrap symbol.
UndefinedAtom *wrapSymAtom =
- new (_readerStorage) SimpleUndefinedAtom(*this, wrapsym);
+ new (_readerStorage) SimpleUndefinedAtom(*this, wrapStr);
StringRef wrapCallSym =
- _ctx.allocateString((llvm::Twine("__wrap_") + wrapsym).str());
+ _ctx.allocateString((llvm::Twine("__wrap_") + wrapStr).str());
StringRef realCallSym =
- _ctx.allocateString((llvm::Twine("__real_") + wrapsym).str());
+ _ctx.allocateString((llvm::Twine("__real_") + wrapStr).str());
UndefinedAtom *wrapCallAtom =
new (_readerStorage) SimpleUndefinedAtom(*this, wrapCallSym);
// Create maps, when there is call to sym, it should point to wrapCallSym.
- _wrapSymbolMap.insert(std::make_pair(wrapsym, wrapCallAtom));
+ _wrapSymbolMap.insert(std::make_pair(wrapStr, wrapCallAtom));
// Whenever there is a reference to realCall it should point to the symbol
// created for each wrap usage.
_wrapSymbolMap.insert(std::make_pair(realCallSym, wrapSymAtom));