fix(macos): preserve exception RTTI in amalgam archive (#4350)

Co-authored-by: Bart Louwers <bart@emeel.net>
This commit is contained in:
Taku Fukada
2026-08-30 17:28:43 +09:00
committed by GitHub
parent 2919f71e39
commit be3f03b86e
2 changed files with 18 additions and 1 deletions

View File

@@ -144,12 +144,23 @@ add_test(
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
find_program(ARMERGE NAMES armerge)
find_program(
LLVM_OBJCOPY
NAMES llvm-objcopy
HINTS
/opt/homebrew/opt/llvm/bin
/usr/local/opt/llvm/bin
)
if(MLN_CREATE_AMALGAMATION)
if(NOT ARMERGE)
message(FATAL_ERROR "armerge required when MLN_CREATE_AMALGAMATION=ON")
endif()
if(NOT LLVM_OBJCOPY)
message(FATAL_ERROR "llvm-objcopy required when MLN_CREATE_AMALGAMATION=ON")
endif()
message(STATUS "Found armerge: ${ARMERGE}")
message(STATUS "Found llvm-objcopy: ${LLVM_OBJCOPY}")
include(${PROJECT_SOURCE_DIR}/cmake/find_static_library.cmake)
set(STATIC_LIBS "")
@@ -170,6 +181,12 @@ if(MLN_CREATE_AMALGAMATION)
$<TARGET_FILE:mbgl-vendor-icu>
$<TARGET_FILE:mlt-cpp>
${STATIC_LIBS}
# In Mach-O/Itanium ABI names, ZTI/ZTS/ZTV identify typeinfo,
# type names, and vtables, while St denotes std::.
# Keep them global so C++ exception matching works in downstream code.
COMMAND ${LLVM_OBJCOPY} --wildcard
"--globalize-symbol=__ZT[ISV]St*"
libmbgl-core-amalgam.a
)
endif()