This is an archive of the discontinued LLVM Phabricator instance.

[llvm-ml] Imlement support for MASM's extern directive
ClosedPublic

Authored by ayzhao on May 9 2022, 3:09 PM.

Details

Summary

The EXTERN keyword defines external symbols in MASM.

Credit goes to epastor@ for implementing most of the logic; I (ayzhao@)
added some bugfixes and tests.

[0]: https://docs.microsoft.com/en-us/cpp/assembler/masm/extern-masm?view=msvc-170

Diff Detail

Event Timeline

ayzhao created this revision.May 9 2022, 3:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2022, 3:09 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
ayzhao requested review of this revision.May 9 2022, 3:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 9 2022, 3:09 PM
ayzhao added a subscriber: thakis.
ayzhao updated this revision to Diff 428214.May 9 2022, 3:12 PM

Make the extern.asm test more robust by declaring multiple symbols in one statement

ayzhao updated this revision to Diff 428219.May 9 2022, 3:31 PM

Add tests for error messages

ayzhao updated this revision to Diff 428222.May 9 2022, 3:37 PM

Actually add the extern_errors.asm test this time

epastor accepted this revision.May 10 2022, 7:08 AM
epastor added inline comments.
llvm/test/tools/llvm-ml/extern.asm
5

If feasible, we should test that the type info works correctly too - possibly by checking that they work in the appropriate contexts and fail in the appropriate contexts?

Just off the top of my head (and I may have this wrong, I didn't check)... I think:

mov ebx, foo
mov bx, bar

should both work, but

mov bx, foo
mov bl, bar

should both fail due to size checking.

This revision is now accepted and ready to land.May 10 2022, 7:08 AM
ayzhao updated this revision to Diff 428428.May 10 2022, 10:27 AM

Add checks for type info.

ayzhao updated this revision to Diff 428430.May 10 2022, 10:32 AM
ayzhao marked an inline comment as done.

use @LINE + 1 for consistency

This revision was landed with ongoing or failed builds.May 10 2022, 11:36 AM
This revision was automatically updated to reflect the committed changes.