Skip to content

Commit

Permalink
Work around BoringSSL bitcode linker warning (#470)
Browse files Browse the repository at this point in the history
* Work around BoringSSL bitcode linker warning

When linking envoy-mobile to an iOS app that ships with bitcode, you get
these warnings from the linker:

```
ld: warning: Linker asked to preserve internal global: 'sk_CRYPTO_BUFFER_call_free_func'
ld: warning: Linker asked to preserve internal global: 'sk_X509_call_free_func'
ld: warning: Linker asked to preserve internal global: 'sk_X509_call_free_func'
ld: warning: Linker asked to preserve internal global: 'sk_X509_call_free_func'
ld: warning: Linker asked to preserve internal global: 'sk_X509_call_free_func'
```

I have submitted an upstream patch to fix this
https://boringssl-review.googlesource.com/c/boringssl/+/37804 in the
meantime I've applied that patch here.

Signed-off-by: Keith Smiley <[email protected]>
Signed-off-by: JP Simard <[email protected]>
  • Loading branch information
keith authored and jpsim committed Nov 29, 2022
1 parent e6a5fc2 commit 2377f24
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions mobile/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ http_archive(
urls = ["https://github.com/abseil/abseil-cpp/archive/61c9bf3e3e1c28a4aa6d7f1be4b37fd473bb5529.tar.gz"],
)

# This should be kept in sync with Envoy itself, we just need to apply this patch
# Remove this once https://boringssl-review.googlesource.com/c/boringssl/+/37804 is in master-with-bazel
http_archive(
name = "boringssl",
patches = ["//bazel:boringssl.patch"],
sha256 = "36049e6cd09b353c83878cae0dd84e8b603ba1a40dcd74e44ebad101fc5c672d",
strip_prefix = "boringssl-37b57ed537987f1b4c60c60fa1aba20f3a0f6d26",
urls = ["https://github.com/google/boringssl/archive/37b57ed537987f1b4c60c60fa1aba20f3a0f6d26.tar.gz"],
)

local_repository(
name = "envoy",
path = "envoy",
Expand Down
11 changes: 11 additions & 0 deletions mobile/bazel/boringssl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- src/include/openssl/base.h
+++ src/include/openssl/base.h
@@ -258,7 +258,7 @@ extern "C" {
// with the old gnu89 model:
// https://stackoverflow.com/questions/216510/extern-inline
#if defined(__cplusplus)
-#define OPENSSL_INLINE inline
+#define OPENSSL_INLINE static inline
#else
// Add OPENSSL_UNUSED so that, should an inline function be emitted via macro
// (e.g. a |STACK_OF(T)| implementation) in a source file without tripping

0 comments on commit 2377f24

Please sign in to comment.