@@ -2375,13 +2375,31 @@ for host in "${ALL_HOSTS[@]}"; do
23752375 echo " copying compiler-rt embedded builtins from ${HOST_CXX_BUILTINS_DIR} into the local clang build directory ${DEST_BUILTINS_DIR} ."
23762376
23772377 for OS in ios watchos tvos; do
2378+ # Copy over the device .a
23782379 LIB_NAME=" libclang_rt.$OS .a"
23792380 HOST_LIB_PATH=" $HOST_CXX_BUILTINS_DIR /$LIB_NAME "
23802381 if [[ -f " ${HOST_LIB_PATH} " ]]; then
23812382 call cp " ${HOST_LIB_PATH} " " ${DEST_BUILTINS_DIR} /${LIB_NAME} "
23822383 elif [[ " ${VERBOSE_BUILD} " ]]; then
23832384 echo " no file exists at ${HOST_LIB_PATH} "
23842385 fi
2386+ # Copy over the simulator .a
2387+ SIM_LIB_NAME=" libclang_rt.${OS} sim.a"
2388+ HOST_SIM_LIB_PATH=" $HOST_CXX_BUILTINS_DIR /$SIM_LIB_NAME "
2389+ if [[ -f " ${HOST_SIM_LIB_PATH} " ]]; then
2390+ call cp " ${HOST_SIM_LIB_PATH} " " ${DEST_BUILTINS_DIR} /${SIM_LIB_NAME} "
2391+ elif [[ " ${HOST_LIB_PATH} " ]]; then
2392+ # The simulator .a might not exist if the host
2393+ # Xcode is old. In that case, copy over the
2394+ # device library to the simulator location to allow
2395+ # clang to find it. The device library has the simulator
2396+ # slices in Xcode that doesn't have the simulator .a, so
2397+ # the link is still valid.
2398+ echo " copying over faux-sim library ${HOST_LIB_PATH} to ${SIM_LIB_NAME} "
2399+ call cp " ${HOST_LIB_PATH} " " ${DEST_BUILTINS_DIR} /${SIM_LIB_NAME} "
2400+ elif [[ " ${VERBOSE_BUILD} " ]]; then
2401+ echo " no file exists at ${HOST_SIM_LIB_PATH} "
2402+ fi
23852403 done
23862404 done
23872405 fi
0 commit comments