diff --git a/library/exception.m b/library/exception.m
index 1d30051d2..92d072adf 100644
--- a/library/exception.m
+++ b/library/exception.m
@@ -1060,6 +1060,10 @@ catch_impl(Pred, Handler, T) :-
         MR_Pred handler_pred, MR_Box *output,
         MR_CONT_PARAMS);
 
+  #else  // MR_HIGHLEVEL_CODE
+    #ifdef MR_DEEP_PROFILING
+      #include ""mercury_profiling_builtin.h""
+    #endif
   #endif // MR_HIGHLEVEL_CODE
 
 #endif // ML_HLC_EXCEPTION_GUARD
@@ -1832,6 +1836,12 @@ MR_declare_entry(mercury__do_call_closure_compact);
 // The following is defined in runtime/mercury_trace_base.c.
 MR_declare_entry(MR_do_trace_redo_fail);
 
+#ifdef  MR_DEEP_PROFILING
+// The following are defined in library/profiling_builtin.m.
+MR_declare_entry(mercury__profiling_builtin__prepare_for_normal_call_1_0);
+MR_declare_entry(mercury__profiling_builtin__prepare_for_ho_call_2_0);
+#endif
+
 #ifdef  MR_DEEP_PROFILING
 MR_declare_label(mercury__exception__builtin_catch_3_0_i1);
 MR_declare_label(mercury__exception__builtin_catch_3_1_i1);
