From c4f0796c1c19970ff39211ec49edba26620ab37d Mon Sep 17 00:00:00 2001 From: Mungo Gill Date: Mon, 8 Dec 2025 16:59:05 +0000 Subject: [PATCH] Workaround Apple linker deduplication bug --- .github/workflows/ci.yml | 23 +++++++++++++++++++ .../boost/http_proto/server/basic_router.hpp | 9 ++++++++ test/unit/CMakeLists.txt | 4 +++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a73ea944..35184112 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -158,6 +158,18 @@ jobs: # OSX compilers # + - compiler: "apple-clang" + version: "*" + cxx: "clang++" + cc: "clang" + runs-on: "macos-26" + b2-toolset: "clang" + is-latest: true + name: "Apple-Clang (macOS 26)" + shared: true + build-type: "Release" + build-cmake: true + - compiler: "apple-clang" version: "*" cxx: "clang++" @@ -182,6 +194,17 @@ jobs: build-type: "RelWithDebInfo" asan: true + - compiler: "apple-clang" + version: "*" + cxx: "clang++" + cc: "clang" + runs-on: "macos-15" + b2-toolset: "clang" + name: "Apple-Clang (macOS 15)" + shared: false + build-type: "Release" + build-cmake: true + - compiler: "apple-clang" version: "*" cxx: "clang++" diff --git a/include/boost/http_proto/server/basic_router.hpp b/include/boost/http_proto/server/basic_router.hpp index 90535107..9dc9c1a1 100644 --- a/include/boost/http_proto/server/basic_router.hpp +++ b/include/boost/http_proto/server/basic_router.hpp @@ -1009,6 +1009,15 @@ class basic_router : public /*detail::*/any_router } catch(E const& ex) { +#ifdef __APPLE__ + // The Apple linker has a bug whereby it can erroneously + // deduplicate functions with identical codegen even though the + // unwind tables are different. Here we force different codegen + // depending on the type of E. + static volatile int apple_linker_bug_workaround_ = 0; + if(apple_linker_bug_workaround_) + throw ex; +#endif // APPLE set_resume u(p_); // VFALCO What if h throws? auto rv = h(p, ex); diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index bf0cba20..892d59b9 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -7,7 +7,9 @@ # Official repository: https://github.com/cppalliance/http_proto # -add_subdirectory(../../../url/extra/test_suite test_suite) +if (NOT TARGET boost_url_test_suite) + add_subdirectory(../../../url/extra/test_suite test_suite) +endif() file(GLOB_RECURSE PFILES CONFIGURE_DEPENDS *.cpp *.hpp) list(APPEND PFILES