Skip to content

Commit a24edde

Browse files
committed
nasm windows assembler
1 parent f470b7c commit a24edde

12 files changed

Lines changed: 139 additions & 17 deletions

File tree

.github/workflows/jsource.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,6 +1103,7 @@ jobs:
11031103
- name: Build JE (Windows)
11041104
shell: cmd
11051105
env:
1106+
NASM: $GITHUB_WORKSPACE/openssl-asm/nasm
11061107
USE_PYXES: 1
11071108
USE_EMU_AVX: 1
11081109
run: |
@@ -1152,6 +1153,7 @@ jobs:
11521153
- name: Build JE (Windows 32)
11531154
shell: cmd
11541155
env:
1156+
NASM: $GITHUB_WORKSPACE/openssl-asm/nasm
11551157
USE_PYXES: 0
11561158
USE_EMU_AVX: 0
11571159
run: |
@@ -1323,6 +1325,7 @@ jobs:
13231325
CC: x86_64-w64-mingw32-gcc
13241326
CXX: x86_64-w64-mingw32-g++
13251327
WINDRES: windres
1328+
NASM: $GITHUB_WORKSPACE/openssl-asm/nasm
13261329
USE_SLEEF: 1
13271330
USE_OPENMP: 0
13281331
USE_PYXES: 1
@@ -1379,6 +1382,7 @@ jobs:
13791382
CC: i686-w64-mingw32-gcc
13801383
CXX: i686-w64-mingw32-g++
13811384
WINDRES: windres
1385+
NASM: $GITHUB_WORKSPACE/openssl-asm/nasm
13821386
USE_SLEEF: 1
13831387
USE_OPENMP: 0
13841388
USE_PYXES: 0

make2/build_jamalgam.sh

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ if [ "" = "$CFLAGS" ]; then
3030
*)
3131
OPTLEVEL=" -O2 "
3232
DEBUG=0
33+
NASM_FLAGS=""
3334
;;
3435
esac
3536
else
@@ -471,6 +472,20 @@ else
471472
openssl/sha/asm/sha256-armv8-ios.o \
472473
openssl/sha/asm/sha512-armv8-ios.o "
473474

475+
SRC_ASM_WIN=" \
476+
openssl/sha/asm/md5-x86_64-nasm.o \
477+
openssl/sha/asm/keccak1600-x86_64-nasm.o \
478+
openssl/sha/asm/sha1-x86_64-nasm.o \
479+
openssl/sha/asm/sha256-x86_64-nasm.o \
480+
openssl/sha/asm/sha512-x86_64-nasm.o "
481+
482+
SRC_ASM_WIN32=" \
483+
openssl/sha/asm/md5-586-nasm.o \
484+
openssl/sha/asm/keccak1600-mmx-nasm.o \
485+
openssl/sha/asm/sha1-586-nasm.o \
486+
openssl/sha/asm/sha256-586-nasm.o \
487+
openssl/sha/asm/sha512-586-nasm.o "
488+
474489
OBJS_ASM_WIN=" \
475490
../openssl-asm/md5-x86_64-nasm.o \
476491
../openssl-asm/keccak1600-x86_64-nasm.o \
@@ -783,8 +798,9 @@ case "$jplatform/$j64x" in
783798
fi
784799
LIBJRES=" ../makevs/jconsole/jconsole.res "
785800
OBJS_AESNI=" aes-ni.o "
786-
SRC_ASM=""
787-
OBJS_ASM="${OBJS_ASM_WIN32}"
801+
SRC_ASM="${SRC_ASM_WIN32}"
802+
OBJS_ASM=""
803+
NASM_FLAGS="$NASM_FLAGS -fwin32"
788804
GASM_FLAGS=""
789805
FLAGS_BASE64=""
790806
;;
@@ -836,7 +852,8 @@ case "$jplatform/$j64x" in
836852
OBJS_FMA=" blis/gemm_int-fma.o "
837853
OBJS_AESNI=" aes-ni.o "
838854
SRC_ASM="${SRC_ASM_WIN}"
839-
OBJS_ASM="${OBJS_ASM_WIN}"
855+
OBJS_ASM=""
856+
NASM_FLAGS="$NASM_FLAGS -fwin64"
840857
GASM_FLAGS=""
841858
FLAGS_BASE64=" -DHAVE_AVX512F=1 "
842859
;;
@@ -863,7 +880,8 @@ case "$jplatform/$j64x" in
863880
OBJS_FMA=" blis/gemm_int-fma.o "
864881
OBJS_AESNI=" aes-ni.o "
865882
SRC_ASM="${SRC_ASM_WIN}"
866-
OBJS_ASM="${OBJS_ASM_WIN}"
883+
OBJS_ASM=""
884+
NASM_FLAGS="$NASM_FLAGS -fwin64"
867885
GASM_FLAGS=""
868886
FLAGS_BASE64=" -DHAVE_AVX2=1 "
869887
;;
@@ -888,7 +906,8 @@ case "$jplatform/$j64x" in
888906
LIBJRES=" ../makevs/jconsole/jconsole.res "
889907
OBJS_AESNI=" aes-ni.o "
890908
SRC_ASM="${SRC_ASM_WIN}"
891-
OBJS_ASM="${OBJS_ASM_WIN}"
909+
OBJS_ASM=""
910+
NASM_FLAGS="$NASM_FLAGS -fwin64"
892911
GASM_FLAGS=""
893912
FLAGS_BASE64=""
894913
;;

make2/build_libj.sh

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ if [ "" = "$CFLAGS" ]; then
3333
*)
3434
OPTLEVEL=" -O2 "
3535
DEBUG=0
36+
NASM_FLAGS=""
3637
;;
3738
esac
3839
else
@@ -421,6 +422,20 @@ else
421422
openssl/sha/asm/sha256-armv8-ios.o \
422423
openssl/sha/asm/sha512-armv8-ios.o "
423424

425+
SRC_ASM_WIN=" \
426+
openssl/sha/asm/md5-x86_64-nasm.o \
427+
openssl/sha/asm/keccak1600-x86_64-nasm.o \
428+
openssl/sha/asm/sha1-x86_64-nasm.o \
429+
openssl/sha/asm/sha256-x86_64-nasm.o \
430+
openssl/sha/asm/sha512-x86_64-nasm.o "
431+
432+
SRC_ASM_WIN32=" \
433+
openssl/sha/asm/md5-586-nasm.o \
434+
openssl/sha/asm/keccak1600-mmx-nasm.o \
435+
openssl/sha/asm/sha1-586-nasm.o \
436+
openssl/sha/asm/sha256-586-nasm.o \
437+
openssl/sha/asm/sha512-586-nasm.o "
438+
424439
OBJS_ASM_WIN=" \
425440
../openssl-asm/md5-x86_64-nasm.o \
426441
../openssl-asm/keccak1600-x86_64-nasm.o \
@@ -744,8 +759,9 @@ case "$jplatform/$j64x" in
744759
fi
745760
LIBJRES=" ../dllsrc/jdll.res "
746761
OBJS_AESNI=" aes-ni.o "
747-
SRC_ASM=""
748-
OBJS_ASM="${OBJS_ASM_WIN32}"
762+
SRC_ASM="${SRC_ASM_WIN32}"
763+
OBJS_ASM=""
764+
NASM_FLAGS="$NASM_FLAGS -fwin32"
749765
GASM_FLAGS=""
750766
FLAGS_BASE64=""
751767
;;
@@ -798,7 +814,8 @@ case "$jplatform/$j64x" in
798814
OBJS_AESNI=" aes-ni.o "
799815
OBJS_SIMDUTF8="${OBJS_SIMDUTF8_ASM}"
800816
SRC_ASM="${SRC_ASM_WIN}"
801-
OBJS_ASM="${OBJS_ASM_WIN}"
817+
OBJS_ASM=""
818+
NASM_FLAGS="$NASM_FLAGS -fwin64"
802819
GASM_FLAGS=""
803820
FLAGS_BASE64=" -DHAVE_AVX512F=1 "
804821
;;
@@ -825,7 +842,8 @@ case "$jplatform/$j64x" in
825842
OBJS_FMA=" blis/gemm_int-fma.o "
826843
OBJS_AESNI=" aes-ni.o "
827844
SRC_ASM="${SRC_ASM_WIN}"
828-
OBJS_ASM="${OBJS_ASM_WIN}"
845+
OBJS_ASM=""
846+
NASM_FLAGS="$NASM_FLAGS -fwin64"
829847
GASM_FLAGS=""
830848
FLAGS_BASE64=" -DHAVE_AVX2=1 "
831849
;;
@@ -850,7 +868,8 @@ case "$jplatform/$j64x" in
850868
LIBJRES=" ../dllsrc/jdll.res "
851869
OBJS_AESNI=" aes-ni.o "
852870
SRC_ASM="${SRC_ASM_WIN}"
853-
OBJS_ASM="${OBJS_ASM_WIN}"
871+
OBJS_ASM=""
872+
NASM_FLAGS="$NASM_FLAGS -fwin64"
854873
GASM_FLAGS=""
855874
FLAGS_BASE64=""
856875
;;

make2/makefile-jamalgam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ OBJS= \
182182
$(CC) $(GASM_FLAGS) -c -o $@ $<
183183

184184
%.o: %.asm
185-
nasm $(NASM_FLAGS) -felf64 -o $@ $<
185+
$(NASM) $(NASM_FLAGS) -o $@ $<
186186

187187
$(OBJS_FMA) : CFLAGS_FMA := -mfma
188188
$(OBJS_AESNI) : CFLAGS_AESNI := -maes

make2/makefile-libj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ OBJS= \
179179
$(CC) $(GASM_FLAGS) -c -o $@ $<
180180

181181
%.o: %.asm
182-
nasm $(NASM_FLAGS) -felf64 -o $@ $<
182+
$(NASM) $(NASM_FLAGS) -o $@ $<
183183

184184
$(OBJS_FMA) : CFLAGS_FMA := -mfma
185185
$(OBJS_AESNI) : CFLAGS_AESNI := -maes

makemsvc/jamalgam/makefile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,15 @@ else ifeq (x64,$(TARGET_CPU))
111111
CFLAGS = $(COPTION) $(CINCLUDE) /D JAMALGAM /DC_NA=0 /WX /W3 /O2 /GS- /Zc:strictStrings /D_USING_V110_SDK71_ /D_CRT_SECURE_NO_WARNINGS /MT $(CF1)
112112
FLAGS = $(LDEBUG) /NOLOGO /STACK:0xc00000 /MACHINE:X64 /SUBSYSTEM:CONSOLE,5.02
113113
ASMFLAGS = /Cx
114+
NASM_FLAGS = -fwin64
114115
else
115116
CF1 = -m32 -maes -msse2 -fno-strict-aliasing -Wno-unknown-warning-option -Wsign-compare -Wno-int-conversion -Wno-incompatible-function-pointer-types -Wno-parentheses -Wno-unused-variable -Wno-pointer-sign -Wno-missing-braces -Wno-missing-field-initializers -Wno-null-pointer-arithmetic -Wno-char-subscripts -Wno-pointer-to-int-cast -Wno-unused-but-set-variable -Wno-unused-value -Wno-unused-function -Wno-empty-body -Wno-sometimes-uninitialized -Wno-string-plus-int -Wno-unknown-pragmas -Wno-delete-non-abstract-non-virtual-dtor -Wno-deprecated-non-prototype -Wno-unused-variable
116117
# /Og fail g310r
117118
# /Oy crash ]^:_"1[0
118119
CFLAGS = $(COPTION) $(CINCLUDE) /D JAMALGAM /WX /W3 /O2 /GS- /Zc:strictStrings /D_USING_V110_SDK71_ /D_CRT_SECURE_NO_WARNINGS /MT $(CF1)
119120
FLAGS = $(LDEBUG) psapi.lib /NOLOGO /STACK:0xc00000 /MACHINE:X86 /SUBSYSTEM:CONSOLE,5.01
120121
ASMFLAGS = /Cx /coff
122+
NASM_FLAGS = -fwin32
121123
endif
122124

123125
.SUFFIXES: .o
@@ -315,13 +317,27 @@ else ifeq (arm64,$(TARGET_CPU))
315317
../openssl-asm/sha256-armv8-nasm.o \
316318
../openssl-asm/sha512-armv8-nasm.o
317319
else ifeq (x64,$(TARGET_CPU))
320+
SRC_ASM= \
321+
openssl/sha/asm/md5-x86_64-nasm.o \
322+
openssl/sha/asm/keccak1600-x86_64-nasm.o \
323+
openssl/sha/asm/sha1-x86_64-nasm.o \
324+
openssl/sha/asm/sha256-x86_64-nasm.o \
325+
openssl/sha/asm/sha512-x86_64-nasm.o
326+
318327
OBJS_ASM = \
319328
../openssl-asm/md5-x86_64-nasm.o \
320329
../openssl-asm/keccak1600-x86_64-nasm.o \
321330
../openssl-asm/sha1-x86_64-nasm.o \
322331
../openssl-asm/sha256-x86_64-nasm.o \
323332
../openssl-asm/sha512-x86_64-nasm.o
324333
else
334+
SRC_ASM= \
335+
openssl/sha/asm/md5-586-nasm.o \
336+
openssl/sha/asm/keccak1600-mmx-nasm.o \
337+
openssl/sha/asm/sha1-586-nasm.o \
338+
openssl/sha/asm/sha256-586-nasm.o \
339+
openssl/sha/asm/sha512-586-nasm.o
340+
325341
OBJS_ASM = \
326342
../openssl-asm/md5-586-nasm.o \
327343
../openssl-asm/keccak1600-mmx-nasm.o \
@@ -348,14 +364,18 @@ ifndef LD
348364
LD = lld-link
349365
endif
350366

367+
ifndef NASM
368+
NASM = nasm
369+
endif
370+
351371
%.o : %.c
352372
$(CC) $(CFLAGS) $(CFLAGS1) /Fo$@ /c $<
353373

354374
%.o : %.cpp
355375
$(CC) $(CFLAGS) /Fo$@ /c $<
356376

357377
%.o : %.asm
358-
$(ML) $(ASMFLAGS) /Fo$@ /c $<
378+
$(NASM) $(NASM_FLAGS) -o $@ $<
359379

360380
%.res : %.rc
361381
$(RC) /L 0x409 /D_USING_V110_SDK71_ -R -FO$@ $<

makemsvc/jamalgam/makefile.win

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,15 @@ CF1 = -maes -msse3 -fno-strict-aliasing -Wno-unknown-warning-option -Wsign-compa
109109
CFLAGS = $(COPTION) $(CINCLUDE) /D_JDLL /DC_NA=0 /WX /W3 /O2 /GS- /Zc:strictStrings /D_USING_V110_SDK71_ /D_CRT_SECURE_NO_WARNINGS /MT $(CF1)
110110
FLAGS = $(LDEBUG) /NOLOGO /STACK:0xc00000 /MACHINE:X64 /SUBSYSTEM:CONSOLE,5.02
111111
ASMFLAGS = /Cx
112+
NASM_FLAGS = -fwin64
112113
!else
113114
CF1 = -m32 -maes -msse2 -fno-strict-aliasing -Wno-unknown-warning-option -Wsign-compare -Wno-int-conversion -Wno-incompatible-function-pointer-types -Wno-parentheses -Wno-unused-variable -Wno-pointer-sign -Wno-missing-braces -Wno-missing-field-initializers -Wno-null-pointer-arithmetic -Wno-char-subscripts -Wno-pointer-to-int-cast -Wno-unused-but-set-variable -Wno-unused-value -Wno-unused-function -Wno-empty-body -Wno-sometimes-uninitialized -Wno-string-plus-int -Wno-unknown-pragmas -Wno-delete-non-abstract-non-virtual-dtor -Wno-deprecated-non-prototype -Wno-unused-variable
114115
# /Og fail g310r
115116
# /Oy crash ]^:_"1[0
116117
CFLAGS = $(COPTION) $(CINCLUDE) $(DPYXES) /D_JDLL /WX /W3 /O2 /GS- /Zc:strictStrings /D_USING_V110_SDK71_ /D_CRT_SECURE_NO_WARNINGS /MT $(CF1)
117118
FLAGS = $(LDEBUG) psapi.lib /NOLOGO /STACK:0xc00000 /MACHINE:X86 /SUBSYSTEM:CONSOLE,5.01
118119
ASMFLAGS = /Cx /coff
120+
NASM_FLAGS = -fwin32
119121
!endif
120122

121123
.SUFFIXES: .o
@@ -313,13 +315,27 @@ OBJS_ASM = \
313315
../openssl-asm/sha256-armv8-nasm.o \
314316
../openssl-asm/sha512-armv8-nasm.o
315317
!elseif "x64"=="$(TARGET_CPU)"
318+
SRC_ASM= \
319+
openssl/sha/asm/md5-x86_64-nasm.o \
320+
openssl/sha/asm/keccak1600-x86_64-nasm.o \
321+
openssl/sha/asm/sha1-x86_64-nasm.o \
322+
openssl/sha/asm/sha256-x86_64-nasm.o \
323+
openssl/sha/asm/sha512-x86_64-nasm.o
324+
316325
OBJS_ASM = \
317326
../openssl-asm/md5-x86_64-nasm.o \
318327
../openssl-asm/keccak1600-x86_64-nasm.o \
319328
../openssl-asm/sha1-x86_64-nasm.o \
320329
../openssl-asm/sha256-x86_64-nasm.o \
321330
../openssl-asm/sha512-x86_64-nasm.o
322331
!else
332+
SRC_ASM= \
333+
openssl/sha/asm/md5-586-nasm.o \
334+
openssl/sha/asm/keccak1600-mmx-nasm.o \
335+
openssl/sha/asm/sha1-586-nasm.o \
336+
openssl/sha/asm/sha256-586-nasm.o \
337+
openssl/sha/asm/sha512-586-nasm.o
338+
323339
OBJS_ASM = \
324340
../openssl-asm/md5-586-nasm.o \
325341
../openssl-asm/keccak1600-mmx-nasm.o \
@@ -346,14 +362,18 @@ RCS = ../makevs/jconsole/jconsole.res
346362
LD = lld-link
347363
!endif
348364

365+
!ifndef NASM
366+
NASM = nasm
367+
!endif
368+
349369
.c.o:
350370
$(CC) $(CFLAGS) $(CFLAGS1) /Fo$@ /c $<
351371

352372
.cpp.o:
353373
$(CC) $(CFLAGS) /Fo$@ /c $<
354374

355375
.asm.o:
356-
$(ML) $(ASMFLAGS) /Fo$@ /c $<
376+
$(NASM) $(NASM_FLAGS) -o $@ $<
357377

358378
.rc.res:
359379
$(RC) /L 0x409 /D_USING_V110_SDK71_ -R -FO$@ $<

makemsvc/jdll/makefile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,15 @@ else ifeq (x64,$(TARGET_CPU))
106106
CFLAGS = $(COPTION) $(CINCLUDE) /D_JDLL /DC_NA=0 /WX /W3 /O2 /GS- /Zc:strictStrings /D_USING_V110_SDK71_ /D_CRT_SECURE_NO_WARNINGS /MT $(CF1)
107107
FLAGS = $(LDEBUG) /DLL /MACHINE:X64 /SUBSYSTEM:WINDOWS,10.0
108108
ASMFLAGS = /Cx
109+
NASM_FLAGS = -fwin64
109110
else
110111
CF1 = -m32 -maes -msse2 -fno-strict-aliasing -Wno-unknown-warning-option -Wsign-compare -Wno-int-conversion -Wno-incompatible-function-pointer-types -Wno-parentheses -Wno-unused-variable -Wno-pointer-sign -Wno-missing-braces -Wno-missing-field-initializers -Wno-null-pointer-arithmetic -Wno-char-subscripts -Wno-pointer-to-int-cast -Wno-unused-but-set-variable -Wno-unused-value -Wno-unused-function -Wno-empty-body -Wno-sometimes-uninitialized -Wno-string-plus-int -Wno-unknown-pragmas -Wno-delete-non-abstract-non-virtual-dtor -Wno-deprecated-non-prototype -Wno-unused-variable
111112
# /Og fail g310r
112113
# /Oy crash ]^:_"1[0
113114
CFLAGS = $(COPTION) $(CINCLUDE) /D_JDLL /WX /W3 /O2 /GS- /Zc:strictStrings /D_USING_V110_SDK71_ /D_CRT_SECURE_NO_WARNINGS /MT $(CF1)
114115
FLAGS = $(LDEBUG) psapi.lib /DLL /MACHINE:X86 /SUBSYSTEM:WINDOWS,5.01
115116
ASMFLAGS = /Cx /coff
117+
NASM_FLAGS = -fwin32
116118
endif
117119

118120
.SUFFIXES: .o .S
@@ -308,13 +310,27 @@ else ifeq (arm64,$(TARGET_CPU))
308310
../openssl-asm/sha256-armv8-nasm.o \
309311
../openssl-asm/sha512-armv8-nasm.o
310312
else ifeq (x64,$(TARGET_CPU))
313+
SRC_ASM= \
314+
openssl/sha/asm/md5-x86_64-nasm.o \
315+
openssl/sha/asm/keccak1600-x86_64-nasm.o \
316+
openssl/sha/asm/sha1-x86_64-nasm.o \
317+
openssl/sha/asm/sha256-x86_64-nasm.o \
318+
openssl/sha/asm/sha512-x86_64-nasm.o
319+
311320
OBJS_ASM = \
312321
../openssl-asm/md5-x86_64-nasm.o \
313322
../openssl-asm/keccak1600-x86_64-nasm.o \
314323
../openssl-asm/sha1-x86_64-nasm.o \
315324
../openssl-asm/sha256-x86_64-nasm.o \
316325
../openssl-asm/sha512-x86_64-nasm.o
317326
else
327+
SRC_ASM= \
328+
openssl/sha/asm/md5-586-nasm.o \
329+
openssl/sha/asm/keccak1600-mmx-nasm.o \
330+
openssl/sha/asm/sha1-586-nasm.o \
331+
openssl/sha/asm/sha256-586-nasm.o \
332+
openssl/sha/asm/sha512-586-nasm.o
333+
318334
OBJS_ASM = \
319335
../openssl-asm/md5-586-nasm.o \
320336
../openssl-asm/keccak1600-mmx-nasm.o \
@@ -336,6 +352,10 @@ ifndef LD
336352
LD = lld-link
337353
endif
338354

355+
ifndef NASM
356+
NASM = nasm
357+
endif
358+
339359
%.o : %.c
340360
$(CC) $(CFLAGS) $(CFLAGS1) /Fo$@ /c $<
341361

@@ -346,7 +366,7 @@ endif
346366
$(CC) $(CFLAGS) /Fo$@ /c $<
347367

348368
%.o : %.asm
349-
$(ML) $(ASMFLAGS) /Fo$@ /c $<
369+
$(NASM) $(NASM_FLAGS) -o $@ $<
350370

351371
%.res : %.rc
352372
$(RC) /L 0x409 /D_USING_V110_SDK71_ -R -FO$@ $<

0 commit comments

Comments
 (0)