From e195c8a2562baef0fdcae330556ed60b1e922b0e Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Wed, 10 May 2017 14:24:56 -0400 Subject: [PATCH] Remove filename argument to x86 asm_init. The assembler already knows the actual path to the generated file and, in other perlasm architectures, is left to manage debug symbols itself. Notably, in OpenSSL 1.1.x's new build system, which allows a separate build directory, converting .pl to .s as the scripts currently do result in the wrong paths. This also avoids inconsistencies from some of the files using $0 and some passing in the filename. Reviewed-by: Richard Levitte Reviewed-by: Andy Polyakov (Merged from https://github.com/openssl/openssl/pull/3431) --- crypto/aes/asm/aes-586.pl | 2 +- crypto/aes/asm/aesni-x86.pl | 2 +- crypto/aes/asm/vpaes-x86.pl | 2 +- crypto/bf/asm/bf-586.pl | 2 +- crypto/bn/asm/bn-586.pl | 2 +- crypto/bn/asm/co-586.pl | 2 +- crypto/bn/asm/via-mont.pl | 2 +- crypto/bn/asm/x86-gf2m.pl | 2 +- crypto/bn/asm/x86-mont.pl | 2 +- crypto/bn/asm/x86.pl | 2 +- crypto/camellia/asm/cmll-x86.pl | 2 +- crypto/cast/asm/cast-586.pl | 2 +- crypto/chacha/asm/chacha-x86.pl | 2 +- crypto/des/asm/crypt586.pl | 2 +- crypto/des/asm/des-586.pl | 2 +- crypto/ec/asm/ecp_nistz256-x86.pl | 2 +- crypto/md5/asm/md5-586.pl | 2 +- crypto/modes/asm/ghash-x86.pl | 2 +- crypto/perlasm/README | 4 ++-- crypto/perlasm/x86asm.pl | 8 +++----- crypto/perlasm/x86gas.pl | 2 +- crypto/perlasm/x86masm.pl | 1 - crypto/poly1305/asm/poly1305-x86.pl | 2 +- crypto/rc4/asm/rc4-586.pl | 2 +- crypto/rc5/asm/rc5-586.pl | 2 +- crypto/ripemd/asm/rmd-586.pl | 2 +- crypto/sha/asm/sha1-586.pl | 2 +- crypto/sha/asm/sha256-586.pl | 2 +- crypto/sha/asm/sha512-586.pl | 2 +- crypto/whrlpool/asm/wp-mmx.pl | 2 +- crypto/x86cpuid.pl | 2 +- engines/asm/e_padlock-x86.pl | 2 +- ms/uplink-x86.pl | 2 +- 33 files changed, 35 insertions(+), 38 deletions(-) diff --git a/crypto/aes/asm/aes-586.pl b/crypto/aes/asm/aes-586.pl index 61bdce865c..51fde64dec 100755 --- a/crypto/aes/asm/aes-586.pl +++ b/crypto/aes/asm/aes-586.pl @@ -202,7 +202,7 @@ $output = pop; open OUT,">$output"; *STDOUT=*OUT; -&asm_init($ARGV[0],"aes-586.pl",$x86only = $ARGV[$#ARGV] eq "386"); +&asm_init($ARGV[0],$x86only = $ARGV[$#ARGV] eq "386"); &static_label("AES_Te"); &static_label("AES_Td"); diff --git a/crypto/aes/asm/aesni-x86.pl b/crypto/aes/asm/aesni-x86.pl index b1eca63519..81c1cd651b 100644 --- a/crypto/aes/asm/aesni-x86.pl +++ b/crypto/aes/asm/aesni-x86.pl @@ -80,7 +80,7 @@ $output = pop; open OUT,">$output"; *STDOUT=*OUT; -&asm_init($ARGV[0],$0); +&asm_init($ARGV[0]); &external_label("OPENSSL_ia32cap_P"); &static_label("key_const"); diff --git a/crypto/aes/asm/vpaes-x86.pl b/crypto/aes/asm/vpaes-x86.pl index d9157fa06d..7d57edc0eb 100644 --- a/crypto/aes/asm/vpaes-x86.pl +++ b/crypto/aes/asm/vpaes-x86.pl @@ -62,7 +62,7 @@ $output = pop; open OUT,">$output"; *STDOUT=*OUT; -&asm_init($ARGV[0],"vpaes-x86.pl",$x86only = $ARGV[$#ARGV] eq "386"); +&asm_init($ARGV[0],$x86only = $ARGV[$#ARGV] eq "386"); $PREFIX="vpaes"; diff --git a/crypto/bf/asm/bf-586.pl b/crypto/bf/asm/bf-586.pl index ebc24f48a1..4e913aecf4 100644 --- a/crypto/bf/asm/bf-586.pl +++ b/crypto/bf/asm/bf-586.pl @@ -15,7 +15,7 @@ require "cbc.pl"; $output = pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"bf-586.pl",$ARGV[$#ARGV] eq "386"); +&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386"); $BF_ROUNDS=16; $BF_OFF=($BF_ROUNDS+2)*4; diff --git a/crypto/bn/asm/bn-586.pl b/crypto/bn/asm/bn-586.pl index 1350bcd8fa..58effc8808 100644 --- a/crypto/bn/asm/bn-586.pl +++ b/crypto/bn/asm/bn-586.pl @@ -14,7 +14,7 @@ require "x86asm.pl"; $output = pop; open STDOUT,">$output"; -&asm_init($ARGV[0],$0); +&asm_init($ARGV[0]); $sse2=0; for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } diff --git a/crypto/bn/asm/co-586.pl b/crypto/bn/asm/co-586.pl index 6f34c37cf8..97f5e3a19f 100644 --- a/crypto/bn/asm/co-586.pl +++ b/crypto/bn/asm/co-586.pl @@ -13,7 +13,7 @@ require "x86asm.pl"; $output = pop; open STDOUT,">$output"; -&asm_init($ARGV[0],$0); +&asm_init($ARGV[0]); &bn_mul_comba("bn_mul_comba8",8); &bn_mul_comba("bn_mul_comba4",4); diff --git a/crypto/bn/asm/via-mont.pl b/crypto/bn/asm/via-mont.pl index 558501c315..94775d3f6c 100644 --- a/crypto/bn/asm/via-mont.pl +++ b/crypto/bn/asm/via-mont.pl @@ -91,7 +91,7 @@ require "x86asm.pl"; $output = pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"via-mont.pl"); +&asm_init($ARGV[0]); # int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_ULONG *np,const BN_ULONG *n0, int num); $func="bn_mul_mont_padlock"; diff --git a/crypto/bn/asm/x86-gf2m.pl b/crypto/bn/asm/x86-gf2m.pl index f464368733..562f539943 100644 --- a/crypto/bn/asm/x86-gf2m.pl +++ b/crypto/bn/asm/x86-gf2m.pl @@ -46,7 +46,7 @@ require "x86asm.pl"; $output = pop; open STDOUT,">$output"; -&asm_init($ARGV[0],$0,$x86only = $ARGV[$#ARGV] eq "386"); +&asm_init($ARGV[0],$x86only = $ARGV[$#ARGV] eq "386"); $sse2=0; for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } diff --git a/crypto/bn/asm/x86-mont.pl b/crypto/bn/asm/x86-mont.pl index a8b402d59b..9c495ca6da 100755 --- a/crypto/bn/asm/x86-mont.pl +++ b/crypto/bn/asm/x86-mont.pl @@ -40,7 +40,7 @@ require "x86asm.pl"; $output = pop; open STDOUT,">$output"; -&asm_init($ARGV[0],$0); +&asm_init($ARGV[0]); $sse2=0; for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } diff --git a/crypto/bn/asm/x86.pl b/crypto/bn/asm/x86.pl index d57571db5d..274099f6cf 100644 --- a/crypto/bn/asm/x86.pl +++ b/crypto/bn/asm/x86.pl @@ -20,7 +20,7 @@ require("x86/comba.pl"); $output = pop; open STDOUT,">$output"; -&asm_init($ARGV[0],$0); +&asm_init($ARGV[0]); &bn_mul_add_words("bn_mul_add_words"); &bn_mul_words("bn_mul_words"); diff --git a/crypto/camellia/asm/cmll-x86.pl b/crypto/camellia/asm/cmll-x86.pl index 26afad8c95..55af9b4e3d 100644 --- a/crypto/camellia/asm/cmll-x86.pl +++ b/crypto/camellia/asm/cmll-x86.pl @@ -52,7 +52,7 @@ $OPENSSL=1; $output = pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"cmll-586.pl",$ARGV[$#ARGV] eq "386"); +&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386"); @T=("eax","ebx","ecx","edx"); $idx="esi"; diff --git a/crypto/cast/asm/cast-586.pl b/crypto/cast/asm/cast-586.pl index 1fc2b1a309..d5d38965cf 100644 --- a/crypto/cast/asm/cast-586.pl +++ b/crypto/cast/asm/cast-586.pl @@ -21,7 +21,7 @@ require "cbc.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"cast-586.pl",$ARGV[$#ARGV] eq "386"); +&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386"); $CAST_ROUNDS=16; $L="edi"; diff --git a/crypto/chacha/asm/chacha-x86.pl b/crypto/chacha/asm/chacha-x86.pl index d606db8a61..e177a22242 100755 --- a/crypto/chacha/asm/chacha-x86.pl +++ b/crypto/chacha/asm/chacha-x86.pl @@ -43,7 +43,7 @@ require "x86asm.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"chacha-x86.pl",$ARGV[$#ARGV] eq "386"); +&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386"); $xmm=$ymm=0; for (@ARGV) { $xmm=1 if (/-DOPENSSL_IA32_SSE2/); } diff --git a/crypto/des/asm/crypt586.pl b/crypto/des/asm/crypt586.pl index ad89eeb085..391404727d 100644 --- a/crypto/des/asm/crypt586.pl +++ b/crypto/des/asm/crypt586.pl @@ -16,7 +16,7 @@ require "x86asm.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"crypt586.pl"); +&asm_init($ARGV[0]); $L="edi"; $R="esi"; diff --git a/crypto/des/asm/des-586.pl b/crypto/des/asm/des-586.pl index d45102c1da..4ce889c8ab 100644 --- a/crypto/des/asm/des-586.pl +++ b/crypto/des/asm/des-586.pl @@ -23,7 +23,7 @@ require "desboth.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"des-586.pl"); +&asm_init($ARGV[0]); $L="edi"; $R="esi"; diff --git a/crypto/ec/asm/ecp_nistz256-x86.pl b/crypto/ec/asm/ecp_nistz256-x86.pl index f637c844c4..a89a9f93bc 100755 --- a/crypto/ec/asm/ecp_nistz256-x86.pl +++ b/crypto/ec/asm/ecp_nistz256-x86.pl @@ -45,7 +45,7 @@ require "x86asm.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"ecp_nistz256-x86.pl",$ARGV[$#ARGV] eq "386"); +&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386"); $sse2=0; for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } diff --git a/crypto/md5/asm/md5-586.pl b/crypto/md5/asm/md5-586.pl index de5758f4c6..15e14864d1 100644 --- a/crypto/md5/asm/md5-586.pl +++ b/crypto/md5/asm/md5-586.pl @@ -21,7 +21,7 @@ require "x86asm.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],$0); +&asm_init($ARGV[0]); $A="eax"; $B="ebx"; diff --git a/crypto/modes/asm/ghash-x86.pl b/crypto/modes/asm/ghash-x86.pl index 66307ae304..5765e3fceb 100644 --- a/crypto/modes/asm/ghash-x86.pl +++ b/crypto/modes/asm/ghash-x86.pl @@ -139,7 +139,7 @@ require "x86asm.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"ghash-x86.pl",$x86only = $ARGV[$#ARGV] eq "386"); +&asm_init($ARGV[0],$x86only = $ARGV[$#ARGV] eq "386"); $sse2=0; for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } diff --git a/crypto/perlasm/README b/crypto/perlasm/README index e90bd8e014..3177c37165 100644 --- a/crypto/perlasm/README +++ b/crypto/perlasm/README @@ -9,7 +9,7 @@ require "x86asm.pl"; The first thing we do is setup the file and type of assembler -&asm_init($ARGV[0],$0); +&asm_init($ARGV[0]); The first argument is the 'type'. Currently 'cpp', 'sol', 'a.out', 'elf' or 'win32'. @@ -62,7 +62,7 @@ So a very simple version of this function could be coded as push(@INC,"perlasm","../../perlasm"); require "x86asm.pl"; - &asm_init($ARGV[0],"cacl.pl"); + &asm_init($ARGV[0]); &external_label("other"); diff --git a/crypto/perlasm/x86asm.pl b/crypto/perlasm/x86asm.pl index 1ff46c92cc..fef94b3076 100644 --- a/crypto/perlasm/x86asm.pl +++ b/crypto/perlasm/x86asm.pl @@ -8,7 +8,7 @@ # require 'x86asm.pl'; -# &asm_init(,"des-586.pl"[,$i386only]); +# &asm_init([,$i386only]); # &function_begin("foo"); # ... # &function_end("foo"); @@ -259,9 +259,8 @@ sub ::asm_finish } sub ::asm_init -{ my ($type,$fn,$cpu)=@_; +{ my ($type,$cpu)=@_; - $filename=$fn; $i386=$cpu; $elf=$cpp=$coff=$aout=$macosx=$win32=$netware=$mwerks=$android=0; @@ -301,8 +300,7 @@ EOF $pic=0; for (@ARGV) { $pic=1 if (/\-[fK]PIC/i); } - $filename =~ s/\.pl$//; - &file($filename); + &file(); } sub ::hidden {} diff --git a/crypto/perlasm/x86gas.pl b/crypto/perlasm/x86gas.pl index 2c8fce0779..5c7ea3880e 100644 --- a/crypto/perlasm/x86gas.pl +++ b/crypto/perlasm/x86gas.pl @@ -104,7 +104,7 @@ sub ::BC { @_; } sub ::DWC { @_; } sub ::file -{ push(@out,".file\t\"$_[0].s\"\n.text\n"); } +{ push(@out,".text\n"); } sub ::function_begin_B { my $func=shift; diff --git a/crypto/perlasm/x86masm.pl b/crypto/perlasm/x86masm.pl index d352f47055..dffee76211 100644 --- a/crypto/perlasm/x86masm.pl +++ b/crypto/perlasm/x86masm.pl @@ -85,7 +85,6 @@ sub ::DWC { "@_"; } sub ::file { my $tmp=<<___; -TITLE $_[0].asm IF \@Version LT 800 ECHO MASM version 8.00 or later is strongly recommended. ENDIF diff --git a/crypto/poly1305/asm/poly1305-x86.pl b/crypto/poly1305/asm/poly1305-x86.pl index 9db38b5ecc..b6f09bf737 100755 --- a/crypto/poly1305/asm/poly1305-x86.pl +++ b/crypto/poly1305/asm/poly1305-x86.pl @@ -50,7 +50,7 @@ require "x86asm.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"poly1305-x86.pl",$ARGV[$#ARGV] eq "386"); +&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386"); $sse2=$avx=0; for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } diff --git a/crypto/rc4/asm/rc4-586.pl b/crypto/rc4/asm/rc4-586.pl index 7d6f97c59e..ab16a97b68 100644 --- a/crypto/rc4/asm/rc4-586.pl +++ b/crypto/rc4/asm/rc4-586.pl @@ -73,7 +73,7 @@ require "x86asm.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"rc4-586.pl",$x86only = $ARGV[$#ARGV] eq "386"); +&asm_init($ARGV[0],$x86only = $ARGV[$#ARGV] eq "386"); $xx="eax"; $yy="ebx"; diff --git a/crypto/rc5/asm/rc5-586.pl b/crypto/rc5/asm/rc5-586.pl index e3e1c64242..e58a98bc83 100644 --- a/crypto/rc5/asm/rc5-586.pl +++ b/crypto/rc5/asm/rc5-586.pl @@ -15,7 +15,7 @@ require "cbc.pl"; $output = pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"rc5-586.pl"); +&asm_init($ARGV[0]); $RC5_MAX_ROUNDS=16; $RC5_32_OFF=($RC5_MAX_ROUNDS+2)*4; diff --git a/crypto/ripemd/asm/rmd-586.pl b/crypto/ripemd/asm/rmd-586.pl index f19fdc9f9a..72bcbcc9aa 100644 --- a/crypto/ripemd/asm/rmd-586.pl +++ b/crypto/ripemd/asm/rmd-586.pl @@ -19,7 +19,7 @@ require "x86asm.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],$0); +&asm_init($ARGV[0]); $A="ecx"; $B="esi"; diff --git a/crypto/sha/asm/sha1-586.pl b/crypto/sha/asm/sha1-586.pl index 59e115557a..8225e3a6f8 100644 --- a/crypto/sha/asm/sha1-586.pl +++ b/crypto/sha/asm/sha1-586.pl @@ -127,7 +127,7 @@ require "x86asm.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"sha1-586.pl",$ARGV[$#ARGV] eq "386"); +&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386"); $xmm=$ymm=0; for (@ARGV) { $xmm=1 if (/-DOPENSSL_IA32_SSE2/); } diff --git a/crypto/sha/asm/sha256-586.pl b/crypto/sha/asm/sha256-586.pl index 705de2a648..bc25b2dab5 100644 --- a/crypto/sha/asm/sha256-586.pl +++ b/crypto/sha/asm/sha256-586.pl @@ -76,7 +76,7 @@ require "x86asm.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"sha512-586.pl",$ARGV[$#ARGV] eq "386"); +&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386"); $xmm=$avx=0; for (@ARGV) { $xmm=1 if (/-DOPENSSL_IA32_SSE2/); } diff --git a/crypto/sha/asm/sha512-586.pl b/crypto/sha/asm/sha512-586.pl index 94017779a7..35006e8b9f 100644 --- a/crypto/sha/asm/sha512-586.pl +++ b/crypto/sha/asm/sha512-586.pl @@ -62,7 +62,7 @@ require "x86asm.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"sha512-586.pl",$ARGV[$#ARGV] eq "386"); +&asm_init($ARGV[0],$ARGV[$#ARGV] eq "386"); $sse2=0; for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } diff --git a/crypto/whrlpool/asm/wp-mmx.pl b/crypto/whrlpool/asm/wp-mmx.pl index d628d56506..468cae8032 100644 --- a/crypto/whrlpool/asm/wp-mmx.pl +++ b/crypto/whrlpool/asm/wp-mmx.pl @@ -59,7 +59,7 @@ require "x86asm.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"wp-mmx.pl"); +&asm_init($ARGV[0]); sub L() { &data_byte(@_); } sub LL() diff --git a/crypto/x86cpuid.pl b/crypto/x86cpuid.pl index 9d2f34eb8d..1266d7634c 100644 --- a/crypto/x86cpuid.pl +++ b/crypto/x86cpuid.pl @@ -14,7 +14,7 @@ $output = pop; open OUT,">$output"; *STDOUT=*OUT; -&asm_init($ARGV[0],"x86cpuid"); +&asm_init($ARGV[0]); for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } diff --git a/engines/asm/e_padlock-x86.pl b/engines/asm/e_padlock-x86.pl index bf6b312cd1..c4129e837a 100644 --- a/engines/asm/e_padlock-x86.pl +++ b/engines/asm/e_padlock-x86.pl @@ -45,7 +45,7 @@ require "x86asm.pl"; $output=pop; open STDOUT,">$output"; -&asm_init($ARGV[0],$0); +&asm_init($ARGV[0]); %PADLOCK_PREFETCH=(ecb=>128, cbc=>64); # prefetch errata $PADLOCK_CHUNK=512; # Must be a power of 2 larger than 16 diff --git a/ms/uplink-x86.pl b/ms/uplink-x86.pl index e25668ea35..440bf7d5f6 100755 --- a/ms/uplink-x86.pl +++ b/ms/uplink-x86.pl @@ -15,7 +15,7 @@ require "uplink-common.pl"; $output = pop; open STDOUT,">$output"; -&asm_init($ARGV[0],"uplink-x86"); +&asm_init($ARGV[0]); &external_label("OPENSSL_Uplink"); &public_label("OPENSSL_UplinkTable"); -- 2.39.2