diff options
author | Rui Ueyama <ruiu@google.com> | 2015-09-02 07:27:31 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2015-09-02 07:27:31 +0000 |
commit | bfbd277a1cdd6e66a235045064d4465a4a5e1203 (patch) | |
tree | 407b9b00328fe5815221b762c2aa0070521a3062 /lld/COFF/DLL.cpp | |
parent | 611c7cff536375134034e99c4dbe3dcba4a52803 (diff) | |
download | bcm5719-llvm-bfbd277a1cdd6e66a235045064d4465a4a5e1203.tar.gz bcm5719-llvm-bfbd277a1cdd6e66a235045064d4465a4a5e1203.zip |
COFF: Preserve original spelling of DLL file name.
This patch fixes a subtle incompatibility with MSVC linker.
MSVC linker preserves the original spelling of a DLL in the
import descriptor table. LLD previously converted all
characters to lowercase. Usually this difference is benign,
but if a program explicitly checks for DLL file names, the
program could fail.
llvm-svn: 246620
Diffstat (limited to 'lld/COFF/DLL.cpp')
-rw-r--r-- | lld/COFF/DLL.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lld/COFF/DLL.cpp b/lld/COFF/DLL.cpp index 5da0fca3c71..79e201a9af1 100644 --- a/lld/COFF/DLL.cpp +++ b/lld/COFF/DLL.cpp @@ -128,13 +128,13 @@ static std::vector<std::vector<DefinedImportData *>> binImports(const std::vector<DefinedImportData *> &Imports) { // Group DLL-imported symbols by DLL name because that's how // symbols are layed out in the import descriptor table. - auto Less = [](StringRef A, StringRef B) { + auto Less = [](const std::string &A, const std::string &B) { return Config->DLLOrder[A] < Config->DLLOrder[B]; }; - std::map<StringRef, std::vector<DefinedImportData *>, - bool(*)(StringRef, StringRef)> M(Less); + std::map<std::string, std::vector<DefinedImportData *>, + bool(*)(const std::string &, const std::string &)> M(Less); for (DefinedImportData *Sym : Imports) - M[Sym->getDLLName()].push_back(Sym); + M[Sym->getDLLName().lower()].push_back(Sym); std::vector<std::vector<DefinedImportData *>> V; for (auto &P : M) { |