From 6c1fd2992aa2741ab88a8c0ac38f79e4621c2983 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Thu, 26 Oct 2017 20:11:32 +0000 Subject: [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 llvm-svn: 316690 --- llvm/lib/Object/COFFModuleDefinition.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Object/COFFModuleDefinition.cpp') diff --git a/llvm/lib/Object/COFFModuleDefinition.cpp b/llvm/lib/Object/COFFModuleDefinition.cpp index 6ea6015eabc..e2208016eb5 100644 --- a/llvm/lib/Object/COFFModuleDefinition.cpp +++ b/llvm/lib/Object/COFFModuleDefinition.cpp @@ -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; -- cgit v1.2.3