-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Description
| Bugzilla Link | 9067 |
| Version | trunk |
| OS | Windows XP |
| Reporter | LLVM Bugzilla Contributor |
Extended Description
Hello,
Recently there has been revision 114154 - MC/AsmParser: Add support for 'a + 4@GOTPCREL' added to the trunk. The submitted patch adds check whether @ suffix is one of list of predefined ones (done in lib/MC/MCParser/AsmParser.cpp around line 512).
Code (reformated for bugzilla) goes like this:
MCSymbol *Sym = getContext().GetOrCreateSymbol(Split.first);
...
MCSymbolRefExpr::VariantKind Variant =
MCSymbolRefExpr::getVariantKindForName(Split.second);
if (Variant == MCSymbolRefExpr::VK_Invalid)
{
Variant = MCSymbolRefExpr::VK_None;
return TokError("invalid variant '" + Split.second + "'");
}
....
Problem is when stdcall function on wincoff gets called from assembly with similar assembly line: calll *_GetTickCount@0, the '0' after '@' will obviously cause VK_Invalid to be set on Variant, user gets:
... invalid variant '0'.
I propose to add a reference to MCAsmInfo to AsmParser, initialize it in constructor and add check for MAI.hasMicrosoftFastStdCallMangling() to AsmParser::ParsePrimaryExpr, then call GetOrCreateSymbol on whole Identifier without splitting it around '@' for wincoff case.
I can send patch for revision in around 10 hours. I can then try to support with extensions for cc1as for Wincoff (1 .section doesnt get parsed, 2 zerofill from coffasmparser causes llvm_unreachable).
What do You guys think of proposed change?
Regards,