Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid dead-stripping rust compiler_builtins atoms #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cctools/ld64/src/ld/Resolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1192,9 +1192,10 @@ void Resolver::deadStripOptimize(bool force)
// unset liveness, so markLive() will recurse
(const_cast<ld::Atom*>(atom))->setLive(0);
}
// <rdar://problem/49468634> if doing LTO, mark all libclang_rt* mach-o atoms as live since the backend may suddenly codegen uses of them
// <rdar://problem/49468634> if doing LTO, mark all libclang_rt* mach-o atoms as live since the backend may suddenly codegen uses of them.
// Likewise with rust compiler_builtins atoms. They may come from a libcompiler_builtins-<hash>.a lib, or from a compiler_builtins-... member of a rust static library.
else if ( _haveLLVMObjs && !force && (atom->contentType() != ld::Atom::typeLTOtemporary) ) {
if ( isCompilerSupportLib(atom->safeFilePath()) ) {
if ( isCompilerSupportLib(atom->safeFilePath()) || strstr(atom->safeFilePath(), "compiler_builtins") != nullptr ) ) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I didn't add this check in isCompilerSupportLib because I wasn't sure of the side effects from other code using that function.

_deadStripRoots.insert(atom);
}
}
Expand Down