Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ilasm parsing of defines #42002

Merged
merged 2 commits into from
Sep 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/coreclr/src/ilasm/grammar_after.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -924,10 +924,6 @@ int yylex()
tok = parse_literal(curSym, curPos, FALSE);
if(tok == QSTRING)
{
// insert UTF-8 BOM prefix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will strings encoded in UTF-8 still work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not able to figure out what this was supposed to help with. Non-ASCII QSTRINGs (quoted strings) never worked in this position as far as I can tell. The following:

#define NAME "ššš"

.assembly NAME

fails in all .NET Framework and earlier .NET Core versions of ilasm. The case that this change is fixing is:

#define NAME "sss"

.assembly NAME

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for the details.

yylval.binstr->insertInt8(0xEF);
yylval.binstr->insertInt8(0xBB);
yylval.binstr->insertInt8(0xBF);
yylval.binstr->appendInt8(' ');
DefineVar(newstr, yylval.binstr);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

.assembly extern System.Runtime {}
#define CORE_ASSEMBLY "System.Runtime"

.assembly extern CORE_ASSEMBLY {}
.assembly MiAggressiveOptimization {}
.module MiAggressiveOptimization.dll
// MVID: {B5A4E68E-19B7-4FA3-9BE2-2A0B7265233B}

.class public abstract auto ansi sealed beforefieldinit Program
extends [System.Runtime]System.Object
extends [CORE_ASSEMBLY]System.Object
{
.method public hidebysig static void Main() cil managed aggressiveoptimization
{
Expand Down