Skip to content

Commit

Permalink
libressl-cmake.sh: disable ASM for Windows ARM64
Browse files Browse the repository at this point in the history
Turns out that the official Windows ARM64 curl.exe exited with an
assert when run with a simple command like: `curl https://example.org`.
```
Assertion failed: (i == BN_BITS2) || (h <= (BN_ULONG)1 << i), file \crypto\bn\bn_div.c, line 96
```
With asserts disabled the same command hung.

These warnings hinted to the problem:
```
In file included from libressl/crypto/bn/bn_add.c:65:
libressl/crypto/bn/arch/aarch64/bn_arch.h:35:16: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
   35 |             : [n]"=r"(n)
      |                       ^
libressl/crypto/bn/arch/aarch64/bn_arch.h:34:18: note: use constraint modifier "w"
   34 |         __asm__ ("clz   %[n], %[w]"
      |                         ^~~~
      |                         %w[n]
libressl/crypto/bn/arch/aarch64/bn_arch.h:36:15: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
   36 |             : [w]"r"(w));
      |                      ^
libressl/crypto/bn/arch/aarch64/bn_arch.h:34:24: note: use constraint modifier "w"
   34 |         __asm__ ("clz   %[n], %[w]"
      |                               ^~~~
      |                               %w[w]
libressl/crypto/bn/arch/aarch64/bn_arch.h:51:37: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
   51 |             : [carry]"=r"(carry), [r0]"=r"(r0)
      |                                            ^
[...]
```

autotools builds have ASM disabled by default for this build case.

Ref upstream PR disabling ASM for Windows ARM64 with CMake:
libressl/portable#989
  • Loading branch information
vszakats committed Jan 2, 2024
1 parent 5beb081 commit 2b66696
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion _versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export CURL_HASH=42ab8db9e20d8290a3b633e7fbb3cec15db34df65fd1015ef8ac1e4723750ee
# Create revision string
# NOTE: Set _REV to 1 after bumping CURL_VER_, then increment for each
# CI rebuild via `main` branch push (e.g. after bumping a dependency).
export _REV="${CW_REVISION:-3}"
export _REV="${CW_REVISION:-4}"

export TRURL_VER_='0.9'
export TRURL_HASH=848da38c0ea07cd96d6adac4a5e5e141fe26e5bd846039aa350c3ca589a948e0
Expand Down
7 changes: 7 additions & 0 deletions libressl-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ _VER="$1"
CPPFLAGS+=' -DNDEBUG'
fi

# LibreSSL (as of v3.8.2) hangs with ASM enabled on Windows ARM64.
# It also results in long list of ASM warnings when -DNDEBUG is set.
# This is hidden by CMake which force-unsets -DNDEBUG.
if [ "${_OS}" = 'win' ] && [ "${_CPU}" = 'a64' ]; then
options+=' -DENABLE_ASM=OFF'
fi

if [ "${_CC}" = 'llvm' ]; then
CFLAGS+=' -Wa,--noexecstack'
else
Expand Down
3 changes: 2 additions & 1 deletion libressl-pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
# SPDX-License-Identifier: MIT

# Caveats (as of 3.8.2):
# - ARM64 Windows builds exit with an assert.
# - ARM64 Windows builds exit with an assert and hang with asserts disabled.
# https://github.com/libressl/portable/issues/987
# https://github.com/libressl/portable/pull/989
# - CMake builds override -NDEBUG and do not allow building with this option.
# - ASM support only for x64.
# - ASM missing Intel CET support, resulting in linker warnings:
Expand Down

0 comments on commit 2b66696

Please sign in to comment.