libressl/portable

aes/aesni-macosx-x86_64.S:890:2: error: invalid instruction mnemonic 'endbr64'

vollkommenheit opened this issue · 21 comments

Same error as the resolved #866 but now in another file:

Making check in openssl
echo "generating opensslconf.h ..."
generating opensslconf.h ...
cp ../../include/arch/amd64/opensslconf.h opensslconf.h
/Applications/Xcode.app/Contents/Developer/usr/bin/make check-am
make[3]: Nothing to be done for check-am'. make[2]: Nothing to be done for check-am'.
Making check in crypto
echo "generating crypto_portable.sym ..."
generating crypto_portable.sym ...
cp ../crypto/crypto.sym crypto_portable.sym
chmod u+w crypto_portable.sym
/Applications/Xcode.app/Contents/Developer/usr/bin/make check-am
CPPAS aes/libcrypto_la-aes-macosx-x86_64.lo
CPPAS aes/libcrypto_la-bsaes-macosx-x86_64.lo
CPPAS aes/libcrypto_la-vpaes-macosx-x86_64.lo
CPPAS aes/libcrypto_la-aesni-macosx-x86_64.lo
aes/aesni-macosx-x86_64.S:890:2: error: invalid instruction mnemonic 'endbr64'
endbr64
^~~~~~~
make[2]: *** [aes/libcrypto_la-aesni-macosx-x86_64.lo] Error 1
make[1]: *** [check] Error 2
make: *** [check-recursive] Error 1
start make...
Making all in include
Making all in openssl
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
make[3]: Nothing to be done for all-am'. make[2]: Nothing to be done for all-am'.
Making all in crypto
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
CPPAS aes/libcrypto_la-aesni-macosx-x86_64.lo
CPPAS aes/libcrypto_la-aesni-sha1-macosx-x86_64.lo
aes/aesni-macosx-x86_64.S:890:2: error: invalid instruction mnemonic 'endbr64'
endbr64
^~~~~~~
make[2]: *** [aes/libcrypto_la-aesni-macosx-x86_64.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

Last successful build was 2023-10-21.

Can you tell us what version of macOS / xcode you're using please?

Can you tell us what version of macOS / xcode you're using please?

Still the same as in #866:
clang -v
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

Same problem here...
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin18.7.0
Thread model: posix

I'm assuming you're both using the release version of 3.8.2?

Hmm, will need to figure out how to make this fail in CI, which it isn't. Any thoughts @joshuasing ? We may need to adjust macos builds to be explicit about arch if they're not.

I see the issue, there was one missed patch in the aesni generator. It seems that the newer toolchains ignore this.

After the new commits (0d9bb74 and 63635ea), I was still getting errors:

Making check in openssl
echo "generating opensslconf.h ..."
generating opensslconf.h ...
cp ../../include/arch/amd64/opensslconf.h opensslconf.h
/Applications/Xcode.app/Contents/Developer/usr/bin/make check-am
make[3]: Nothing to be done for check-am'. make[2]: Nothing to be done for check-am'.
Making check in crypto
echo "generating crypto_portable.sym ..."
generating crypto_portable.sym ...
cp ../crypto/crypto.sym crypto_portable.sym
chmod u+w crypto_portable.sym
/Applications/Xcode.app/Contents/Developer/usr/bin/make check-am
CPPAS aes/libcrypto_la-aes-macosx-x86_64.lo
CPPAS aes/libcrypto_la-bsaes-macosx-x86_64.lo
CPPAS aes/libcrypto_la-vpaes-macosx-x86_64.lo
CPPAS aes/libcrypto_la-aesni-macosx-x86_64.lo
aes/aesni-macosx-x86_64.S:890:2: error: invalid instruction mnemonic 'endbr64'
endbr64
^~~~~~~
make[2]: *** [aes/libcrypto_la-aesni-macosx-x86_64.lo] Error 1
make[1]: *** [check] Error 2
make: *** [check-recursive] Error 1
start make...
Making all in include
Making all in openssl
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
make[3]: Nothing to be done for all-am'. make[2]: Nothing to be done for all-am'.
Making all in crypto
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
CPPAS aes/libcrypto_la-aesni-sha1-macosx-x86_64.lo
CPPAS aes/libcrypto_la-aesni-macosx-x86_64.lo
aes/aesni-macosx-x86_64.S:890:2: error: invalid instruction mnemonic 'endbr64'
endbr64
^~~~~~~
make[2]: *** [aes/libcrypto_la-aesni-macosx-x86_64.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

I have to put this line:
libcrypto_la_CPPFLAGS += -Dendbr64=
removed in 98a5122 on 2023-10-31
back into ./crypto/Makefile.am.macosx-x86_64 in order to make it compile. I see it was removed to resolve some unspecified issues on macOS, but it seems still needed at least on macOS X 10.11.6 (darwin15.6.0).

Perhaps @armdn can chime back in, on whether that line is needed on darwin18.7.0.

On Wed, Nov 15, 2023 at 10:38:04PM -0800, vollkommenheit wrote: @busterb @botovq
It's expected. There was a patch in the first commit that should help you: d0d17f8 However, what I accidentally merged and then reverted was just a CI change and apparently the CI still cannot reprdocue the problem you're seeing.

I'm not sure I follow. Do you mean d0d17f8 was meant to deal with this #933 issue, but the subsequent 96e5e35 removing patches/asm/0005-Revert-aesni-endbr64.patch was deliberate, because the CI still produces no error, therefore d0d17f8 is deemed not necessary in the master branch?

commit 96e5e35
Author: Brent Cook busterb@gmail.com
Date: Fri Nov 10 03:20:04 2023 -0600

experiment forcing CI failure

commit d0d17f8
Author: Brent Cook busterb@gmail.com
Date: Thu Nov 9 20:59:03 2023 -0600

remove additional endbr64 patch, add tests for macos-11

With latest pulls on master now is everything goes smoothly. Builded just right now.
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin18.7.0
Thread model: posix

With latest pulls on master now is everything goes smoothly. Builded just right now. Apple clang version 11.0.0 (clang-1100.0.33.17) Target: x86_64-apple-darwin18.7.0 Thread model: posix

@armdn Thanks. Could you check if you have the ./patches/asm/0005-Revert-aesni-endbr64.patch in your build directory after pulling? I don't, which I guess is the problem on my end (not sure it's supposed to be included or not, yet).

Yep, no such .patch file in this directory.

@vollkommenheit I have now landed patch 005 in #949. Hopefully that will resolve your issues if you build from HEAD.

CPPAS sha/libcrypto_la-sha512-macosx-x86_64.lo
CPPAS whrlpool/libcrypto_la-wp-macosx-x86_64.lo
CPPAS libcrypto_la-cpuid-macosx-x86_64.lo
CPPAS bn/arch/amd64/libcrypto_la-bignum_add.lo
bn/arch/amd64/bignum_add.S:52:2: error: invalid instruction mnemonic 'endbr64'
endbr64
^~~~~~~
make[2]: *** [bn/arch/amd64/libcrypto_la-bignum_add.lo] Error 1
make[1]: *** [check] Error 2
make: *** [check-recursive] Error 1

wtn commented

For @vollkommenheit and others who may encounter this issue on ancient releases of Mac OS X:

I had to build something using the developer tools from Xcode 6.0.1 on macOS 10.9.5 Mavericks.

I observed that LibreSSL 3.8.2 and 3.8.3 would not compile, but 3.8.1 and 3.9.0 are OK. So I moved ahead to the 3.9 branch.

Mind posting the error in 3.8.3? I don't have an ancient machine to test on there, but it should have most of the fixes from 3.9.0.

wtn commented

I redownloaded the 3.8.3 tarball to make sure and I can confirm the error.

I've attached a copy of the output. It looks identical to what vollkommenheit posted above.

libressl 3.8.3 + macOS 10.9.5 build error

Are you using a newer compiler than that OS shipped with? I tried it on an old vagrant box of 10.9 from 10 years ago, and while I had issues just using any of the basic tools like curl and wget, it seemed to build OK with the ancient stuff.

wtn commented

I'm using a vanilla setup with only Xcode 6.2 (6C131e) and the Command Line Tools installed.

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
wtn commented

I tested with 3.8.4 and the issue appears to be resolved.

Thanks a lot @wtn