Skip to content

Commit

Permalink
Add proper armasm[64] support for MSVC toolchain
Browse files Browse the repository at this point in the history
armasm and armasm64, the MSVC toolchain's assemblers for arm and arm64
respectively, have completely different invocations than their ml and
ml64 counterparts targetting x86 and x86-64.

Here's the full output of armasm's help:
```
cmd> armasm64 -h
Microsoft (R) ARM Macro Assembler Version 14.23.28106.4 for 64 bits
Copyright (C) Microsoft Corporation.  All rights reserved.

 Usage:      armasm [<options>] sourcefile objectfile
             armasm [<options>] -o objectfile sourcefile
             armasm -h              for help

<options>:            (Upper case shows allowable abbreviation)
  -Errors     errorsfile       redirect stderr diagnostics to errorsfile
  -I          dir[;dir]        add dirs to include search path
  -PreDefine  directive        pre-execute a SET{L,A,S} directive
  -NOWarn                      turn off warning messages
  -ignore <warning-num>        don't report warning-num
  -Help                        help (this information)
  -via <file>                  read further arguments from <file>
  -machine <machine>           set the PE machine type field
  -g                           generate debugging info
  -gh:SHA_256                  use SHA256 for file checksum in debug info (experimental)
  -errorReport:<option>        report internal assembler errors to Microsoft
      none - do not send report
      prompt - prompt to immediately send report
      queue - at next admin logon, prompt to send report (default)
      send - send report automatically

<machine>:  ARM64
```
  • Loading branch information
janisozaur committed Nov 14, 2019
1 parent 8fbb25a commit 7f68044
Showing 1 changed file with 31 additions and 15 deletions.
46 changes: 31 additions & 15 deletions src/tools/msvc.jam
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Copyright (c) 2007-2017 Rene Rivera
# Copyright (c) 2008 Jurko Gospodnetic
# Copyright (c) 2014 Microsoft Corporation
# Copyright (c) 2019 Michał Janiszewski
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
Expand Down Expand Up @@ -561,15 +562,9 @@ rule compile.asm ( targets + : sources * : properties * )
set-setup-command $(targets) : $(properties) ;
}

# For the assembler the following options are turned on by default:
#
# -Zp4 align structures to 4 bytes
# -Cp preserve case of user identifiers
# -Cx preserve case in publics, externs
#
actions compile.asm
{
$(.SETUP) $(.ASM) -c -Zp4 -Cp -Cx -D$(DEFINES) $(ASMFLAGS) $(USER_ASMFLAGS) -Fo "$(<:W)" "$(>:W)"
$(.SETUP) $(.ASM) -D$(ASMDEFINES) $(ASMFLAGS) $(USER_ASMFLAGS) $(.ASM_OUTPUT) "$(<:W)" "$(>:W)"
}


Expand Down Expand Up @@ -1473,9 +1468,27 @@ local rule configure-really ( version ? : options * )
local default-assembler-amd64 = ml64 ;
local default-assembler-i386 = "ml -coff" ;
local default-assembler-ia64 = ias ;
local default-assembler-ia64 = armasm ;
local default-assembler-arm = armasm ;
local default-assembler-arm64 = armasm64 ;

# For the assembler the following options are turned on by default:
#
# -Zp4 align structures to 4 bytes
# -Cp preserve case of user identifiers
# -Cx preserve case in publics, externs
#
local assembler-flags-amd64 = "-c -Zp4 -Cp -Cx" ;
local assembler-flags-i386 = "-c -Zp4 -Cp -Cx" ;
local assembler-flags-ia64 = "-c -Zp4 -Cp -Cx" ;
local assembler-flags-arm = "" ;
local assembler-flags-arm64 = "" ;

local assembler-output-flag-amd64 = -Fo ;
local assembler-output-flag-i386 = -Fo ;
local assembler-output-flag-ia64 = -Fo ;
local assembler-output-flag-arm = -o ;
local assembler-output-flag-arm64 = -o ;

assembler = [ feature.get-values <assembler> : $(options) ] ;

idl-compiler = [ feature.get-values <idl-compiler> : $(options) ] ;
Expand Down Expand Up @@ -1507,6 +1520,8 @@ local rule configure-really ( version ? : options * )

local cpu-assembler = $(assembler) ;
cpu-assembler ?= $(default-assembler-$(c)) ;
local assembler-flags = $(assembler-flags-$(c)) ;
local assembler-output-flag = $(assembler-output-flag-$(c)) ;

for local api in desktop store phone
{
Expand Down Expand Up @@ -1548,7 +1563,8 @@ local rule configure-really ( version ? : options * )
{
toolset.flags msvc.compile .CC <windows-api>$(api)/$(cpu-conditions) : $(compiler) /Zm800 /ZW /EHsc -nologo ;
}
toolset.flags msvc.compile .ASM <windows-api>$(api)/$(cpu-conditions) : $(cpu-assembler) -nologo ;
toolset.flags msvc.compile .ASM <windows-api>$(api)/$(cpu-conditions) : $(cpu-assembler) $(assembler-flags) -nologo ;
toolset.flags msvc.compile .ASM_OUTPUT <windows-api>$(api)/$(cpu-conditions) : $(assembler-output-flag) ;
toolset.flags msvc.link .LD <windows-api>$(api)/$(cpu-conditions) : $(linker) /NOLOGO "/INCREMENTAL:NO" ;
toolset.flags msvc.archive .LD <windows-api>$(api)/$(cpu-conditions) : $(linker) /lib /NOLOGO ;
}
Expand Down Expand Up @@ -1861,14 +1877,14 @@ local rule register-toolset-really ( )
# Declare flags for the assembler.
toolset.flags msvc.compile.asm USER_ASMFLAGS <asmflags> ;

toolset.flags msvc.compile.asm ASMFLAGS <debug-symbols>on : "/Zi /Zd" ;
toolset.flags msvc.compile.asm ASMFLAGS <architecture>x86/<debug-symbols>on : "/Zi /Zd" ;

toolset.flags msvc.compile.asm ASMFLAGS <warnings>on : /W3 ;
toolset.flags msvc.compile.asm ASMFLAGS <warnings>off : /W0 ;
toolset.flags msvc.compile.asm ASMFLAGS <warnings>all : /W4 ;
toolset.flags msvc.compile.asm ASMFLAGS <warnings-as-errors>on : /WX ;
toolset.flags msvc.compile.asm ASMFLAGS <architecture>x86/<warnings>on : /W3 ;
toolset.flags msvc.compile.asm ASMFLAGS <architecture>x86/<warnings>off : /W0 ;
toolset.flags msvc.compile.asm ASMFLAGS <architecture>x86/<warnings>all : /W4 ;
toolset.flags msvc.compile.asm ASMFLAGS <architecture>x86/<warnings-as-errors>on : /WX ;

toolset.flags msvc.compile.asm DEFINES <define> ;
toolset.flags msvc.compile.asm ASMDEFINES <architecture>x86 : <define> ;

# Declare flags for linking.
{
Expand Down

0 comments on commit 7f68044

Please sign in to comment.