Skip to content

Commit 245db53

Browse files
committed
Strip i386 arch from tvOS compiler-rt lib (if present)
This is to avoid the following issue when generating toolchains for macOS ``` ld: building for tvOS, but linking in object file built for tvOS Simulator, file '/tmp/strip.mgCPcB' for architecture i386 fatal error: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip: internal link edit command failed ``` This reverts commit 8470faf, #37929 Addresses rdar://80098850
1 parent 2914504 commit 245db53

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

utils/build-script-impl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,12 @@ function copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain() {
14681468
DEST_LIB_PATH="${DEST_BUILTINS_DIR}/${LIB_NAME}"
14691469
if [[ ! -f "${DEST_LIB_PATH}" ]]; then
14701470
if [[ -f "${HOST_LIB_PATH}" ]]; then
1471-
call cp "${HOST_LIB_PATH}" "${DEST_LIB_PATH}"
1471+
if [[ "$OS" == "tvos" ]]; then
1472+
# This is to avoid strip failures when generating a toolchain
1473+
call lipo -remove i386 "${HOST_LIB_PATH}" -output "${DEST_LIB_PATH}" || call cp "${HOST_LIB_PATH}" "${DEST_LIB_PATH}"
1474+
else
1475+
call cp "${HOST_LIB_PATH}" "${DEST_LIB_PATH}"
1476+
fi
14721477
elif [[ "${VERBOSE_BUILD}" ]]; then
14731478
echo "no file exists at ${HOST_LIB_PATH}"
14741479
fi
@@ -1480,7 +1485,12 @@ function copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain() {
14801485
DEST_SIM_LIB_PATH="${DEST_BUILTINS_DIR}/${SIM_LIB_NAME}"
14811486
if [[ ! -f "${DEST_SIM_LIB_PATH}" ]]; then
14821487
if [[ -f "${HOST_SIM_LIB_PATH}" ]]; then
1483-
call cp "${HOST_SIM_LIB_PATH}" "${DEST_SIM_LIB_PATH}"
1488+
if [[ "$OS" == "tvos" ]]; then
1489+
# This is to avoid strip failures when generating a toolchain
1490+
call lipo -remove i386 "${HOST_SIM_LIB_PATH}" -output "${DEST_SIM_LIB_PATH}" || call cp "${HOST_SIM_LIB_PATH}" "${DEST_SIM_LIB_PATH}"
1491+
else
1492+
call cp "${HOST_SIM_LIB_PATH}" "${DEST_SIM_LIB_PATH}"
1493+
fi
14841494
elif [[ -f "${HOST_LIB_PATH}" ]]; then
14851495
# The simulator .a might not exist if the host
14861496
# Xcode is old. In that case, copy over the

0 commit comments

Comments
 (0)