diff options
author | Brent Cook <busterb@gmail.com> | 2024-02-27 07:18:09 -0600 |
---|---|---|
committer | Brent Cook <busterb@gmail.com> | 2024-02-27 07:18:09 -0600 |
commit | d8702f6951420d7641e02c04c8ce4db5762ddb07 (patch) | |
tree | b17ae03e53ed2befaf55883492bf1e293e2a7026 | |
parent | 53edbd00c12ee1d27f1b9533933b32781125c758 (diff) | |
download | portable-d8702f6951420d7641e02c04c8ce4db5762ddb07.tar.gz portable-d8702f6951420d7641e02c04c8ce4db5762ddb07.tar.bz2 portable-d8702f6951420d7641e02c04c8ce4db5762ddb07.zip |
upstreamed masm alignment fix
-rw-r--r-- | patches/asm/masm-align-64.patch | 30 | ||||
-rwxr-xr-x | update.sh | 12 |
2 files changed, 3 insertions, 39 deletions
diff --git a/patches/asm/masm-align-64.patch b/patches/asm/masm-align-64.patch deleted file mode 100644 index ba41c71..0000000 --- a/patches/asm/masm-align-64.patch +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | commit 3797e05de28ab07bb522898cbf022bdf67a71c99 | ||
2 | Author: Brent Cook <busterb@gmail.com> | ||
3 | Date: Sun Feb 4 22:53:59 2024 -0600 | ||
4 | |||
5 | align read-only sections on masm/windows to 64 bytes | ||
6 | |||
7 | Avoid conflicts where alignment is specified later in the underlying | ||
8 | assembly. | ||
9 | |||
10 | diff --git a/src/lib/libcrypto/perlasm/x86_64-xlate.pl b/src/lib/libcrypto/perlasm/x86_64-xlate.pl | ||
11 | index 5dbed2a8c..d8b607b5c 100755 | ||
12 | --- a/src/lib/libcrypto/perlasm/x86_64-xlate.pl | ||
13 | +++ b/src/lib/libcrypto/perlasm/x86_64-xlate.pl | ||
14 | @@ -567,7 +567,15 @@ my %globals; | ||
15 | $v.="$line\tSEGMENT"; | ||
16 | if ($line=~/\.([prx])data/) { | ||
17 | $v.=" READONLY"; | ||
18 | - $v.=" ALIGN(".($1 eq "p" ? 4 : 8).")" if ($masm>=$masmref); | ||
19 | + if ($masm>=$masmref) { | ||
20 | + if ($1 eq "r") { | ||
21 | + $v.=" ALIGN(64)"; | ||
22 | + } elsif ($1 eq "p") { | ||
23 | + $v.=" ALIGN(4)"; | ||
24 | + } else { | ||
25 | + $v.=" ALIGN(8)"; | ||
26 | + } | ||
27 | + } | ||
28 | } elsif ($line=~/\.CRT\$/i) { | ||
29 | $v.=" READONLY "; | ||
30 | $v.=$masm>=$masmref ? "ALIGN(8)" : "DWORD"; | ||
@@ -195,7 +195,7 @@ fixup_masm() { | |||
195 | } | 195 | } |
196 | 196 | ||
197 | # generate assembly crypto algorithms | 197 | # generate assembly crypto algorithms |
198 | asm_src=$CWD/asm | 198 | asm_src=$libcrypto_src |
199 | 199 | ||
200 | gen_asm_stdout() { | 200 | gen_asm_stdout() { |
201 | CC=true perl $asm_src/$2 $1 > crypto/$3.tmp | 201 | CC=true perl $asm_src/$2 $1 > crypto/$3.tmp |
@@ -210,6 +210,7 @@ gen_asm_stdout() { | |||
210 | $MV crypto/$3.tmp crypto/$3 | 210 | $MV crypto/$3.tmp crypto/$3 |
211 | fi | 211 | fi |
212 | } | 212 | } |
213 | |||
213 | gen_asm_mips() { | 214 | gen_asm_mips() { |
214 | abi=$1 | 215 | abi=$1 |
215 | dir=$2 | 216 | dir=$2 |
@@ -223,6 +224,7 @@ gen_asm_mips() { | |||
223 | EOF | 224 | EOF |
224 | mv $dst.S crypto/$dir/$dst.S | 225 | mv $dst.S crypto/$dir/$dst.S |
225 | } | 226 | } |
227 | |||
226 | gen_asm() { | 228 | gen_asm() { |
227 | CC=true perl $asm_src/$2 $1 crypto/$3.tmp | 229 | CC=true perl $asm_src/$2 $1 crypto/$3.tmp |
228 | [ $1 = "elf" ] && cat <<-EOF >> crypto/$3.tmp | 230 | [ $1 = "elf" ] && cat <<-EOF >> crypto/$3.tmp |
@@ -237,14 +239,6 @@ gen_asm() { | |||
237 | fi | 239 | fi |
238 | } | 240 | } |
239 | 241 | ||
240 | setup_asm_generator() { | ||
241 | rm -fr $asm_src | ||
242 | cp -a $libcrypto_src $asm_src | ||
243 | patch -d $asm_src -p4 < patches/asm/masm-align-64.patch | ||
244 | } | ||
245 | |||
246 | setup_asm_generator | ||
247 | |||
248 | echo generating mips ASM source for elf | 242 | echo generating mips ASM source for elf |
249 | gen_asm_mips o32 aes aes-mips aes-mips | 243 | gen_asm_mips o32 aes aes-mips aes-mips |
250 | gen_asm_mips o32 bn mips bn-mips | 244 | gen_asm_mips o32 bn mips bn-mips |