@@ -1404,7 +1404,11 @@ function copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain() {
14041404 DEST_LIB_PATH=" ${DEST_BUILTINS_DIR} /${LIB_NAME} "
14051405 if [[ ! -f " ${DEST_LIB_PATH} " ]]; then
14061406 if [[ -f " ${HOST_LIB_PATH} " ]]; then
1407- call cp " ${HOST_LIB_PATH} " " ${DEST_LIB_PATH} "
1407+ if [[ " $OS " == " tvos" ]]; then
1408+ call lipo -remove i386 " ${HOST_LIB_PATH} " -output " ${DEST_LIB_PATH} "
1409+ else
1410+ call cp " ${HOST_LIB_PATH} " " ${DEST_LIB_PATH} "
1411+ fi
14081412 elif [[ " ${VERBOSE_BUILD} " ]]; then
14091413 echo " no file exists at ${HOST_LIB_PATH} "
14101414 fi
@@ -1416,7 +1420,11 @@ function copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain() {
14161420 DEST_SIM_LIB_PATH=" ${DEST_BUILTINS_DIR} /${SIM_LIB_NAME} "
14171421 if [[ ! -f " ${DEST_SIM_LIB_PATH} " ]]; then
14181422 if [[ -f " ${HOST_SIM_LIB_PATH} " ]]; then
1419- call cp " ${HOST_SIM_LIB_PATH} " " ${DEST_SIM_LIB_PATH} "
1423+ if [[ " $OS " == " tvos" ]]; then
1424+ call lipo -remove i386 " ${HOST_SIM_LIB_PATH} " -output " ${DEST_SIM_LIB_PATH} "
1425+ else
1426+ call cp " ${HOST_SIM_LIB_PATH} " " ${DEST_SIM_LIB_PATH} "
1427+ fi
14201428 elif [[ -f " ${HOST_LIB_PATH} " ]]; then
14211429 # The simulator .a might not exist if the host
14221430 # Xcode is old. In that case, copy over the
@@ -1425,7 +1433,12 @@ function copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain() {
14251433 # slices in Xcode that doesn't have the simulator .a, so
14261434 # the link is still valid.
14271435 echo " copying over faux-sim library ${HOST_LIB_PATH} to ${SIM_LIB_NAME} "
1428- call cp " ${HOST_LIB_PATH} " " ${DEST_SIM_LIB_PATH} "
1436+ if [[ " $OS " == " tvos" ]]; then
1437+ echo " Remove i386 from tvOS ${DEST_SIM_LIB_PATH} "
1438+ call lipo -remove i386 " ${HOST_LIB_PATH} " -output " ${DEST_SIM_LIB_PATH} "
1439+ else
1440+ call cp " ${HOST_LIB_PATH} " " ${DEST_SIM_LIB_PATH} "
1441+ fi
14291442 elif [[ " ${VERBOSE_BUILD} " ]]; then
14301443 echo " no file exists at ${HOST_SIM_LIB_PATH} "
14311444 fi
0 commit comments