OSDN Git Service

[COFF] Ignore semicolons in module definition identifiers
authorRui Ueyama <ruiu@google.com>
Wed, 6 Dec 2017 19:18:24 +0000 (19:18 +0000)
committerRui Ueyama <ruiu@google.com>
Wed, 6 Dec 2017 19:18:24 +0000 (19:18 +0000)
Patch by David Major.

The NSS project's .def files make heavy use of semicolons in a
frightening attempt at portability:
https://hg.mozilla.org/projects/nss/raw-file/tip/lib/ckfw/capi/nsscapi.def

lld-link was treating the semicolon as part of the export name,
resulting in unresolved symbols. This patch includes ';' in the list of
characters to split on.

Differential Revision: https://reviews.llvm.org/D39968

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319933 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Object/COFFModuleDefinition.cpp
test/tools/llvm-dlltool/coff-exports.def

index e220801..a571354 100644 (file)
@@ -117,7 +117,7 @@ public:
       return Token(Identifier, S);
     }
     default: {
-      size_t End = Buf.find_first_of("=,\r\n \t\v");
+      size_t End = Buf.find_first_of("=,;\r\n \t\v");
       StringRef Word = Buf.substr(0, End);
       Kind K = llvm::StringSwitch<Kind>(Word)
                    .Case("BASE", KwBase)
index 01d816f..0656a44 100644 (file)
@@ -5,11 +5,17 @@
 
 LIBRARY test.dll
 EXPORTS
-TestFunction
+TestFunction1
+TestFunction2;
+TestFunction3 ; This is a comment
 
 ; CHECK: File: test.dll
 ; CHECK: Format: COFF-import-file
 ; CHECK: Type: code
 ; CHECK: Name type: name
-; CHECK: Symbol: __imp_TestFunction
-; CHECK: Symbol: TestFunction
+; CHECK: Symbol: __imp_TestFunction1
+; CHECK: Symbol: TestFunction1
+; CHECK: Symbol: __imp_TestFunction2{{$}}
+; CHECK: Symbol: TestFunction2{{$}}
+; CHECK: Symbol: __imp_TestFunction3{{$}}
+; CHECK: Symbol: TestFunction3{{$}}