@@ -1420,7 +1420,11 @@ function copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain() {
14201420 DEST_LIB_PATH=" ${DEST_BUILTINS_DIR} /${LIB_NAME} "
14211421 if [[ ! -f " ${DEST_LIB_PATH} " ]]; then
14221422 if [[ -f " ${HOST_LIB_PATH} " ]]; then
1423- call cp " ${HOST_LIB_PATH} " " ${DEST_LIB_PATH} "
1423+ if [[ " $OS " == " tvos" ]]; then
1424+ call lipo -remove i386 " ${HOST_LIB_PATH} " -output " ${DEST_LIB_PATH} "
1425+ else
1426+ call cp " ${HOST_LIB_PATH} " " ${DEST_LIB_PATH} "
1427+ fi
14241428 elif [[ " ${VERBOSE_BUILD} " ]]; then
14251429 echo " no file exists at ${HOST_LIB_PATH} "
14261430 fi
@@ -1432,7 +1436,11 @@ function copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain() {
14321436 DEST_SIM_LIB_PATH=" ${DEST_BUILTINS_DIR} /${SIM_LIB_NAME} "
14331437 if [[ ! -f " ${DEST_SIM_LIB_PATH} " ]]; then
14341438 if [[ -f " ${HOST_SIM_LIB_PATH} " ]]; then
1435- call cp " ${HOST_SIM_LIB_PATH} " " ${DEST_SIM_LIB_PATH} "
1439+ if [[ " $OS " == " tvos" ]]; then
1440+ call lipo -remove i386 " ${HOST_SIM_LIB_PATH} " -output " ${DEST_SIM_LIB_PATH} "
1441+ else
1442+ call cp " ${HOST_SIM_LIB_PATH} " " ${DEST_SIM_LIB_PATH} "
1443+ fi
14361444 elif [[ -f " ${HOST_LIB_PATH} " ]]; then
14371445 # The simulator .a might not exist if the host
14381446 # Xcode is old. In that case, copy over the
@@ -1441,7 +1449,12 @@ function copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain() {
14411449 # slices in Xcode that doesn't have the simulator .a, so
14421450 # the link is still valid.
14431451 echo " copying over faux-sim library ${HOST_LIB_PATH} to ${SIM_LIB_NAME} "
1444- call cp " ${HOST_LIB_PATH} " " ${DEST_SIM_LIB_PATH} "
1452+ if [[ " $OS " == " tvos" ]]; then
1453+ echo " Remove i386 from tvOS ${DEST_SIM_LIB_PATH} "
1454+ call lipo -remove i386 " ${HOST_LIB_PATH} " -output " ${DEST_SIM_LIB_PATH} "
1455+ else
1456+ call cp " ${HOST_LIB_PATH} " " ${DEST_SIM_LIB_PATH} "
1457+ fi
14451458 elif [[ " ${VERBOSE_BUILD} " ]]; then
14461459 echo " no file exists at ${HOST_SIM_LIB_PATH} "
14471460 fi
0 commit comments