[llvm] r319933 - [COFF] Ignore semicolons in module definition identifiers

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 11:18:24 PST 2017


Author: ruiu
Date: Wed Dec  6 11:18:24 2017
New Revision: 319933

URL: http://llvm.org/viewvc/llvm-project?rev=319933&view=rev
Log:
[COFF] Ignore semicolons in module definition identifiers

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

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

Modified: llvm/trunk/lib/Object/COFFModuleDefinition.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFModuleDefinition.cpp?rev=319933&r1=319932&r2=319933&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFModuleDefinition.cpp (original)
+++ llvm/trunk/lib/Object/COFFModuleDefinition.cpp Wed Dec  6 11:18:24 2017
@@ -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)

Modified: llvm/trunk/test/tools/llvm-dlltool/coff-exports.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dlltool/coff-exports.def?rev=319933&r1=319932&r2=319933&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dlltool/coff-exports.def (original)
+++ llvm/trunk/test/tools/llvm-dlltool/coff-exports.def Wed Dec  6 11:18:24 2017
@@ -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{{$}}




More information about the llvm-commits mailing list