Last active
May 20, 2026 07:15
-
-
Save dio/c642501419c3513a7d6e992c8b146f93 to your computer and use it in GitHub Desktop.
macOS: export all envoy_dynamic_module_callback_* symbols via visibility pragma (Envoy 5d71bc2f)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From 0d3b9844fb0ef7c0577d300159d939e9a9e4365e Mon Sep 17 00:00:00 2001 | |
| From: Dhi Aurrahman <dio@rockybars.com> | |
| Date: Wed, 20 May 2026 13:42:41 +0700 | |
| Subject: [PATCH] fix(macos): export all envoy_dynamic_module_callback_* | |
| symbols | |
| On macOS, only symbols exported in the Mach-O export table are resolvable | |
| via `dlsym` from dynamically loaded modules. Because Envoy is built with | |
| `-fvisibility=hidden`, the `envoy_dynamic_module_callback_*` symbols were | |
| not exported and were removed during the post-build `strip(1)` step. | |
| This caused dynamic modules relying on `dlsym` to fail at runtime even | |
| though the Envoy binary itself still ran correctly. | |
| Wrap the `extern "C"` blocks in both `abi_impl.cc` files with: | |
| #pragma GCC visibility push(default) | |
| ... | |
| #pragma GCC visibility pop | |
| so the callback symbols are exported and survive stripping. | |
| Linux is unaffected because ELF dynamic symbol handling differs from | |
| Mach-O, and these symbols remain available there. | |
| --- | |
| source/extensions/dynamic_modules/abi_impl.cc | 2 ++ | |
| source/extensions/filters/http/dynamic_modules/abi_impl.cc | 2 ++ | |
| 2 files changed, 4 insertions(+) | |
| diff --git a/source/extensions/dynamic_modules/abi_impl.cc b/source/extensions/dynamic_modules/abi_impl.cc | |
| index ef30d36227..6b644fca00 100644 | |
| --- a/source/extensions/dynamic_modules/abi_impl.cc | |
| +++ b/source/extensions/dynamic_modules/abi_impl.cc | |
| @@ -31,6 +31,7 @@ absl::flat_hash_map<std::string, void*> | |
| } // namespace | |
| +#pragma GCC visibility push(default) | |
| extern "C" { | |
| bool envoy_dynamic_module_callback_log_enabled(envoy_dynamic_module_type_log_level level) { | |
| @@ -3434,3 +3435,4 @@ __attribute__((weak)) void envoy_dynamic_module_callback_transport_socket_flush_ | |
| } | |
| } // extern "C" | |
| +#pragma GCC visibility pop | |
| diff --git a/source/extensions/filters/http/dynamic_modules/abi_impl.cc b/source/extensions/filters/http/dynamic_modules/abi_impl.cc | |
| index 0f5220fc95..a78b96ae19 100644 | |
| --- a/source/extensions/filters/http/dynamic_modules/abi_impl.cc | |
| +++ b/source/extensions/filters/http/dynamic_modules/abi_impl.cc | |
| @@ -448,6 +448,7 @@ getMutableDynamicMetadataListValue(envoy_dynamic_module_type_http_filter_envoy_p | |
| } // namespace | |
| +#pragma GCC visibility push(default) | |
| extern "C" { | |
| envoy_dynamic_module_type_metrics_result | |
| @@ -2435,6 +2436,7 @@ void envoy_dynamic_module_callback_http_clear_route_cluster_cache( | |
| } | |
| } // extern "C" | |
| +#pragma GCC visibility pop | |
| } // namespace HttpFilters | |
| } // namespace DynamicModules | |
| } // namespace Extensions | |
| -- | |
| 2.42.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment