Re: git: f0798d084392 - stable/15 - openssl: build legacy provider as upstream does

From: Gordon Tetlow <gordon_at_freebsd.org>
Date: Mon, 16 Nov 2026 08:50:42 UTC
Odd. I did a buildworld against both amd64 and aarch64 without any issue. It also ran in main without issue. Can you see if a clean build reproduces it?

Gordon

> On Nov 15, 2026, at 23:37, freebsd@oldach.net wrote:
> 
> Gordon Tetlow wrote on Mon, 16 Nov 2026 07:33:19 +0100 (CET):
>> The branch stable/15 has been updated by gordon:
>> 
>> URL: https://cgit.FreeBSD.org/src/commit/?id=f0798d0843924389f4da582697c31c3af6aaa802
>> 
>> commit f0798d0843924389f4da582697c31c3af6aaa802
>> Author:     Gordon Tetlow <gordon@FreeBSD.org>
>> AuthorDate: 2026-11-06 18:42:45 +0000
>> Commit:     Gordon Tetlow <gordon@FreeBSD.org>
>> CommitDate: 2026-11-16 06:22:19 +0000
>> 
>>    openssl: build legacy provider as upstream does
>> 
>>    - Build with libcrypto's compile flags: modules/Makefile.inc now
>>      includes libcrypto's Makefile.inc, which brings in Makefile.common
>>      (NDEBUG, the asm dispatch defines, OPENSSL_PIC, the directory
>>      defines).  Before this change, assertions were enabled in legacy.so.
>>    - Use upstream's per-architecture source list: the provider's own CPU
>>      capability code (cpuid asm and armcap.c/ppccap.c, or mem_clr.c
>>      without asm), and the MD5, RC4 and DES asm where upstream uses it.
>>      The provider no longer uses libcrypto's exported RC4, SHA1 and
>>      CRYPTO_*128 functions.
>>    - Drop the objects that upstream's linker leaves out of legacy.so
>>      (fcrypt_b.c, md5_one.c, md5_sha1.c, provider_err.c and
>>      ciphercommon_{ccm,gcm}*.c / ciphercommon_hw.c).  Without them,
>>      params_idx.c is not needed either.
>>    - Add a version script, a copy of upstream's providers/legacy.ld, so
>>      that only OSSL_provider_init is exported.  Around 209 symbols were
>>      exported before.
>> 
>>    Reviewed by:            ngie
>>    Event:                  FreeBSD Vendor Summit 2026
>>    Differential Revision:  https://reviews.freebsd.org/D60398
>> 
>>    (cherry picked from commit 46453f0abb85c1c93dce7139950c6343a6cf04df)
>> ---
>> secure/lib/libcrypto/modules/Makefile.inc       | 12 ++---
>> secure/lib/libcrypto/modules/legacy/Makefile    | 67 ++++++++++++++++++-------
>> secure/lib/libcrypto/modules/legacy/Version.map |  5 ++
>> 3 files changed, 57 insertions(+), 27 deletions(-)
> 
> This seems to break buildworld (seen on both amd64 and aarch64):
> 
> Building shared library legacy.so
> cc -march=i686 -mmmx -msse -msse2 -m32 -target x86_64-unknown-freebsd15.2 -DCOMPAT_LIBCOMPAT=\"32\" -DCOMPAT_libcompat=\"32\" -DCOMPAT_LIB32 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -B/usr/obj/usr/src/amd64.amd64/tmp/usr/lib32  -Wl,-zrelro -Wl,--version-script=/usr/src/secure/lib/libcrypto/modules/legacy/Version.map -Wl,--no-undefined-version    -fstack-protector-strong -shared -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel  -o legacy.so -Wl,-soname,legacy.so legacyprov.pico prov_running.pico ciphercommon.pico ciphercommon_block.pico cipher_desx.pico cipher_desx_hw.pico cipher_des.pico cipher_des_hw.pico cipher_tdes_common.pico cipher_blowfish.pico cipher_blowfish_hw.pico cipher_cast5.pico cipher_cast5_hw.pico cipher_rc2.pico cipher_rc2_hw.pico cipher_rc4.pico cipher_rc4_hw.pico cipher_rc4_hmac_md5.pico cipher_rc4_hmac_md5_hw.pico cipher_seed.pico cipher_seed_hw.pico cpuid.pico ctype.pico x86cpuid.pico crypt586.pico des-586.pico md5_dgst.pico md5-586.pico rc4-586.pico digestcommon.pico md4_prov.pico wp_prov.pico ripemd_prov.pico pbkdf1.pico pvkkdf.pico provider_ctx.pico provider_util.pico tls_pad.pico  -lcrypto
> ld.lld: error: duplicate symbol: OPENSSL_rdtsc
>>>> defined at cpuid.c
>>>>           cpuid.pico:(OPENSSL_rdtsc)
>>>> defined at x86cpuid.pico:(.text+0x1e0)
> 
> ld.lld: error: duplicate symbol: CRYPTO_memcmp
>>>> defined at cpuid.c
>>>>           cpuid.pico:(CRYPTO_memcmp)
>>>> defined at x86cpuid.pico:(.text+0x340)
> 
> ld.lld: error: duplicate symbol: OPENSSL_instrument_bus
>>>> defined at cpuid.c
>>>>           cpuid.pico:(OPENSSL_instrument_bus)
>>>> defined at x86cpuid.pico:(.text+0x370)
> 
> ld.lld: error: duplicate symbol: OPENSSL_instrument_bus2
>>>> defined at cpuid.c
>>>>           cpuid.pico:(OPENSSL_instrument_bus2)
>>>> defined at x86cpuid.pico:(.text+0x3e0)
> cc: error: linker command failed with exit code 1 (use -v to see invocation)
> 
>