This is an archive of the discontinued LLVM Phabricator instance.

[llvm-ml] Add support for the .S extension
ClosedPublic

Authored by ayzhao on May 25 2022, 3:08 PM.

Details

Summary

Even though MASM files typically have the .asm extension, there are some
use cases [0] where they have the .S extension. MSVC ml assembles such
files with no problems, so llvm-ml should as well.

Additionally, fix the implementation of the /Ta flag and add a test for
it.

[0]: https://crrev.com/c/3668287

Diff Detail

Event Timeline

ayzhao created this revision.May 25 2022, 3:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2022, 3:08 PM
ayzhao requested review of this revision.May 25 2022, 3:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2022, 3:08 PM
ayzhao updated this revision to Diff 432138.May 25 2022, 3:27 PM

fix commit message

ayzhao edited the summary of this revision. (Show Details)May 25 2022, 3:28 PM
ayzhao updated this revision to Diff 432147.May 25 2022, 4:25 PM

add newline at end of file

epastor added inline comments.May 25 2022, 6:35 PM
llvm/test/tools/llvm-ml/invalid_file_extension.blah
2

While we're at it, mind testing the /Ta option as well, which is supposed to allow assembly of any file regardless of extension?

I think you can just add another RUN line here using /Ta, and use a different CHECK suffix to distinguish the results.

ayzhao updated this revision to Diff 432162.May 25 2022, 7:04 PM

Fix the /Ta flag and add a test for it.

ayzhao edited the summary of this revision. (Show Details)May 25 2022, 7:04 PM
ayzhao marked an inline comment as done.
ayzhao added inline comments.
llvm/test/tools/llvm-ml/invalid_file_extension.blah
2

Done.

Incidentally, this exposed a bug in the implementation of /Ta, which I fixed.

epastor accepted this revision.May 25 2022, 7:08 PM
epastor added inline comments.
llvm/test/tools/llvm-ml/invalid_file_extension.blah
2

Thank you!

This revision is now accepted and ready to land.May 25 2022, 7:08 PM
This revision was landed with ongoing or failed builds.May 25 2022, 7:10 PM
This revision was automatically updated to reflect the committed changes.
ayzhao marked an inline comment as done.
hans added a subscriber: hans.May 30 2022, 6:48 AM

It appears to me that MASM doesn't care much about the file extension at all:

C:\src\tmp>type a.blah
.code

main proc
  ret
main endp

END
C:\src\tmp>ml64 a.blah /link /entry:main
Microsoft (R) Macro Assembler (x64) Version 14.28.29336.0
Copyright (C) Microsoft Corporation.  All rights reserved.

 Assembling: a.blah
Microsoft (R) Incremental Linker Version 14.28.29336.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/OUT:a.exe
a.obj
/entry:main

The fact that /Ta exists suggest maybe it did care at some point, but that may have changed.

epastor added a comment.EditedMay 31 2022, 7:08 AM

It appears to me that MASM doesn't care much about the file extension at all:

[test results omitted]

The fact that /Ta exists suggest maybe it did care at some point, but that may have changed.

Thanks for doing the testing! Sounds like something we should match them on, then... /Ta will still be useful when on systems where a filename could start with a /, so we shouldn't make it a no-op, but otherwise let's remove the extension restriction.

(Assuming this still holds for ml.exe, as well as ml64.exe... they do have different behavior sometimes.)

ayzhao added a comment.Jun 2 2022, 5:07 PM

It appears to me that MASM doesn't care much about the file extension at all:

[test results omitted]

The fact that /Ta exists suggest maybe it did care at some point, but that may have changed.

Thanks for doing the testing! Sounds like something we should match them on, then... /Ta will still be useful when on systems where a filename could start with a /, so we shouldn't make it a no-op, but otherwise let's remove the extension restriction.

(Assuming this still holds for ml.exe, as well as ml64.exe... they do have different behavior sometimes.)

D126931 removes all file extension restrictions.