From: Mike Hommey Date: Thu, 6 Jul 2023 07:28:13 +0900 Subject: [PATCH] Avoid dead-stripping rust compiler_builtins atoms Upstream PR: https://github.com/tpoechtrager/cctools-port/pull/135 Previously in-tree as cctools.patch, dropped in bug 1797216 (D266196). Adapted to the pinned revision, where libclang_rt handling moved into isCompilerSupportLib(). diff --git a/cctools/ld64/src/ld/Resolver.cpp b/cctools/ld64/src/ld/Resolver.cpp --- a/cctools/ld64/src/ld/Resolver.cpp +++ b/cctools/ld64/src/ld/Resolver.cpp @@ -1481,7 +1481,8 @@ // if doing LTO, mark all libclang_rt* mach-o atoms // as live since the backend may suddenly codegen uses of them if ( _haveLLVMObjs && !forceDeadStrip && (atom->contentType() != ld::Atom::typeLTOtemporary) ) { - if ( isCompilerSupportLib(atom->safeFilePath()) ) { + if ( isCompilerSupportLib(atom->safeFilePath()) || + strstr(atom->safeFilePath(), "compiler_builtins") != nullptr ) { return true; } }