diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -88,6 +88,11 @@ cl::desc("Minimum density for building a jump table in " "an optsize function")); +/// Allow overriding bzero libcall +cl::opt + OverrideBzeroLibcall("override-libcall-bzero", + cl::desc("The function name for bzero"), cl::Hidden); + static bool darwinHasSinCos(const Triple &TT) { assert(TT.isOSDarwin() && "should be called with darwin triple"); // Don't bother with 32 bit x86. @@ -206,6 +211,9 @@ if (TT.isOSOpenBSD()) { setLibcallName(RTLIB::STACKPROTECTOR_CHECK_FAIL, nullptr); } + + if (!OverrideBzeroLibcall.empty()) + setLibcallName(RTLIB::BZERO, OverrideBzeroLibcall.data()); } /// getFPEXT - Return the FPEXT_*_* value for the given types, or