Index: llvm/include/llvm/IR/RuntimeLibcalls.def =================================================================== --- llvm/include/llvm/IR/RuntimeLibcalls.def +++ llvm/include/llvm/IR/RuntimeLibcalls.def @@ -522,6 +522,18 @@ // Deoptimization HANDLE_LIBCALL(DEOPTIMIZE, "__llvm_deoptimize") +// Entry/exit instrumentation (lib/Transforms/Utils/EntryExitInstrumenter.cpp). +HANDLE_LIBCALL(ENTRYEXIT1, "mcount") +HANDLE_LIBCALL(ENTRYEXIT2, ".mcount") +HANDLE_LIBCALL(ENTRYEXIT3, "\01__gnu_mcount_nc") +HANDLE_LIBCALL(ENTRYEXIT4, "\01_mcount") +HANDLE_LIBCALL(ENTRYEXIT5, "\01mcount") +HANDLE_LIBCALL(ENTRYEXIT6, "__mcount") +HANDLE_LIBCALL(ENTRYEXIT7, "_mcount") +HANDLE_LIBCALL(ENTRYEXIT8, "__cyg_profile_func_enter_bare") +HANDLE_LIBCALL(ENTRYEXIT9, "__cyg_profile_func_enter") +HANDLE_LIBCALL(ENTRYEXIT10, "__cyg_profile_func_exit") + HANDLE_LIBCALL(UNKNOWN_LIBCALL, nullptr) #undef HANDLE_LIBCALL Index: llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp =================================================================== --- llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp +++ llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp @@ -20,6 +20,9 @@ static void insertCall(Function &CurFn, StringRef Func, Instruction *InsertionPt, DebugLoc DL) { + // If you add code to recognize a new instrumentation function here, the + // function also needs to be added to include/llvm/IR/RuntimeLibcalls.def + // so that it is handled correctly by LTO. Module &M = *InsertionPt->getParent()->getParent()->getParent(); LLVMContext &C = InsertionPt->getParent()->getContext();