Enable symbol prefixing for the Bazel build It seems folks run into symbol conflicts between OpenSSL and BoringSSL in Bazel packages: https://github.com/bazelbuild/bazel/issues/26827 Given we have tools for this now, let's turn this on. Just use a hardcoded "bssl_bzl" prefix because BCR doesn't let multiple copies of a package get linked at once, so we don't have to incorporate a version or anything complex like this. Change-Id: I2bdce7370418240321c39267750e27af20391b40 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/98967 Presubmit-BoringSSL-Verified: boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Rudolf Polzer <rpolzer@google.com> Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/BUILD.bazel b/BUILD.bazel index aef0732..ccfc818 100644 --- a/BUILD.bazel +++ b/BUILD.bazel
@@ -27,8 +27,8 @@ "crypto_sources", "crypto_sources_asm", "crypto_test_data", - "crypto_test_sources", "crypto_test_internal_headers", + "crypto_test_sources", "decrepit_internal_headers", "decrepit_sources", "decrepit_test_sources", @@ -73,6 +73,9 @@ hdrs = crypto_headers, asm_srcs = bcm_sources_asm + crypto_sources_asm, copts = ["-DBORINGSSL_IMPLEMENTATION"], + # :crypto is the bottom of the dependency tree, so it suffices to add the + # prefix here and propagate to users. + defines = ["BORINGSSL_PREFIX=bssl_bzl"], includes = ["include"], internal_hdrs = bcm_internal_headers + crypto_internal_headers, linkopts = select({
diff --git a/util/util.bzl b/util/util.bzl index ff8574d..5418266 100644 --- a/util/util.bzl +++ b/util/util.bzl
@@ -131,6 +131,7 @@ name, asm_srcs = [], copts = [], + defines = [], deps = [], implementation_deps = [], hdrs = [], @@ -155,6 +156,7 @@ srcs = srcs + handle_asm_srcs(asm_srcs), hdrs = hdrs + internal_hdrs, copts = copts + boringssl_copts, + defines = defines, conlyopts = boringssl_conlyopts, cxxopts = boringssl_cxxopts, includes = includes, @@ -173,8 +175,10 @@ # Depend on the internal target via implementation_deps to avoid # re-exporting internal_hdrs. implementation_deps = [":" + name_internal], - # Although picked up transitively, re-specify deps and includes, so - # that targets depending on the public target also pick them up. + # implementation_deps suppresses transitivity of defines, deps, and + # includes. Respecify them so that targets depending on the public + # target also pick them up. + defines = defines, deps = deps, includes = includes, visibility = visibility,