diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 |
commit | cfca06d7963fa0909f90483b42a6d7d194d01e08 (patch) | |
tree | 209fb2a2d68f8f277793fc8df46c753d31bc853b /lld/COFF/Driver.h | |
parent | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff) |
Notes
Diffstat (limited to 'lld/COFF/Driver.h')
-rw-r--r-- | lld/COFF/Driver.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lld/COFF/Driver.h b/lld/COFF/Driver.h index cc2f25a6f95e..3fee9b1fe50e 100644 --- a/lld/COFF/Driver.h +++ b/lld/COFF/Driver.h @@ -41,6 +41,21 @@ public: COFFOptTable(); }; +// Constructing the option table is expensive. Use a global table to avoid doing +// it more than once. +extern COFFOptTable optTable; + +// The result of parsing the .drective section. The /export: and /include: +// options are handled separately because they reference symbols, and the number +// of symbols can be quite large. The LLVM Option library will perform at least +// one memory allocation per argument, and that is prohibitively slow for +// parsing directives. +struct ParsedDirectives { + std::vector<StringRef> exports; + std::vector<StringRef> includes; + llvm::opt::InputArgList args; +}; + class ArgParser { public: // Parses command line options. @@ -52,16 +67,13 @@ public: // Tokenizes a given string and then parses as command line options in // .drectve section. /EXPORT options are returned in second element // to be processed in fastpath. - std::pair<llvm::opt::InputArgList, std::vector<StringRef>> - parseDirectives(StringRef s); + ParsedDirectives parseDirectives(StringRef s); private: // Concatenate LINK environment variable. void addLINK(SmallVector<const char *, 256> &argv); std::vector<const char *> tokenize(StringRef s); - - COFFOptTable table; }; class LinkerDriver { @@ -75,6 +87,8 @@ public: void enqueueArchiveMember(const Archive::Child &c, const Archive::Symbol &sym, StringRef parentName); + void enqueuePDB(StringRef Path) { enqueuePath(Path, false, false); } + MemoryBufferRef takeBuffer(std::unique_ptr<MemoryBuffer> mb); void enqueuePath(StringRef path, bool wholeArchive, bool lazy); |