diff options
| author | Brent Cook <busterb@gmail.com> | 2024-01-08 21:57:01 -0600 |
|---|---|---|
| committer | Brent Cook <busterb@gmail.com> | 2024-03-03 15:32:50 -0600 |
| commit | 12da3154297e16ae6e692c9fba1d7e66b037b195 (patch) | |
| tree | 45af5259d166c9119d8398c8c02cbd99500dcf1c | |
| parent | e7a9f266e68f9b3fa010f32d6cd8c48873b16016 (diff) | |
| download | portable-12da3154297e16ae6e692c9fba1d7e66b037b195.tar.gz portable-12da3154297e16ae6e692c9fba1d7e66b037b195.tar.bz2 portable-12da3154297e16ae6e692c9fba1d7e66b037b195.zip | |
align read only sections on masm/windows to 64 bytes
Avoid conflicts where alignment is specified later in the underlying
assembly.
| -rw-r--r-- | patches/asm/masm-align-64.patch | 30 | ||||
| -rwxr-xr-x | update.sh | 5 |
2 files changed, 32 insertions, 3 deletions
diff --git a/patches/asm/masm-align-64.patch b/patches/asm/masm-align-64.patch new file mode 100644 index 0000000..ba41c71 --- /dev/null +++ b/patches/asm/masm-align-64.patch | |||
| @@ -0,0 +1,30 @@ | |||
| 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"; | ||
| @@ -240,9 +240,8 @@ gen_asm() { | |||
| 240 | setup_asm_generator() { | 240 | setup_asm_generator() { |
| 241 | rm -fr $asm_src | 241 | rm -fr $asm_src |
| 242 | cp -a $libcrypto_src $asm_src | 242 | cp -a $libcrypto_src $asm_src |
| 243 | for i in `ls -1 patches/asm/*.patch | sort -n`; do | 243 | patch -d $asm_src -p0 < patches/asm/endbr64.patch |
| 244 | patch -d $asm_src -p0 < $i 1> /dev/null 2>/dev/null ; | 244 | patch -d $asm_src -p4 < patches/asm/masm-align-64.patch |
| 245 | done | ||
| 246 | } | 245 | } |
| 247 | 246 | ||
| 248 | setup_asm_generator | 247 | setup_asm_generator |
