[llvm] r316690 - [COFF] Support ordinals in def files with space between @ and the number

Martin Storsjo via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 13:11:32 PDT 2017


Author: mstorsjo
Date: Thu Oct 26 13:11:32 2017
New Revision: 316690

URL: http://llvm.org/viewvc/llvm-project?rev=316690&view=rev
Log:
[COFF] Support ordinals in def files with space between @ and the number

Both GNU ld and MS link.exe support declaring ordinals this way.

A test will be added in lld.

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

Modified:
    llvm/trunk/lib/Object/COFFModuleDefinition.cpp

Modified: llvm/trunk/lib/Object/COFFModuleDefinition.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFModuleDefinition.cpp?rev=316690&r1=316689&r2=316690&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFModuleDefinition.cpp (original)
+++ llvm/trunk/lib/Object/COFFModuleDefinition.cpp Thu Oct 26 13:11:32 2017
@@ -250,13 +250,18 @@ private:
     for (;;) {
       read();
       if (Tok.K == Identifier && Tok.Value[0] == '@') {
-        if (Tok.Value.drop_front().getAsInteger(10, E.Ordinal)) {
-          // Not an ordinal modifier at all, but the next export (fastcall
-          // decorated) - complete the current one.
+        if (Tok.Value == "@") {
+          // "foo @ 10"
+          read();
+          Tok.Value.getAsInteger(10, E.Ordinal);
+        } else if (Tok.Value.drop_front().getAsInteger(10, E.Ordinal)) {
+          // "foo \n @bar" - Not an ordinal modifier at all, but the next
+          // export (fastcall decorated) - complete the current one.
           unget();
           Info.Exports.push_back(E);
           return Error::success();
         }
+        // "foo @10"
         read();
         if (Tok.K == KwNoname) {
           E.Noname = true;




More information about the llvm-commits mailing list