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

AOT compiler generates invalid assembler code for Mac Catalyst in .NET 9 #97342

Closed
rolfbjarne opened this issue Jan 22, 2024 · 6 comments
Closed
Assignees
Milestone

Comments

@rolfbjarne
Copy link
Member

Description

AOT compiler generates invalid assembler code for Mac Catalyst in .NET 9

Reproduction Steps

Test case: aot-compiler-test-case-fa0f17e.zip

Unzip and run test.sh. The script will download the AOT compiler for 9.0.0-alpha.1.24066.33 and AOT compile the file linked/Microsoft.Maui.Controls.dll + (try to) compile the resulting assembler code.

Expected behavior

Valid assembler code.

Actual behavior

Microsoft.Maui.Controls.dll.s:91707:10: error: unexpected token in '.loc' directive
.loc 107 -8 0
         ^
Microsoft.Maui.Controls.dll.s:224390:10: error: unexpected token in '.loc' directive
.loc 249 -11 0
         ^
Microsoft.Maui.Controls.dll.s:445252:10: error: unexpected token in '.loc' directive
.loc 431 -3 0
         ^
Microsoft.Maui.Controls.dll.s:452970:10: error: unexpected token in '.loc' directive
.loc 445 -44 0 prologue_end
         ^

Resulting .s file:
Microsoft.Maui.Controls.dll.s.zip

Regression?

Yes, this works in .NET 8.

Known Workarounds

None

Configuration

9.0.0-alpha.1.24066.33

Other information

This is blocking MAUI from building packages for .NET 9.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jan 22, 2024
@rolfbjarne
Copy link
Member Author

CC @vargaz

@rolfbjarne
Copy link
Member Author

Looks like loc->row overflows here?

fprintf (acfg->fp, ".loc %d %d 0%s\n", findex, loc->row, options);

It's defined as a uint32_t:

@steveisok
Copy link
Member

@vargaz can you please look into this?

@steveisok steveisok added this to the 9.0.0 milestone Jan 22, 2024
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jan 22, 2024
vargaz added a commit to vargaz/runtime that referenced this issue Jan 22, 2024
@vargaz
Copy link
Contributor

vargaz commented Jan 22, 2024

This appears to be a problem with either the debug info in the pdb file, or its decoding. Need more time to investigate, added a workaround in a PR.

@vargaz
Copy link
Contributor

vargaz commented Jan 23, 2024

I think this is caused by:
#96497

The additional iloffset < offset check causes us to skip a mono_metadata_decode_value () call, messing up the decoding of later entries.

@vargaz
Copy link
Contributor

vargaz commented Jan 23, 2024

The problematic PR was reverted on master/9.0.

@vargaz vargaz closed this as completed Jan 23, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants