Skip to content

Commit c4f0796

Browse files
committed
Workaround Apple linker deduplication bug
1 parent 131fecf commit c4f0796

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,18 @@ jobs:
158158
# OSX compilers
159159
#
160160

161+
- compiler: "apple-clang"
162+
version: "*"
163+
cxx: "clang++"
164+
cc: "clang"
165+
runs-on: "macos-26"
166+
b2-toolset: "clang"
167+
is-latest: true
168+
name: "Apple-Clang (macOS 26)"
169+
shared: true
170+
build-type: "Release"
171+
build-cmake: true
172+
161173
- compiler: "apple-clang"
162174
version: "*"
163175
cxx: "clang++"
@@ -182,6 +194,17 @@ jobs:
182194
build-type: "RelWithDebInfo"
183195
asan: true
184196

197+
- compiler: "apple-clang"
198+
version: "*"
199+
cxx: "clang++"
200+
cc: "clang"
201+
runs-on: "macos-15"
202+
b2-toolset: "clang"
203+
name: "Apple-Clang (macOS 15)"
204+
shared: false
205+
build-type: "Release"
206+
build-cmake: true
207+
185208
- compiler: "apple-clang"
186209
version: "*"
187210
cxx: "clang++"

include/boost/http_proto/server/basic_router.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,6 +1009,15 @@ class basic_router : public /*detail::*/any_router
10091009
}
10101010
catch(E const& ex)
10111011
{
1012+
#ifdef __APPLE__
1013+
// The Apple linker has a bug whereby it can erroneously
1014+
// deduplicate functions with identical codegen even though the
1015+
// unwind tables are different. Here we force different codegen
1016+
// depending on the type of E.
1017+
static volatile int apple_linker_bug_workaround_ = 0;
1018+
if(apple_linker_bug_workaround_)
1019+
throw ex;
1020+
#endif // APPLE
10121021
set_resume u(p_);
10131022
// VFALCO What if h throws?
10141023
auto rv = h(p, ex);

test/unit/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
# Official repository: https://github.com/cppalliance/http_proto
88
#
99

10-
add_subdirectory(../../../url/extra/test_suite test_suite)
10+
if (NOT TARGET boost_url_test_suite)
11+
add_subdirectory(../../../url/extra/test_suite test_suite)
12+
endif()
1113

1214
file(GLOB_RECURSE PFILES CONFIGURE_DEPENDS *.cpp *.hpp)
1315
list(APPEND PFILES

0 commit comments

Comments
 (0)