diff options
| author | Rui Ueyama <ruiu@google.com> | 2017-12-28 07:41:19 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2017-12-28 07:41:19 +0000 |
| commit | a63eed0f8087ed3245d7141bf05fd8f5e4dd9357 (patch) | |
| tree | 930decd03dae31bd6cea55f412bd415cd4ba6287 | |
| parent | e90ac016e73e7df3deca4c300fdd11a5e0bbe6f0 (diff) | |
| download | bcm5719-llvm-a63eed0f8087ed3245d7141bf05fd8f5e4dd9357.tar.gz bcm5719-llvm-a63eed0f8087ed3245d7141bf05fd8f5e4dd9357.zip | |
Do not parse the same /export string more than once.
Differential Revision: https://reviews.llvm.org/D41607
llvm-svn: 321513
| -rw-r--r-- | lld/COFF/Driver.cpp | 7 | ||||
| -rw-r--r-- | lld/COFF/Driver.h | 3 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index 7319c8dd7e3..1aaec355c7a 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -245,6 +245,13 @@ void LinkerDriver::parseDirectives(StringRef S) { Config->Entry = addUndefined(mangle(Arg->getValue())); break; case OPT_export: { + // If a common header file contains dllexported function + // declarations, many object files may end up with having the + // same /EXPORT options. In order to save cost of parsing them, + // we dedup them first. + if (!DirectivesExports.insert(Arg->getValue()).second) + break; + Export E = parseExport(Arg->getValue()); if (Config->Machine == I386 && Config->MinGW) { if (!isDecorated(E.Name)) diff --git a/lld/COFF/Driver.h b/lld/COFF/Driver.h index 6a851806058..3f7fad1038f 100644 --- a/lld/COFF/Driver.h +++ b/lld/COFF/Driver.h @@ -16,6 +16,7 @@ #include "lld/Common/Reproduce.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/StringRef.h" +#include "llvm/ADT/StringSet.h" #include "llvm/Object/Archive.h" #include "llvm/Object/COFF.h" #include "llvm/Option/Arg.h" @@ -127,6 +128,8 @@ private: std::list<std::function<void()>> TaskQueue; std::vector<StringRef> FilePaths; std::vector<MemoryBufferRef> Resources; + + llvm::StringSet<> DirectivesExports; }; // Functions below this line are defined in DriverUtils.cpp. |

