Restore the libcrypto C++ runtime dependency, but with a build flag This almost stuck but broke some targets in Android. So we can work on clearing out those issues, restore the vtable, but gate it on a build flag, so Android can easily turn it back off. We'll then gradually fix Android until the build flag can be removed. Update-Note: If the build fails due to vtables, build with `BORINGSSL_TEMPORARY_NO_CXX_RUNTIME` and then contact the BoringSSL team, so we can help fix your build. It is expected that only Android will need to do this. Bug: 486922845 Change-Id: Iec1548f7b503bd561836b261c5ca0d2b7acdf43a Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/96467 Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: Adam Langley <agl@google.com> Auto-Submit: David Benjamin <davidben@google.com> Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/crypto/evp/internal.h b/crypto/evp/internal.h index d843933..6692c58 100644 --- a/crypto/evp/internal.h +++ b/crypto/evp/internal.h
@@ -229,10 +229,20 @@ public: static constexpr bool kAllowUniquePtr = true; - // TODO(crbug.com/487376811): Ideally this destructor should be virtual so - // that we can emit vtables in libcrypto. In that case we would be able to - // replace `pmeth` with virtual methods and subclassing. + // Use an optional virtual destructor. This class does not (yet) have a need + // for a vtable, but we intend to write code with vtables in the future. + // Virtual destructors add a reference to symbols in the C++ runtime, so trial + // the dependency here. This is, temporarily, gated on a build define. If this + // breaks your build, build with `BORINGSSL_TEMPORARY_NO_CXX_RUNTIME` and then + // contact the BoringSSL team, so we can help fix your build. + // + // TODO(crbug.com/486922845): Remove the `BORINGSSL_TEMPORARY_NO_CXX_RUNTIME` + // case. +#if defined(BORINGSSL_TEMPORARY_NO_CXX_RUNTIME) ~EvpPkeyCtx(); +#else + virtual ~EvpPkeyCtx(); +#endif // Method associated with this operation const bssl::EVP_PKEY_CTX_METHOD *pmeth = nullptr;