[llvm-dev] LLVM + MASM (llvm-ml)

Eric Astor via llvm-dev llvm-dev at lists.llvm.org
Fri Oct 23 12:49:41 PDT 2020


In fact... I've just uploaded the follow-up commits to Phabricator that
switch llvm-ml to use Option.h and put basic command-line compatibility in
place. A lot of options aren't supported just yet - including that llvm-ml
doesn't include dispatch to a linker, so it will only work for /c builds.

The top of the current chain is here: https://reviews.llvm.org/D90061

Other contributions are welcome!

On Fri, Oct 23, 2020, 3:42 PM Nico Weber <thakis at chromium.org> wrote:

> On Fri, Oct 23, 2020 at 3:24 PM Martin Storsjö <martin at martin.st> wrote:
>
>> Hi,
>>
>> On Fri, 23 Oct 2020, Eric Astor via llvm-dev wrote:
>>
>> > Just a quick update on the llvm-ml project. As a refresher, this was a
>> > proposal to add native [MASM][1] support to LLVM's assembly
>> capabilities, as
>> > part of supporting cross-platform Windows compilation.
>> >
>> >    [1]:
>> https://docs.microsoft.com/en-us/cpp/assembler/masm/microsoft-macro-as
>> > sembler-reference?view=vs-2019
>> >
>> > A large set of directives are now supported, with a growing suite of
>> tests.
>> > After the next outstanding chain of commits ([tip][2]) adds macro
>> procedures
>> > and macro functions (including local symbols), this will include most
>> of the
>> > headline features for the language. (STRUCTs have been in place for some
>> > time now, including type inference for size-checking.) Features not yet
>> in
>> > place include:
>> >  *  RECORDs,
>> >  *  ASSUME,
>> >  *  the ALIGN/ORG/EVEN directives,
>> >  *  the GOTO directive (within macros),
>> >  *  anonymous labels, and
>> >  *  built-in macros (and the string-manipulation directives).
>> >     [2]: https://reviews.llvm.org/D89741
>> >
>> > Anyone else interested in reviewing some of the commits around this
>> project?
>>
>> I just recently got an interest in this project, when I tried building
>> the
>> OpenMP runtimes for windows - and they contain one source file in MASM
>> format.
>>
>> From very brief attempts at assembling the source file [1] with llvm-ml
>> noticed that it lacked some sort of preprocessing that the source used,
>> among a few other issues.
>>
>> CMake also ends up adding a few parameters using forward slashes, while
>> it
>> seems like llvm-ml currently only accepts parameters with dashes.
>> Handling
>> both (like clang-cl and lld/COFF do, among others) probably would require
>> rewriting the option handling using the llvm/Option framework, like those
>> tools do.
>>
>
> Yes, this is a known TODO :)
>
>
>>
>> An example command for building it looks like this (in
>> llvm-project/openmp/build):
>>
>> <tool> -Domp_EXPORTS -Iruntime/src -I../runtime/src -I../runtime/src/i18n
>> -I../runtime/src/include -I../runtime/src/thirdparty/ittnotify -D
>> _CRT_SECURE_NO_WARNINGS -D _CRT_SECURE_NO_DEPRECATE -D _WINDOWS -D _WINNT
>> -D _WIN32_WINNT=0x0501 -D _USRDLL -win64 -D_M_AMD64 -DOMPT_SUPPORT=0 /c
>> /Fo runtime/src/CMakeFiles/omp.dir/z_Windows_NT-586_asm.asm.obj
>> ../runtime/src/z_Windows_NT-586_asm.asm
>>
>> When building for i386, you'd also see the parameters "/coff" and
>> "/safeseh" added on the command line [2].
>>
>> [1]
>> https://github.com/llvm/llvm-project/blob/master/openmp/runtime/src/z_Windows_NT-586_asm.asm
>>
>> [2]
>> https://github.com/llvm/llvm-project/blob/master/openmp/runtime/cmake/LibompHandleFlags.cmake#L74-L82
>>
>> // Martin
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201023/c507563b/attachment.html>


More information about the llvm-dev mailing list